Skip to content

Commit c925886

Browse files
committed
Update ai-code-generation-context.md
1 parent 6d5c165 commit c925886

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

patterns/2-structured/ai-code-generation-context.md

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ With the growing use of AI tools (like GitHub Copilot, ChatGPT, or custom LLMs),
1212

1313
## Context
1414

15-
- InnerSource adoption is in place across the organization
16-
- Developers are encouraged to use AI tools to improve productivity
17-
- Contributors may not be familiar or failed to prompt meticulously while generating code through AI with the target codebase's idioms, architecture, or constraints
18-
- Maintainers want to empower contributors using AI while preserving code consistency and maintainability
19-
- Multiple teams are contributing to shared repositories with varying levels of familiarity with project standards
20-
- Code review processes are becoming bottlenecked by AI-generated code that requires significant rework
15+
* InnerSource adoption is in place across the organization
16+
* Developers are encouraged to use AI tools to improve productivity
17+
* Contributors may not be familiar or failed to prompt meticulously while generating code through AI with the target codebase's idioms, architecture, or constraints
18+
* Maintainers want to empower contributors using AI while preserving code consistency and maintainability
19+
* Multiple teams are contributing to shared repositories with varying levels of familiarity with project standards
20+
* Code review processes are becoming bottlenecked by AI-generated code that requires significant rework
2121

2222
## Forces
2323

24-
- **AI Model Limitations**: AI models generate code based on generalized training data, not project-specific patterns, leading to generic solutions that may not fit the project's architecture
25-
- **Knowledge Gap**: New contributors using AI tools might unknowingly bypass existing architectural norms, coding standards, and established patterns
26-
- **Review Overhead**: AI-assisted PRs can significantly increase review load if not aligned with existing practices, as maintainers must spend time explaining and correcting deviations
27-
- **Productivity vs. Quality Trade-off**: While AI tools boost individual productivity, they can reduce overall team productivity if the generated code requires extensive rework
28-
- **Context Switching Cost**: Developers benefit from AI tools only when they have the right contextual grounding, but manually providing this context for each AI interaction is time-consuming
29-
- **Inconsistent Standards**: Different AI tools and different prompting approaches by contributors can lead to wildly inconsistent code styles and patterns
30-
- **Maintenance Burden**: Creating and maintaining comprehensive AI context requires ongoing effort from maintainers
31-
- **Tool Integration Complexity**: Different AI tools have different ways of consuming context, making it challenging to create universal guidance
32-
- **AI Tool Cost Constraints**: Comprehensive AI context increases processing costs (AI tools charge based on "tokens" - units of text measurement) and usage limits, requiring strategic balance between context completeness and efficiency
24+
* **AI Model Limitations**: AI models generate code based on generalized training data, not project-specific patterns, leading to generic solutions that may not fit the project's architecture
25+
* **Knowledge Gap**: New contributors using AI tools might unknowingly bypass existing architectural norms, coding standards, and established patterns
26+
* **Review Overhead**: AI-assisted PRs can significantly increase review load if not aligned with existing practices, as maintainers must spend time explaining and correcting deviations
27+
* **Productivity vs. Quality Trade-off**: While AI tools boost individual productivity, they can reduce overall team productivity if the generated code requires extensive rework
28+
* **Context Switching Cost**: Developers benefit from AI tools only when they have the right contextual grounding, but manually providing this context for each AI interaction is time-consuming
29+
* **Inconsistent Standards**: Different AI tools and different prompting approaches by contributors can lead to wildly inconsistent code styles and patterns
30+
* **Maintenance Burden**: Creating and maintaining comprehensive AI context requires ongoing effort from maintainers
31+
* **Tool Integration Complexity**: Different AI tools have different ways of consuming context, making it challenging to create universal guidance
32+
* **AI Tool Cost Constraints**: Comprehensive AI context increases processing costs (AI tools charge based on "tokens" * units of text measurement) and usage limits, requiring strategic balance between context completeness and efficiency
3333

3434
## Solution
3535

@@ -42,57 +42,57 @@ Create a `innersource-ai/` folder in the repository root containing:
4242
#### Core Documentation Files (Required)
4343

