Feature Development Workflow
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. Wait for user answers before proceeding.
- Understand before acting: Read and comprehend existing code patterns first
- Library-First: Search for existing solutions before implementing custom code
- 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:
- Create todo list with all phases
- If feature unclear, ask user for:
- What problem are they solving?
- What should the feature do?
- Any constraints or requirements?
- Summarize understanding and confirm with user
Phase 2: Codebase Exploration
Goal: Understand relevant existing code and patterns
Actions:
-
Launch 2-3
code-exploreragents in parallel. Each agent should:- Trace through the code comprehensively
- Focus on different aspects (similar features, architecture, user experience)
- Return a list of 5-10 key files to read
Example agent prompts:
- "Find features similar to [feature] and trace their implementation"
- "Map the architecture and abstractions for [feature area]"
- "Analyze the current implementation of [existing feature/area]"
-
Read all files identified by agents to build deep understanding
-
Present comprehensive summary of findings and patterns discovered
Phase 3: Clarifying Questions ⚠️ CRITICAL
Goal: Fill in gaps and resolve ALL ambiguities before designing
DO NOT SKIP THIS PHASE
Actions:
- Review the codebase findings and original feature request
- Identify underspecified aspects:
- Edge cases
- Error handling
- Integration points
- Scope boundaries
- Design preferences
- Backward compatibility
- Performance requirements
- Present all questions to the user in a clear, organized list
- Wait for answers before proceeding
If user says "whatever you think is best", provide your recommendation and get explicit confirmation.
Phase 4: Architecture Design
Goal: Design implementation approach
Actions:
-
Launch 2-3
code-architectagents with different focuses:- Minimal: Smallest change, maximum reuse
- Clean: Maintainability, elegant abstractions
- Pragmatic: Speed + quality balance
-
Review approaches and form your recommendation considering:
- Is this a small fix or large feature?
- Urgency and complexity
- Team context and codebase conventions
-
Present to user:
- Brief summary of each approach
- Trade-offs comparison
- Your recommendation with reasoning
-
Ask user which approach they prefer
Phase 5: Implementation
Goal: Build the feature
⛔ DO NOT START WITHOUT USER APPROVAL
Actions:
-
Wait for explicit user approval
-
Search for existing libraries before custom implementation:
| Need | ❌ Don't Build | ✅ Use Library | |------|---------------|----------------| | Retry logic | Custom |
tenacity,resilience4j| | Validation | If statements |pydantic,zod| | Date handling | Manual |pendulum,date-fns| | HTTP | Raw requests |httpx,axios| -
Read all relevant files identified in previous phases
-
Implement following chosen architecture
-
Follow codebase conventions strictly
-
Write clean, well-documented code
-
Update todos as you progress
Phase 6: Quality Review
Goal: Ensure code quality
Actions:
-
Launch 3
code-revieweragents with different focuses:- Simplicity: DRY, elegance, readability
- Correctness: Bugs, functional issues
- Conventions: Project patterns, abstractions
-
Consolidate findings and identify highest severity issues
-
Present findings to user and ask what they want to do:
- Fix now
- Fix later
- Proceed as-is
-
Address issues based on user decision
Phase 7: Documentation & Summary ⚠️ MANDATORY
Goal: Create documentation file and summarize accomplishments
DO NOT SKIP THIS PHASE
Actions:
- Mark all todos complete
- Create documentation file at
docs/plans/YYYY-MM-DD-<feature>-summary.md:# <Feature Name> ## 개요 - **날짜**: YYYY-MM-DD - **요청**: [원래 요청 내용] ## 변경 사항 - [변경된 파일 목록과 변경 내용] ## 구현 세부사항 [기술적 세부사항, 알고리즘, 설계 결정 등] ## 사용법 [해당되는 경우] ## 관련 이슈 [해당되는 경우] ## 향후 개선 사항 [알려진 제한사항, 추후 개선점] - Summarize to user:
- What was built
- Key decisions made
- Files modified/created
- Documentation file path
- Suggested next steps
- Known limitations or future improvements
Anti-Patterns to Avoid
- NIH (Not Invented Here): Rebuilding what already exists
- Premature Optimization: Unnecessary optimization
- Over-Engineering: Excessive abstraction for simple tasks
- Skipping Questions: Making assumptions instead of asking
Karpathy Guidelines (구현 원칙)
1. 코딩 전에 생각하라
- 가정을 명시적으로 밝혀라
- 여러 해석이 가능하면 선택지를 제시하라
- 더 단순한 방법이 있으면 말하라
- 불명확하면 멈추고 질문하라
2. 단순함을 우선하라
- 요청받은 기능만 구현
- "나중에 필요할 수도" → 지금 구현 금지
- 한 번만 쓸 코드에 추상화 금지
- 요청 없으면 하드코딩
3. 코드량 자가 점검
작성 후 질문:
"이 200줄을 50줄로 줄일 수 있는가?"
"시니어 개발자가 보면 과하다고 할 것인가?"
→ Yes면 다시 작성
4. 외과적 변경 (기존 코드 수정 시)
- 변경 범위를 요청 사항에 한정
- 기존 스타일/컨벤션 따르기
- 내 변경으로 생긴 미사용 코드만 정리
- 발견한 기존 문제는 언급만, 수정 금지
5. 검증 가능한 목표 설정
| 모호한 요청 | 검증 가능한 목표 | |------------|------------------| | "유효성 검사 추가" | "잘못된 입력 테스트 작성 → 통과" | | "버그 수정" | "재현 테스트 작성 → 통과" | | "리팩토링" | "기존 테스트 통과 유지" | | "성능 개선" | "벤치마크 X% 향상 확인" |
Quick Reference
Phase 1: Discovery → What are we building?
Phase 2: Exploration → How does existing code work?
Phase 3: Questions → What's unclear? (DON'T SKIP!)
Phase 4: Architecture → How should we build it?
Phase 5: Implementation → Build it (after approval)
Phase 6: Review → Is it good?
Phase 7: Documentation → Write docs/plans/YYYY-MM-DD-<feature>-summary.md (DON'T SKIP!)