Skip to content

Commit 70eda41

Browse files
authored
docs: Add AGENTS.md documentation system
Add comprehensive AGENTS.md files throughout codebase to provide contextual information for AI development tools and human developers. Includes 10 AGENTS.md files covering backend architecture, services, models, schemas, routers, repositories, frontend architecture, and React components. Split from PR #265 for focused review. All CI checks passing ✅
1 parent 18220bb commit 70eda41

File tree

10 files changed

+3720
-0
lines changed

10 files changed

+3720
-0
lines changed

.github/AGENTS_README.md

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# AGENTS.md Documentation System
2+
3+
## Overview
4+
5+
This project uses **AGENTS.md files** throughout the codebase to provide contextual documentation for AI development tools (Claude Code, GitHub Copilot, etc.) and human developers.
6+
7+
## Purpose
8+
9+
AGENTS.md files serve as **living documentation** that:
10+
- ✅ Provides AI agents with architectural context and patterns
11+
- ✅ Helps developers understand module responsibilities quickly
12+
- ✅ Documents coding conventions and best practices
13+
- ✅ Serves as onboarding material for new team members
14+
- ✅ Ensures consistency across the codebase
15+
16+
## File Locations
17+
18+
```
19+
/AGENTS.md # Project overview
20+
├── backend/AGENTS.md # Backend architecture
21+
│ └── rag_solution/AGENTS.md # Main application
22+
│ ├── services/AGENTS.md # Service layer
23+
│ ├── models/AGENTS.md # Database models
24+
│ ├── schemas/AGENTS.md # API schemas
25+
│ ├── router/AGENTS.md # API endpoints
26+
│ └── repository/AGENTS.md # Data access
27+
└── frontend/AGENTS.md # Frontend architecture
28+
└── src/components/AGENTS.md # React components
29+
```
30+
31+
## How to Use
32+
33+
### For Developers
34+
35+
**Before starting work on a module:**
36+
1. Read the root `/AGENTS.md` for project overview
37+
2. Read the module-specific AGENTS.md file (e.g., `services/AGENTS.md`)
38+
3. Follow the patterns documented in those files
39+
4. Update AGENTS.md if you discover new patterns or issues
40+
41+
**Example workflow:**
42+
```
43+
Task: "Add a new search filter feature"
44+
45+
1. Read /AGENTS.md - Understand project architecture
46+
2. Read backend/rag_solution/services/AGENTS.md - Service patterns
47+
3. Read backend/rag_solution/router/AGENTS.md - API endpoint patterns
48+
4. Read backend/rag_solution/schemas/AGENTS.md - Schema patterns
49+
5. Implement following the documented patterns
50+
```
51+
52+
### For AI Development Tools
53+
54+
AI tools automatically benefit from AGENTS.md files:
55+
- **Claude Code**: Reads AGENTS.md for context when making changes
56+
- **GitHub Copilot**: Uses AGENTS.md for better code suggestions
57+
- **Other AI Tools**: Can reference AGENTS.md for architectural understanding
58+
59+
## What's Included in AGENTS.md Files
60+
61+
Each AGENTS.md file contains:
62+
- **Module Purpose**: What this module does
63+
- **Key Files**: Important files and their responsibilities
64+
- **Patterns**: Code patterns and conventions used
65+
- **Best Practices**: Dos and don'ts
66+
- **Common Pitfalls**: Mistakes to avoid
67+
- **Examples**: Code examples following patterns
68+
- **Related Files**: Links to other relevant AGENTS.md files
69+
70+
## What's NOT Included
71+
72+
AGENTS.md files do NOT contain:
73+
- ❌ Detailed API documentation (use OpenAPI/Swagger instead)
74+
- ❌ Duplicate code from docstrings
75+
- ❌ Temporary implementation notes
76+
- ❌ Issue-specific details (use GitHub issues)
77+
- ❌ Line-by-line code explanations
78+
79+
## Maintaining AGENTS.md Files
80+
81+
### When to Update
82+
83+
Update AGENTS.md files when:
84+
- Adding new modules or major features
85+
- Changing architectural patterns
86+
- Discovering common pitfalls
87+
- Adding new best practices
88+
- Performing major refactoring
89+
- Finding better ways to implement patterns
90+
91+
### How to Update
92+
93+
1. **Identify the file**: Find the AGENTS.md file for the module you're working on
94+
2. **Add your changes**: Document new patterns, pitfalls, or best practices
95+
3. **Keep it concise**: Focus on patterns and principles, not implementation details
96+
4. **Include examples**: Show code examples of the pattern
97+
5. **Link related files**: Reference other AGENTS.md files where relevant
98+
6. **Commit changes**: AGENTS.md files are version controlled
99+
100+
### Template for New Modules
101+
102+
When creating a new module, create an AGENTS.md file:
103+
104+
```markdown
105+
# Module Name - AI Agent Context
106+
107+
## Overview
108+
Brief description of the module's purpose and responsibilities.
109+
110+
## Key Files
111+
- `file1.py`: What it does
112+
- `file2.py`: What it does
113+
114+
## Common Patterns
115+
116+
### Pattern Name
117+
Description and example code.
118+
119+
## Best Practices
120+
1. Do this
121+
2. Don't do that
122+
123+
## Common Pitfalls
124+
❌ Pitfall 1: Description
125+
✅ Solution: How to avoid it
126+
127+
## Related Documentation
128+
- Link to related AGENTS.md files
129+
- Link to external docs if needed
130+
```
131+
132+
## Version Control
133+
134+
**YES - AGENTS.md files should be committed to Git.**
135+
136+
These files are part of the codebase documentation and should be version controlled like any other documentation.
137+
138+
### Why Version Control?
139+
140+
1. **Team Consistency**: Everyone has access to the same context
141+
2. **Historical Context**: See how patterns evolved over time
142+
3. **Code Review**: Reviewers can see documentation changes
143+
4. **Synchronization**: Documentation stays in sync with code
144+
5. **Onboarding**: New developers get up-to-date documentation
145+
146+
## Benefits
147+
148+
### For the Team
149+
150+
- **Faster Onboarding**: New developers understand architecture quickly
151+
- **Consistent Patterns**: Everyone follows the same conventions
152+
- **Better Code Reviews**: Reviewers can reference documented patterns
153+
- **Living Documentation**: Stays current with the codebase
154+
155+
### For AI Tools
156+
157+
- **Better Suggestions**: AI tools understand project patterns
158+
- **Fewer Mistakes**: AI follows documented best practices
159+
- **Consistent Style**: AI-generated code matches project style
160+
- **Contextual Help**: AI provides relevant assistance
161+
162+
### For the Project
163+
164+
- **Knowledge Preservation**: Architectural decisions documented
165+
- **Reduced Technical Debt**: Patterns prevent common mistakes
166+
- **Improved Maintainability**: Clear module responsibilities
167+
- **Easier Refactoring**: Understanding dependencies and patterns
168+
169+
## Examples
170+
171+
### Example 1: Adding a New Service
172+
173+
```markdown
174+
Before implementing:
175+
1. Read: /AGENTS.md (project overview)
176+
2. Read: backend/rag_solution/services/AGENTS.md (service patterns)
177+
3. Implement: Follow documented dependency injection pattern
178+
4. Update: Add new service to AGENTS.md if it introduces new patterns
179+
```
180+
181+
### Example 2: Creating a React Component
182+
183+
```markdown
184+
Before implementing:
185+
1. Read: /AGENTS.md (project overview)
186+
2. Read: frontend/AGENTS.md (frontend architecture)
187+
3. Read: frontend/src/components/AGENTS.md (component patterns)
188+
4. Implement: Follow Tailwind CSS and state management patterns
189+
5. Update: Document new pattern if component introduces one
190+
```
191+
192+
## Questions?
193+
194+
If you have questions about the AGENTS.md system:
195+
1. Check the root `/AGENTS.md` file for guidance
196+
2. Look at existing AGENTS.md files for examples
197+
3. Ask the team in Slack/Teams
198+
4. Update this README if you think something is unclear
199+
200+
## Contributing
201+
202+
When contributing to AGENTS.md files:
203+
- ✅ Keep explanations concise and focused
204+
- ✅ Include code examples
205+
- ✅ Document "why" not just "what"
206+
- ✅ Link to related documentation
207+
- ✅ Update when patterns change
208+
- ❌ Don't duplicate docstrings or API docs
209+
- ❌ Don't include implementation details
210+
- ❌ Don't let files become stale
211+
212+
---
213+
214+
**Remember**: AGENTS.md files are living documentation. Keep them updated, and they'll help everyone (humans and AI) work more effectively!

0 commit comments

Comments
 (0)