alumni_lookup

Documentation Standards & Templates

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.


Documentation Principles

  1. Single Source of Truth โ€” Each concept should be documented in ONE place
  2. Keep Current โ€” Update docs during development, not after
  3. Cross-Reference โ€” Link related docs rather than duplicating content
  4. Actionable โ€” Include code examples and step-by-step instructions

Documentation Structure

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

Templates for New Documentation

This section provides templates for documenting new features and bug fixes.

๐Ÿ†• New Feature Documentation Template

Basic Feature Template

# [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.

Complex Feature Template (with Model Changes)

# [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 Documentation Template

Basic Bug Fix Template

# 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

ActiveRecord Association Bug Fix Template

# 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)

Missing Association Chain

# โŒ Wrong - skips intermediate model
Model.joins(parent: :grandparent)

# โœ… Correct - includes full chain
Model.joins(parent: { child: :grandparent })

โœ… Solution Applied

๐Ÿ“š Documentation Updates

๐Ÿงช Testing

# Verify association works in Rails console
Model.joins(:correct_association).count

๐Ÿ”’ Prevention

๐Ÿ“‹ Documentation Checklist

Use this checklist for every feature or bug fix:

โœ… Feature Development Checklist

โœ… Bug Fix Checklist

โœ… General Documentation Standards


Usage: Copy the appropriate template above when documenting new work, then customize for your specific feature or bug fix.