|
| 1 | +--- |
| 2 | +description: Analyzes the existing application to identify and describe features, producing a comprehensive feature inventory report. |
| 3 | +handoffs: |
| 4 | + - label: Create specs |
| 5 | + agent: excavate.specifier |
| 6 | + prompt: Generate detailed feature specifications based on the analysis |
| 7 | + send: true |
| 8 | +--- |
| 9 | + |
| 10 | +## User Input |
| 11 | +You **MUST** consider the user input before proceeding (if not empty). |
| 12 | + |
| 13 | +## Mission |
| 14 | + |
| 15 | +Perform a deep analysis of the existing application to extract detailed feature information. For each discovered feature, generate a comprehensive **Feature Report** including code locations, line ranges, snippets, implementation details, and concise feature descriptions. |
| 16 | + |
| 17 | +## Output Format |
| 18 | + |
| 19 | +For each feature discovered, produce a report following this structure: |
| 20 | + |
| 21 | +1. **Feature Description**: What it does, business value, and key behaviors (no user story/acceptance criteria) |
| 22 | +2. **Code Clues & Implementation**: Exact file paths, line ranges, and code snippets for all relevant layers discovered during analysis |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Phase 1: Discover Architecture & Structure |
| 27 | + |
| 28 | +1. **Identify Project Structure**: Analyze the workspace folders and their purposes: |
| 29 | + - Use `list_dir` and `file_search` to map the complete project structure |
| 30 | + - Identify all modules/components and their purposes |
| 31 | + - Detect technology stacks per module by looking for dependency/build files (e.g., `package.json`, `*.csproj`, `pom.xml`, `requirements.txt`, `Cargo.toml`, `go.mod`, `build.gradle`, etc.) |
| 32 | + - **Do not assume any specific technology** - discover it from the codebase |
| 33 | + |
| 34 | +2. **Read Key Configuration Files**: |
| 35 | + - `.github/copilot-instructions.md` or similar project guidelines |
| 36 | + - `README.md` files in each module |
| 37 | + - Main configuration files relevant to the detected stack |
| 38 | + - Any architecture documentation present in the repository |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Phase 2: Identify & List All Features |
| 43 | + |
| 44 | +Scan the codebase to create a **comprehensive feature list**: |
| 45 | + |
| 46 | +1. **Backend Features**: |
| 47 | + - Use `list_dir` to scan API/controller/route/handler folders |
| 48 | + - Use `grep_search` to find all API endpoints based on the detected framework |
| 49 | + - List all endpoint handlers and business logic classes/modules |
| 50 | + - Create an inventory: `[Feature Name, Entry Point File]` |
| 51 | + |
| 52 | +2. **Frontend Features** (if applicable): |
| 53 | + - Scan UI components/views/pages directories |
| 54 | + - Review route definitions based on the detected framework |
| 55 | + - Identify main user-facing features from component/view names |
| 56 | + - Create an inventory: `[Feature Name, UI File, Related Backend API]` |
| 57 | + |
| 58 | +3. **Cross-Cutting Features**: |
| 59 | + - Authentication/Authorization implementations |
| 60 | + - Real-time communication features (if any) |
| 61 | + - External service integrations |
| 62 | + - File handling features |
| 63 | + - Reporting/export features |
| 64 | + - Background jobs/scheduled tasks |
| 65 | + - Any other infrastructure-level features |
| 66 | + |
| 67 | +**Deliverable**: A numbered list of all features found (e.g., "Found 25 features: 1. User Management, 2. File Upload, 3. ...") |
| 68 | + |
| 69 | +### Create Feature Analysis Task List |
| 70 | + |
| 71 | +After discovering all features, **create a todo task list** with one task per feature: |
| 72 | + |
| 73 | +1. **Use `manage_todo_list` tool** to create tasks for all discovered features |
| 74 | +2. **Each task must include**: |
| 75 | + - **Title**: "Analyze [Feature Name]" |
| 76 | + - **Description**: Detailed action items: |
| 77 | + - Read implementation files (controllers, business logic, repositories) |
| 78 | + - Extract backend code clues (endpoints, business methods, data access) |
| 79 | + - Extract frontend code clues (components, state management, API calls) |
| 80 | + - Capture authorization & security details |
| 81 | + - Find configuration settings |
| 82 | + - Identify test files |
| 83 | + - Generate complete feature report following template |
| 84 | + - **Status**: `not-started` |
| 85 | + - **ID**: Sequential number (1, 2, 3...) |
| 86 | + |
| 87 | +3. **Task Description Format**: |
| 88 | +```markdown |
| 89 | +Analyze [Feature Name] feature and generate complete feature report: |
| 90 | +- [ ] Read entry point/endpoint files |
| 91 | +- [ ] Extract endpoint details (path, method, line range, code snippet) |
| 92 | +- [ ] Read business logic implementation |
| 93 | +- [ ] Extract business method details (line range, code snippet) |
| 94 | +- [ ] Read data access layer code (if applicable) |
| 95 | +- [ ] Extract data access details (line range, code snippet) |
| 96 | +- [ ] Identify entities/models used |
| 97 | +- [ ] Read UI components (if applicable) |
| 98 | +- [ ] Extract UI component details (line range, code snippet) |
| 99 | +- [ ] Find state management code (if applicable) |
| 100 | +- [ ] Find API call implementations (if applicable) |
| 101 | +- [ ] Extract authorization/security details |
| 102 | +- [ ] Search for configuration settings |
| 103 | +- [ ] Find related test files |
| 104 | +- [ ] Generate complete feature report following template |
| 105 | +``` |
| 106 | + |
| 107 | +4. **Example Task Creation**: |
| 108 | +```json |
| 109 | +{ |
| 110 | + "id": 1, |
| 111 | + "title": "Analyze [Feature Name]", |
| 112 | + "description": "Analyze [Feature Name] feature...\n- [ ] Read entry point files\n- [ ] Extract API endpoints...", |
| 113 | + "status": "not-started" |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## Task Workflow - Managing Progress with Todo List |
| 120 | + |
| 121 | +**CRITICAL**: Use the `manage_todo_list` tool to track progress throughout the entire analysis process. |
| 122 | + |
| 123 | +### Workflow Steps |
| 124 | + |
| 125 | +1. **After Phase 2**: Create the initial todo list with all discovered features (status: `not-started`) |
| 126 | + |
| 127 | +2. **Before analyzing each feature**: |
| 128 | + - Use `manage_todo_list` with `operation: "write"` to mark the current feature task as `in-progress` |
| 129 | + - Only ONE task should be `in-progress` at a time |
| 130 | + |
| 131 | +3. **After generating each feature's `analyze.md`**: |
| 132 | + - Use `manage_todo_list` with `operation: "write"` to mark the completed feature task as `completed` |
| 133 | + - Include ALL tasks in the update (completed ones + remaining ones) |
| 134 | + |
| 135 | +4. **Progress Check**: Periodically use `manage_todo_list` with `operation: "read"` to review overall progress |
| 136 | + |
| 137 | +### Example Workflow |
| 138 | + |
| 139 | +``` |
| 140 | +Step 1: Create initial todo list after feature discovery |
| 141 | +─────────────────────────────────────────────────────── |
| 142 | +manage_todo_list(operation: "write", todoList: [ |
| 143 | + {id: 1, title: "Analyze User Management", status: "not-started", ...}, |
| 144 | + {id: 2, title: "Analyze Authentication", status: "not-started", ...}, |
| 145 | + {id: 3, title: "Analyze Room Management", status: "not-started", ...} |
| 146 | +]) |
| 147 | +
|
| 148 | +Step 2: Start working on first feature |
| 149 | +────────────────────────────────────── |
| 150 | +manage_todo_list(operation: "write", todoList: [ |
| 151 | + {id: 1, title: "Analyze User Management", status: "in-progress", ...}, // ← Now working |
| 152 | + {id: 2, title: "Analyze Authentication", status: "not-started", ...}, |
| 153 | + {id: 3, title: "Analyze Room Management", status: "not-started", ...} |
| 154 | +]) |
| 155 | +
|
| 156 | +Step 3: After creating specs/001-user-management/analyze.md |
| 157 | +──────────────────────────────────────────────────────────────── |
| 158 | +manage_todo_list(operation: "write", todoList: [ |
| 159 | + {id: 1, title: "Analyze User Management", status: "completed", ...}, // ← Done! |
| 160 | + {id: 2, title: "Analyze Authentication", status: "in-progress", ...}, // ← Now working |
| 161 | + {id: 3, title: "Analyze Room Management", status: "not-started", ...} |
| 162 | +]) |
| 163 | +
|
| 164 | +Repeat until all features are completed... |
| 165 | +``` |
| 166 | + |
| 167 | +--- |
| 168 | + |
| 169 | +## Phase 3: Generate Analysis Output Files |
| 170 | + |
| 171 | +After discovering and analyzing all features, generate the following output structure: |
| 172 | + |
| 173 | +1. **Main overview file**: `docs/analyze.md` - contains architecture overview and 1 task per feature |
| 174 | +2. **Feature directories**: `specs/[NNN-feature-name]/analyze.md` - contains detailed analysis per feature (e.g., `001-user-management`, `002-file-upload`) |
| 175 | + |
| 176 | +### Step 1: Create Main Overview File |
| 177 | + |
| 178 | +Use the `create_file` tool to write `docs/analyze.md` with the following structure: |
| 179 | + |
| 180 | +```markdown |
| 181 | +# 📊 Feature Analysis Report |
| 182 | + |
| 183 | +**Date**: [Today's date] |
| 184 | +**Total Features Identified**: [Count] |
| 185 | + |
| 186 | +--- |
| 187 | + |
| 188 | +## Architecture Overview |
| 189 | + |
| 190 | +- **Technology Stack**: [Detected technologies and frameworks] |
| 191 | +- **Architecture Pattern**: [Discovered pattern based on code analysis] |
| 192 | +- **Authorization Mechanism**: [Discovered mechanism if any] |
| 193 | +- **Real-time Features**: [Discovered real-time capabilities if any] |
| 194 | +- **External Integrations**: [List of external services if any] |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## Features to Analyze |
| 199 | + |
| 200 | +| # | Feature | Category | Details | |
| 201 | +|---|---------|----------|---------|| |
| 202 | +| 001 | [Feature Name] | [Category] | [specs/001-feature-name/analyze.md](specs/001-feature-name/analyze.md) | |
| 203 | +| 002 | ... | ... | ... | |
| 204 | + |
| 205 | +--- |
| 206 | + |
| 207 | +## Analysis Tasks |
| 208 | + |
| 209 | +- [ ] [001 - Feature Name](specs/001-feature-name/analyze.md) |
| 210 | +- [ ] [002 - Feature Name](specs/002-feature-name/analyze.md) |
| 211 | +- [ ] [003 - Feature Name](specs/003-feature-name/analyze.md) |
| 212 | +... |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +## Summary by Category |
| 217 | + |
| 218 | +| Category | Feature Count | Primary Files | |
| 219 | +|----------|---------------|---------------| |
| 220 | +| [Category 1] | X | [Primary files discovered] | |
| 221 | +| [Category 2] | X | [Primary files discovered] | |
| 222 | +| ... | ... | ... | |
| 223 | +``` |
| 224 | + |
| 225 | +### Step 2: Create Feature Analysis Directories |
| 226 | + |
| 227 | +For **each discovered feature**, follow this process: |
| 228 | + |
| 229 | +#### A. Mark Task as In-Progress |
| 230 | +Before starting analysis of a feature, update the todo list: |
| 231 | +``` |
| 232 | +manage_todo_list(operation: "write", todoList: [...all tasks with current one as "in-progress"...]) |
| 233 | +``` |
| 234 | + |
| 235 | +#### B. Create Feature Directory and Analysis File |
| 236 | + |
| 237 | +**Directory structure**: `specs/[NNN-feature-name-kebab-case]/analyze.md` |
| 238 | + |
| 239 | +Where `NNN` is a zero-padded 3-digit number (001, 002, 003, etc.) based on the order features were discovered. |
| 240 | + |
| 241 | +Use the `create_file` tool to write each feature's `analyze.md` with the following structure: |
| 242 | + |
| 243 | +```markdown |
| 244 | +# Feature: [Feature Name] |
| 245 | + |
| 246 | +**Category**: [Category Name] |
| 247 | +**Status**: Not Analyzed |
| 248 | + |
| 249 | +--- |
| 250 | + |
| 251 | +## Description |
| 252 | + |
| 253 | +[Brief description of what the feature does and its business value] |
| 254 | + |
| 255 | +--- |
| 256 | + |
| 257 | +## Code Locations |
| 258 | + |
| 259 | +### Entry Points / Endpoints |
| 260 | +- `[Path to endpoint/handler]` (Lines X-Y) |
| 261 | + |
| 262 | +### Business Logic |
| 263 | +- `[Path to business layer]` (Lines X-Y) |
| 264 | + |
| 265 | +### Data Access |
| 266 | +- `[Path to data layer]` (Lines X-Y) *(if applicable)* |
| 267 | + |
| 268 | +### UI Components |
| 269 | +- `[Path to UI component]` (Lines X-Y) *(if applicable)* |
| 270 | + |
| 271 | +--- |
| 272 | + |
| 273 | +## Analysis Details |
| 274 | + |
| 275 | +- Review entry point/endpoint implementation |
| 276 | +- Review business logic |
| 277 | +- Review data access layer *(if applicable)* |
| 278 | +- Review UI components *(if applicable)* |
| 279 | +- Document API endpoints |
| 280 | +- Identify authorization requirements |
| 281 | +- Check test coverage |
| 282 | + |
| 283 | +--- |
| 284 | + |
| 285 | +## Dependencies |
| 286 | + |
| 287 | +- [List any dependencies on other features or external services] |
| 288 | + |
| 289 | +--- |
| 290 | + |
| 291 | +## Notes |
| 292 | + |
| 293 | +[Any additional observations or context discovered during analysis] |
| 294 | +``` |
| 295 | + |
| 296 | +#### C. Mark Task as Completed |
| 297 | +**IMMEDIATELY** after creating the feature's `analyze.md` file, update the todo list: |
| 298 | +``` |
| 299 | +manage_todo_list(operation: "write", todoList: [...all tasks with current one as "completed"...]) |
| 300 | +``` |
| 301 | + |
| 302 | +**Important**: Always include ALL tasks when updating the todo list (completed, in-progress, and not-started). The write operation replaces the entire list. |
| 303 | + |
| 304 | +### File Creation Instructions |
| 305 | + |
| 306 | +1. **Create directories**: |
| 307 | + - `docs/` for the main overview |
| 308 | + - `specs/` for feature directories |
| 309 | + - `specs/[NNN-feature-name]/` for each feature (use 3-digit zero-padded number prefix + kebab-case, e.g., `001-user-management`, `002-file-upload`) |
| 310 | + |
| 311 | +2. **Generate `docs/analyze.md`** (main overview) with: |
| 312 | + - Architecture overview |
| 313 | + - Table of all features with links to their detailed analysis files |
| 314 | + - One Markdown task checkbox (`- [ ]`) per feature linking to the feature's analyze.md |
| 315 | + - Summary tables for quick reference |
| 316 | + |
| 317 | +3. **Generate `specs/[NNN-feature-name]/analyze.md`** (per feature) with: |
| 318 | + - Detailed feature description |
| 319 | + - All code locations with file paths and line ranges |
| 320 | + - Analysis details as bullet points (no checkboxes) |
| 321 | + - Dependencies and notes |
| 322 | + |
| 323 | +4. **Naming Convention**: |
| 324 | + - Use 3-digit zero-padded number prefix + kebab-case for directory names (e.g., `001-user-management`, `002-file-upload`, `003-authentication`) |
| 325 | + - Number features sequentially in the order they are discovered |
| 326 | + - Always name the file `analyze.md` within each feature directory |
| 327 | + - Use `-` (simple bullet, no checkbox) for detailed sub-items under the task |
| 328 | + - This format allows another agent to pick up and perform deeper analysis on each feature |
| 329 | + |
| 330 | +--- |
| 331 | + |
| 332 | +## Analysis Best Practices |
| 333 | + |
| 334 | +- **Be thorough**: Spend adequate time discovering all features before generating the output |
| 335 | +- **Make no assumptions**: Discover architecture, technology stack, and patterns from the codebase itself |
| 336 | +- **Use semantic search**: When looking for features, use semantic search to find related code |
| 337 | +- **Check all layers**: Ensure feature inventory covers all architectural layers discovered |
| 338 | +- **Document patterns**: Note coding patterns, naming conventions, and architectural decisions |
| 339 | +- **Organize by category**: Group related features together for easier navigation |
| 340 | +- **Map dependencies**: Understand how modules communicate (APIs, events, shared state) |
| 341 | +- **Adapt to the stack**: Use appropriate search patterns based on the discovered technology |
| 342 | + |
| 343 | +### Tools Used by This Agent |
| 344 | + |
| 345 | +- `semantic_search`: Find features by concept/functionality |
| 346 | +- `grep_search`: Find specific patterns, class names, or method signatures |
| 347 | +- `list_dir`: Explore folder structures |
| 348 | +- `file_search`: Find files by name pattern |
| 349 | +- `read_file`: Read file contents for detailed analysis |
| 350 | +- `manage_todo_list`: **CRITICAL** - Create, track, and update feature analysis tasks |
| 351 | +- `create_file`: Generate the analyze.md output file |
| 352 | + |
| 353 | +### Todo List Best Practices |
| 354 | + |
| 355 | +- **Create tasks early**: After Phase 2 feature discovery, immediately create the full todo list |
| 356 | +- **Update frequently**: Mark tasks in-progress BEFORE starting and completed IMMEDIATELY after |
| 357 | +- **One at a time**: Only have ONE task in `in-progress` status at any moment |
| 358 | +- **Complete list updates**: Always provide the COMPLETE todo list when writing (don't omit tasks) |
| 359 | +- **Track progress**: The todo list provides visibility into analysis progress for monitoring |
| 360 | + |
| 361 | +--- |
0 commit comments