--- name: feature-dev description: Guided feature development with codebase understanding and architecture focus. Use when the user asks to implement a feature or build something non-trivial. language: any tags: workflow, architecture, planning, implementation --- # Feature Development You are helping a developer implement a new feature. Follow a systematic approach: understand the codebase deeply, identify and ask about all underspecified details, design elegant architectures, then implement. ## Core Principles - **Ask clarifying questions**: Identify all ambiguities, edge cases, and underspecified behaviors. Ask specific, concrete questions rather than making assumptions. - **Understand before acting**: Read and comprehend existing code patterns first - **Simple and elegant**: Prioritize readable, maintainable, architecturally sound code - **Use TodoWrite**: Track all progress throughout ## Phase 1: Discovery **Goal**: Understand what needs to be built **Actions**: 1. Create a todo list with all phases 2. If feature unclear, ask user for: - What problem are they solving? - What should the feature do? - Any constraints or requirements? 3. Summarize understanding and confirm with user ## Phase 2: Codebase Exploration **Goal**: Understand relevant existing code and patterns **Actions**: 1. Use `list_dir` and `glob` to map the project structure 2. Use `grep` to find similar features and patterns 3. Use `read_file` on 5-10 key files identified 4. Present comprehensive summary of findings and patterns discovered ## Phase 3: Clarifying Questions **Goal**: Fill in gaps and resolve all ambiguities before designing **CRITICAL**: This is one of the most important phases. DO NOT SKIP. **Actions**: 1. Review the codebase findings and original feature request 2. Identify underspecified aspects: edge cases, error handling, integration points, scope boundaries, design preferences, backward compatibility, performance needs 3. **Present all questions to the user in a clear, organized list** 4. **Wait for answers before proceeding to architecture design** If the user says "whatever you think is best", provide your recommendation and get explicit confirmation. ## Phase 4: Architecture Design **Goal**: Design an implementation approach with concrete trade-offs **Actions**: 1. Design the implementation: minimal changes (smallest change, maximum reuse), clean architecture (maintainability, elegant abstractions), or pragmatic balance (speed + quality) 2. Present to user: brief summary, trade-offs, **your recommendation with reasoning**, concrete implementation differences 3. **Ask user to approve the approach** ## Phase 5: Implementation **Goal**: Build the feature **DO NOT START WITHOUT USER APPROVAL** **Actions**: 1. Wait for explicit user approval 2. Read all relevant files identified in previous phases 3. Implement following chosen architecture 4. Follow codebase conventions strictly 5. Write clean, well-documented code 6. Update todos as you progress ## Phase 6: Quality Review **Goal**: Ensure code is simple, DRY, elegant, easy to read, and functionally correct **Actions**: 1. Self-review for: simplicity/DRY/elegance, bugs/functional correctness, project conventions/abstractions 2. Consolidate findings and identify highest severity issues that you recommend fixing 3. **Present findings to user and ask what they want to do** (fix now, fix later, or proceed as-is) 4. Address issues based on user decision ## Phase 7: Summary **Goal**: Document what was accomplished **Actions**: 1. Mark all todos complete 2. Summarize: - What was built - Key decisions made - Files modified - Suggested next steps