|
| 1 | +# Document Feature |
| 2 | + |
| 3 | +Generate concise markdown documentation for implemented features by analyzing code changes and specifications. This command creates documentation in the `agentic/context/` directory based on git diff analysis against the main branch and the original feature specification. |
| 4 | + |
| 5 | +## Variables |
| 6 | + |
| 7 | +run_id: $1 |
| 8 | +spec_path: $2 if provided, otherwise leave it blank |
| 9 | +documentation_screenshots_dir: $3 if provided, otherwise leave it blank |
| 10 | + |
| 11 | +## Instructions |
| 12 | + |
| 13 | +### 1. Analyze Changes |
| 14 | +- Run `git diff origin/main --stat` to see files changed and lines modified |
| 15 | +- Run `git diff origin/main --name-only` to get the list of changed files |
| 16 | +- For significant changes (>50 lines), run `git diff origin/main <file>` on specific files to understand the implementation details |
| 17 | + |
| 18 | +### 2. Read Specification (if provided) |
| 19 | +- If `spec_path` is provided, read the specification file to understand: |
| 20 | + - Original requirements and goals |
| 21 | + - Expected functionality |
| 22 | + - Success criteria |
| 23 | +- Use this to frame the documentation around what was requested vs what was built |
| 24 | + |
| 25 | +### 3. Analyze and Copy Screenshots (if provided) |
| 26 | +- If `documentation_screenshots_dir` is provided, list and examine screenshots |
| 27 | +- Create `agentic/context/assets/` directory if it doesn't exist |
| 28 | +- Copy all screenshot files (*.png) from `documentation_screenshots_dir` to `agentic/context/assets/` |
| 29 | + - Preserve original filenames |
| 30 | + - Use `cp` command to copy files |
| 31 | +- Use visual context to better describe UI changes or visual features |
| 32 | +- Reference screenshots in documentation using relative paths (e.g., `assets/screenshot-name.png`) |
| 33 | + |
| 34 | +### 4. Generate Documentation |
| 35 | +- Create a new documentation file in `agentic/context/` directory |
| 36 | +- Filename format: Match the spec filename (e.g., if spec is `feature-abc123-add-auth.md`, create `feature-abc123-add-auth.md`) |
| 37 | + - If no spec_path provided, use: `feature-{run_id}-{descriptive-name}.md` |
| 38 | +- Follow the Documentation Format below |
| 39 | +- Focus on: |
| 40 | + - What was built (based on git diff) |
| 41 | + - How it works (technical implementation) |
| 42 | + - How to use it (user perspective) |
| 43 | + - Any configuration or setup required |
| 44 | + |
| 45 | +### 5. Update Context Documentation |
| 46 | +- After creating the documentation file, read `agentic/commands/context.md` |
| 47 | +- Add an entry for the new documentation file with appropriate conditions |
| 48 | +- The entry should help future developers know when to read this documentation |
| 49 | +- Format the entry following the existing pattern in the file |
| 50 | + |
| 51 | +### 6. Final Output |
| 52 | +- When you finish writing the documentation and updating context.md, return exclusively the path to the documentation file created and nothing else |
| 53 | + |
| 54 | +## Codebase Structure |
| 55 | + |
| 56 | +- `README.md` - Project overview (start here) |
| 57 | +- `api/` - FastAPI backend |
| 58 | + - `main.py` - App entry point |
| 59 | + - `routers/` - API route handlers |
| 60 | + - `services/` - Business logic |
| 61 | +- `app/` - React frontend (Vite + TypeScript) |
| 62 | + - `src/` - Source code |
| 63 | +- `core/` - Shared Python modules |
| 64 | + - `models/` - Pydantic models |
| 65 | + - `database/` - Database utilities |
| 66 | +- `plots/` - Plot specifications and implementations |
| 67 | +- `tests/` - Test suites |
| 68 | +- `agentic/` - Agentic Layer |
| 69 | + - `commands/` - Prompt templates |
| 70 | + - `workflows/` - Workflow scripts (`uv run`) |
| 71 | + - `specs/` - Plans (what to do) |
| 72 | + - `context/` - Feature docs (what was done) |
| 73 | + - `docs/` - Static project documentation |
| 74 | + |
| 75 | +## Documentation Format |
| 76 | + |
| 77 | +```md |
| 78 | +# <Feature Title> |
| 79 | + |
| 80 | +**Run ID:** <run_id> |
| 81 | +**Date:** <current date> |
| 82 | +**Specification:** <spec_path or "N/A"> |
| 83 | + |
| 84 | +## Overview |
| 85 | + |
| 86 | +<2-3 sentence summary of what was built and why> |
| 87 | + |
| 88 | +## Screenshots |
| 89 | + |
| 90 | +<If documentation_screenshots_dir was provided and screenshots were copied> |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +## What Was Built |
| 95 | + |
| 96 | +<List the main components/features implemented based on the git diff analysis> |
| 97 | + |
| 98 | +- <Component/feature 1> |
| 99 | +- <Component/feature 2> |
| 100 | +- <etc> |
| 101 | + |
| 102 | +## Technical Implementation |
| 103 | + |
| 104 | +### Files Modified |
| 105 | + |
| 106 | +<List key files changed with brief description of changes> |
| 107 | + |
| 108 | +- `<file_path>`: <what was changed/added> |
| 109 | +- `<file_path>`: <what was changed/added> |
| 110 | + |
| 111 | +### Key Changes |
| 112 | + |
| 113 | +<Describe the most important technical changes in 3-5 bullet points> |
| 114 | + |
| 115 | +## How to Use |
| 116 | + |
| 117 | +<Step-by-step instructions for using the new feature> |
| 118 | + |
| 119 | +1. <Step 1> |
| 120 | +2. <Step 2> |
| 121 | +3. <etc> |
| 122 | + |
| 123 | +## Configuration |
| 124 | + |
| 125 | +<Any configuration options, environment variables, or settings> |
| 126 | + |
| 127 | +## Testing |
| 128 | + |
| 129 | +<Brief description of how to test the feature> |
| 130 | + |
| 131 | +## Notes |
| 132 | + |
| 133 | +<Any additional context, limitations, or future considerations> |
| 134 | +``` |
| 135 | + |
| 136 | +## Context Entry Format |
| 137 | + |
| 138 | +After creating the documentation, add this entry to `agentic/commands/context.md`: |
| 139 | + |
| 140 | +```md |
| 141 | +- agentic/context/<your_documentation_file>.md |
| 142 | + - Conditions: |
| 143 | + - When working with <feature area> |
| 144 | + - When implementing <related functionality> |
| 145 | + - When troubleshooting <specific issues> |
| 146 | +``` |
| 147 | + |
| 148 | +## Report |
| 149 | + |
| 150 | +- IMPORTANT: Return exclusively the path to the documentation file created and nothing else. |
0 commit comments