4444
`PROMPT.md`: Project-specific instructions for AI tools
45-
- Naming conventions (variables, functions, classes, files)
46-
- Logging patterns and error handling approaches
47-
- Testing strategy and preferred testing frameworks
48-
- Code formatting and style preferences
49-
- Common anti-patterns to avoid
50-
- Preferred libraries and frameworks for specific tasks
45+
* Naming conventions (variables, functions, classes, files)
46+
* Logging patterns and error handling approaches
47+
* Testing strategy and preferred testing frameworks
48+
* Code formatting and style preferences
49+
* Common anti-patterns to avoid
50+
* Preferred libraries and frameworks for specific tasks
5151

5252
`ARCHITECTURE.md`: Lightweight system overview
53-
- High-level system architecture and component relationships
54-
- Data flow patterns and API design principles
55-
- Dependency management guidelines
56-
- Module organization and layering principles
57-
- Integration patterns with external systems
53+
* High-level system architecture and component relationships
54+
* Data flow patterns and API design principles
55+
* Dependency management guidelines
56+
* Module organization and layering principles
57+
* Integration patterns with external systems
5858

5959
`STYLE_GUIDE.md`: Comprehensive coding guidelines
60-
- Language-specific style rules
61-
- Code organization patterns
62-
- Documentation standards
63-
- Performance considerations
64-
- Security guidelines and common vulnerabilities to avoid
60+
* Language-specific style rules
61+
* Code organization patterns
62+
* Documentation standards
63+
* Performance considerations
64+
* Security guidelines and common vulnerabilities to avoid
6565

6666
#### Optional Enhancements (Implement As Needed)
6767

6868
##### Practical Examples
6969

7070
`EXAMPLES/`: Sample code files demonstrating best practices
71-
- `good-examples/`: Well-written code snippets with explanations
72-
- `bad-examples/`: Common mistakes with explanations of why they're problematic
73-
- `refactoring-examples/`: Before/after code showing proper improvements
74-
- Template files for common patterns (controllers, services, utilities)
71+
* `good-examples/`: Well-written code snippets with explanations
72+
* `bad-examples/`: Common mistakes with explanations of why they're problematic
73+
* `refactoring-examples/`: Before/after code showing proper improvements
74+
* Template files for common patterns (controllers, services, utilities)
7575

7676
##### Configuration and Tooling
7777

7878
`CONFIG/`: Shared formatter and analysis configurations
79-
- `.prettierrc`, `.eslintrc`, or equivalent formatting configs
80-
- `.editorconfig` for consistent editor settings
81-
- Static analysis tool configurations
82-
- Pre-commit hook configurations
79+
* `.prettierrc`, `.eslintrc`, or equivalent formatting configs
80+
* `.editorconfig` for consistent editor settings
81+
* Static analysis tool configurations
82+
* Pre-commit hook configurations
8383

8484
`INTEGRATION/`: AI tool-specific integration guides
85-
- GitHub Copilot workspace configuration
86-
- Custom GPT instructions and prompts
87-
- IDE plugin configurations
88-
- CLI tool integration examples
85+
* GitHub Copilot workspace configuration
86+
* Custom GPT instructions and prompts
87+
* IDE plugin configurations
88+
* CLI tool integration examples
8989

9090
##### Advanced Features
9191

9292
`EMBEDDINGS/` (Optional): For advanced LLM integrations
93-
- Searchable knowledge base of project patterns
94-
- Vector embeddings of code examples
95-
- Semantic search capabilities for finding relevant patterns
93+
* Searchable knowledge base of project patterns
94+
* Vector embeddings of code examples
95+
* Semantic search capabilities for finding relevant patterns
9696

9797
### Implementation Strategy
9898

@@ -101,33 +101,33 @@ Create a `innersource-ai/` folder in the repository root containing:
101101
### Usage Patterns
102102

103103
#### For Contributors
104-
1. **Before Starting**: Review the AI context package to understand project standards
105-
2. **During Development**: Reference specific files when prompting AI tools
106-
3. **Code Generation**: Include relevant context snippets in AI prompts
107-
4. **Validation**: Use provided examples to verify AI-generated code aligns with standards
104+
* **Before Starting**: Review the AI context package to understand project standards
105+
* **During Development**: Reference specific files when prompting AI tools
106+
* **Code Generation**: Include relevant context snippets in AI prompts
107+
* **Validation**: Use provided examples to verify AI-generated code aligns with standards
108108

