Guide for creating and maintaining docs in this directory.
These docs are primarily for AI coding agents, secondarily for humans. They should:
- Explain patterns that aren't obvious from reading the code
- Guide AI agents away from common mistakes (old patterns, anti-patterns)
- Be "evergreen" - updated as the app evolves
They should not teach libraries (AI knows Zustand, React Query, etc.) or duplicate code.
| Situation | Action |
|---|---|
| New architectural pattern or system | Create new doc |
| Enhancement to existing system | Update existing doc |
| One-off implementation detail | Don't document - it's in the code |
New docs should be added to README.md in this directory.
- The "why" behind non-obvious decisions
- "How to add X" sections for patterns not obvious from code
- Common mistakes (especially from outdated AI training data)
- Cross-links to related docs:
See [state-management.md](./state-management.md)
- Implementation details that don't affect usage
- Library tutorials
- Checklists (AI generates these compulsively - resist)
- "Future Enhancements" or speculative sections
- Large code blocks duplicating the codebase
Keep examples minimal. Use ✅/❌ format:
// ❌ BAD: Subscribes to entire store
const { visible } = useUIStore()
// ✅ GOOD: Selector for specific value
const visible = useUIStore(state => state.visible)Reference actual files when helpful: "See src/lib/menu.ts for the full implementation."
| Element | Use For |
|---|---|
| Tables | Comparing options, quick reference |
| ✅/❌ examples | Correct vs incorrect patterns |
inline code |
File paths, commands, function names |
| Headings | Scannable structure |
Keep prose brief. Get to the point.
Not the primary goal, but good practice:
- Tables over prose for comparisons
- Don't explain what AI already knows
- Link to other docs instead of repeating content
- Never sacrifice clarity for brevity
Update docs when you change the pattern they describe. If you're unsure whether a doc needs updating after code changes, read it - you'll know.