Purpose: Ensure consistent, organized, and up-to-date documentation across the project.
Audience: AI coding agents (GitHub Copilot, Claude, etc.) and human developers.
This document defines standards for creating and maintaining documentation. AI agents should reference this when creating new feature docs, bug fix notes, or updating existing documentation.
| Folder | Purpose | When to Update |
|---|---|---|
docs/ (root) |
High-level overviews, changelog | Major releases, stakeholder docs |
docs/development/ |
Technical guides for contributors | Architecture changes, new patterns |
docs/features/ |
Feature-specific documentation | New features, feature changes |
docs/deployment/ |
Production setup and operations | Infrastructure changes |
docs/planning/ |
Future development specs | Planning phases only |
This section provides templates for documenting new features and bug fixes.
# [Feature Name]
## ๐ Overview
Brief description of what this feature does and why it was needed.
## ๐ฏ Implementation Details
- **Models affected:** List any new or modified models
- **Controllers:** List affected controllers and new endpoints
- **Views:** Describe UI changes and new templates
- **Database changes:** List migrations and new tables/columns
## ๐ง Configuration
- **Environment variables:** List any new config requirements
- **Dependencies:** Note new gems or external services
- **Setup steps:** Any additional setup required
## ๐ Usage
Step-by-step guide on how to use the feature.
## ๐งช Testing
- **Test files:** Location of test files
- **Test data:** Any special test data requirements
- **Manual testing:** Steps to manually verify the feature
## ๐ Troubleshooting
Common issues and their solutions.
## ๐ Related Documentation
Links to related docs and external resources.
# [Feature Name]
## ๐ Overview
[Description]
## ๐๏ธ Database Changes
### New Tables
- `table_name`: Description of purpose
- `column_name`: Description and data type
### Modified Tables
- `existing_table`: Changes made
- Added: `new_column`
- Modified: `existing_column`
### New Associations
- `ModelA belongs_to :model_b`
- `ModelB has_many :model_as`
## ๐ Model Relationships
Update `docs/development/MODEL_RELATIONSHIPS.md` with:
- New association definitions
- Join patterns for queries
- Common query examples
## [Continue with other sections...]
# Bug Fix: [Brief Description]
## ๐จ Issue Description
- **Error message:** `Exact error text`
- **Symptoms:** What the user experienced
- **Affected areas:** What parts of the app were broken
## ๐ Root Cause
Technical explanation of what caused the bug.
## โ
Solution
- **Changes made:** List of files modified
- **Code changes:** Key code snippets showing the fix
- **Reasoning:** Why this approach was chosen
## ๐งช Verification
- **Test cases:** How to verify the fix works
- **Edge cases:** Additional scenarios tested
- **Regression prevention:** How to avoid this bug in the future
## ๐ Documentation Updates
- **Debugging guides:** What was added to help future debugging
- **Model relationships:** Any association corrections documented
- **Best practices:** New guidelines to prevent similar issues
# Bug Fix: ActiveRecord Association Error
## ๐จ Issue Description
- **Error:** `ActiveRecord::ConfigurationError: Can't join 'Model' to association named 'wrong_name'`
- **Location:** Controller/model where error occurred
- **Impact:** What functionality was broken
## ๐ Root Cause Analysis
### Incorrect Association Name
```ruby
# โ Wrong
Model.joins(:wrong_association_name)
# โ
Correct
Model.joins(:correct_association_name)
# โ Wrong - skips intermediate model
Model.joins(parent: :grandparent)
# โ
Correct - includes full chain
Model.joins(parent: { child: :grandparent })
app/controllers/example_controller.rb:alumnus to :alumnidocs/development/MODEL_RELATIONSHIPS.md:
docs/development/AGENTS.md# Verify association works in Rails console
Model.joins(:correct_association).count
MODEL_RELATIONSHIPS.md before writing joinsUse this checklist for every feature or bug fix:
docs/features/docs/development/MODEL_RELATIONSHIPS.md if models changeddocs/README.md with links to new docsUsage: Copy the appropriate template above when documenting new work, then customize for your specific feature or bug fix.