109109
#### For AI Tool Integration
110-
- **Direct Reference**: Copy relevant sections into AI tool prompts
111-
- **URL Integration**: Reference files via repository URLs in AI tools that support web access
112-
- **IDE Integration**: Configure AI plugins to automatically include context
113-
- **Custom Workflows**: Integrate context into CI/CD pipelines for automated validation
110+
* **Direct Reference**: Copy relevant sections into AI tool prompts
111+
* **URL Integration**: Reference files via repository URLs in AI tools that support web access
112+
* **IDE Integration**: Configure AI plugins to automatically include context
113+
* **Custom Workflows**: Integrate context into CI/CD pipelines for automated validation
114114

115115
### Maintenance Strategy
116116

117-
- **Version Control**: Track changes to AI context alongside code changes
118-
- **Regular Updates**: Review and update context as project standards evolve
119-
- **Community Contribution**: Allow contributors to suggest improvements to AI context
120-
- **Metrics Tracking**: Monitor the effectiveness of AI context through code review metrics
117+
* **Version Control**: Track changes to AI context alongside code changes
118+
* **Regular Updates**: Review and update context as project standards evolve
119+
* **Community Contribution**: Allow contributors to suggest improvements to AI context
120+
* **Metrics Tracking**: Monitor the effectiveness of AI context through code review metrics
121121

122122
## Resulting Context
123123

124-
- **Improved Code Quality**: AI-assisted contributions become consistent with existing code standards and architectural patterns from the first submission
125-
- **Reduced Review Friction**: Maintainers can trust incoming PRs more readily, significantly reducing review fatigue and time-to-merge
126-
- **Enhanced Contributor Experience**: Contributors using AI produce better, more maintainable code even on their first attempts, leading to increased confidence and participation
127-
- **Scalable Collaboration**: Opens the door to scalable, AI-aware InnerSource collaboration across teams without sacrificing code quality
128-
- **Knowledge Preservation**: Project knowledge becomes more explicit and accessible, reducing dependency on tribal knowledge
129-
- **Faster Onboarding**: New contributors can leverage AI tools effectively from day one, reducing the learning curve for project-specific patterns
130-
- **Consistent Evolution**: As AI tools improve, the context package ensures that enhanced capabilities are channeled toward project-appropriate solutions
124+
* **Improved Code Quality**: AI-assisted contributions become consistent with existing code standards and architectural patterns from the first submission
125+
* **Reduced Review Friction**: Maintainers can trust incoming PRs more readily, significantly reducing review fatigue and time-to-merge
126+
* **Enhanced Contributor Experience**: Contributors using AI produce better, more maintainable code even on their first attempts, leading to increased confidence and participation
127+
* **Scalable Collaboration**: Opens the door to scalable, AI-aware InnerSource collaboration across teams without sacrificing code quality
128+
* **Knowledge Preservation**: Project knowledge becomes more explicit and accessible, reducing dependency on tribal knowledge
129+
* **Faster Onboarding**: New contributors can leverage AI tools effectively from day one, reducing the learning curve for project-specific patterns
130+
* **Consistent Evolution**: As AI tools improve, the context package ensures that enhanced capabilities are channeled toward project-appropriate solutions
131131

132132
## Rationale
133133

@@ -143,18 +143,18 @@ To be added.
143143

144144
## Status
145145

146-
- Structured
147-
- Drafted in August 2025
146+
* Structured
147+
* Drafted in August 2025
148148

149149
## Author
150150

151151
[Amburi Roy](https://www.linkedin.com/in/amburi/)
152152

153153
## Related Patterns
154154

155-
- [Standard Base Documentation](../base-documentation.md) - Provides the foundation documentation that AI context builds upon
156-
- [InnerSource Portal](../innersource-portal.md) - Could include AI context availability as searchable metadata for project discovery
157-
- [Trusted Committer](../trusted-committer.md) - Trusted Committers are responsible for maintaining and evolving the AI context package
155+
* [Standard Base Documentation](../base-documentation.md) - Provides the foundation documentation that AI context builds upon
156+
* [InnerSource Portal](../innersource-portal.md) - Could include AI context availability as searchable metadata for project discovery
157+
* [Trusted Committer](../trusted-committer.md) - Trusted Committers are responsible for maintaining and evolving the AI context package
158158

159159
## License
160160

0 commit comments

Comments
 (0)