feature-dev

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Feature Development Workflow

功能开发工作流

A comprehensive, structured workflow for feature development with specialized agents for codebase exploration, architecture design, and quality review.
这是一套全面、结构化的功能开发工作流,借助专用Agent完成代码库探索、架构设计和质量评审工作。

Quick Start

快速开始

Launch the guided feature development workflow:
bash
/feature-dev Add user authentication with OAuth
Or interactively:
bash
/feature-dev
The workflow will guide you through 7 distinct phases automatically.
启动引导式功能开发工作流:
bash
/feature-dev Add user authentication with OAuth
或交互式启动:
bash
/feature-dev
工作流将自动引导你完成7个不同阶段。

Overview

概述

Building features requires more than just writing code. This skill provides a systematic approach that:
  • Understands the codebase before making changes
  • Asks clarifying questions to resolve ambiguities
  • Designs thoughtfully with multiple architecture options
  • Reviews for quality after implementation
开发功能不仅仅是编写代码。本Skill提供一套系统化方法,能够:
  • 在修改前理解代码库
  • 提出澄清问题以解决模糊点
  • 审慎设计并提供多种架构方案
  • 在实现后进行质量评审

The 7-Phase Workflow

7阶段工作流

Phase 1: Discovery

阶段1:需求探索

Goal: Understand what needs to be built
  • Clarifies unclear feature requests
  • Identifies problem, constraints, and requirements
  • Summarizes understanding and confirms with user
Example:
User: /feature-dev Add caching
Agent: Let me understand what you need...
       - What should be cached? (API responses, computed values, etc.)
       - What are your performance requirements?
       - Do you have a preferred caching solution?
目标:明确需要开发的内容
  • 澄清模糊的功能需求
  • 识别问题、约束条件和需求
  • 总结理解内容并与用户确认
示例:
用户: /feature-dev Add caching
Agent: 让我先了解你的需求...
       - 需要缓存什么内容?(API响应、计算值等)
       - 你的性能要求是什么?
       - 你有偏好的缓存解决方案吗?

Phase 2: Codebase Exploration

阶段2:代码库探索

Goal: Understand relevant existing code and patterns
  • Launches 2-3
    code-explorer
    agents in parallel
  • Explores similar features, architecture, UI patterns
  • Reads all identified files for deep understanding
  • Presents comprehensive summary of findings
Agents launched:
  • "Find features similar to [feature] and trace implementation"
  • "Map the architecture and abstractions for [area]"
  • "Analyze current implementation of [related feature]"
Example output:
Found similar features:
- User authentication (src/auth/): Uses JWT tokens, middleware pattern
- Session management (src/session/): Redis-backed, 24hr expiry

Key files:
- src/auth/AuthService.ts:45 - Core authentication logic
- src/middleware/authMiddleware.ts:12 - Request authentication
目标:理解相关现有代码和模式
  • 并行启动2-3个
    code-explorer
    Agent
  • 探索类似功能、架构、UI模式
  • 读取所有识别到的文件以深入理解
  • 呈现全面的发现总结
启动的Agent:
  • "查找与[feature]类似的功能并追踪实现逻辑"
  • "绘制[领域]的架构和抽象关系图"
  • "分析[相关功能]的当前实现"
示例输出:
找到类似功能:
- 用户认证(src/auth/):使用JWT令牌、中间件模式
- 会话管理(src/session/):基于Redis、24小时过期

关键文件:
- src/auth/AuthService.ts:45 - 核心认证逻辑
- src/middleware/authMiddleware.ts:12 - 请求认证

Phase 3: Clarifying Questions

阶段3:澄清问题

Goal: Fill in gaps and resolve all ambiguities
  • Reviews codebase findings and feature request
  • Identifies underspecified aspects (edge cases, error handling, integration points)
  • Presents organized list of questions
  • Waits for answers before proceeding
Example:
Before designing, I need to clarify:

1. OAuth provider: Which providers? (Google, GitHub, custom?)
2. User data: Store OAuth tokens or just profile?
3. Existing auth: Replace or add alongside current auth?
4. Sessions: Integrate with existing session management?
5. Error handling: How to handle OAuth failures?
Critical: Ensures nothing is ambiguous before design begins.
目标:填补信息空白,解决所有模糊点
  • 回顾代码库发现和功能需求
  • 识别未明确的方面(边缘情况、错误处理、集成点)
  • 呈现结构化的问题列表
  • 等待回答后再继续
示例:
在开始设计前,我需要澄清以下问题:

1. OAuth提供商:选择哪些提供商?(Google、GitHub还是自定义?)
2. 用户数据:存储OAuth令牌还是仅存储用户资料?
3. 现有认证:替换还是新增到现有认证体系中?
4. 会话:是否与现有会话管理集成?
5. 错误处理:如何处理OAuth失败情况?
关键提示:确保设计开始前没有任何模糊点。

Phase 4: Architecture Design

阶段4:架构设计

Goal: Design multiple implementation approaches
  • Launches 2-3
    code-architect
    agents with different focuses:
    • Minimal changes: Smallest change, maximum reuse
    • Clean architecture: Maintainability, elegant abstractions
    • Pragmatic balance: Speed + quality
  • Presents comparison with trade-offs and recommendation
  • Asks which approach to use
Example output:
Approach 1: Minimal Changes
- Extend existing AuthService with OAuth methods
Pros: Fast, low risk
Cons: Couples OAuth to existing auth

Approach 2: Clean Architecture
- New OAuthService with dedicated interface
Pros: Clean separation, testable
Cons: More files, more refactoring

Approach 3: Pragmatic Balance
- New OAuthProvider abstraction
Pros: Balanced complexity and cleanliness
Cons: Some coupling remains

Recommendation: Approach 3 - clean boundaries without excessive refactoring
目标:设计多种实现方案
  • 启动2-3个不同侧重点的
    code-architect
    Agent:
    • 最小改动:改动量最小,复用最大化
    • 整洁架构:可维护性、优雅的抽象设计
    • 务实平衡:开发速度 + 代码质量
  • 呈现方案对比、权衡点及推荐方案
  • 询问使用哪种方案
示例输出:
方案1:最小改动
- 扩展现有AuthService,添加OAuth方法
优点:开发快、风险低
缺点:将OAuth与现有认证耦合

方案2:整洁架构
- 新建带独立接口的OAuthService
优点:清晰解耦、可测试
缺点:新增文件多、重构量大

方案3:务实平衡
- 新建OAuthProvider抽象层
优点:复杂度与整洁度平衡
缺点:仍存在部分耦合

推荐方案:方案3 - 在不过度重构的前提下保证清晰边界

Phase 5: Implementation

阶段5:功能实现

Goal: Build the feature
  • Waits for explicit approval before starting
  • Reads all relevant files from previous phases
  • Implements following chosen architecture
  • Follows codebase conventions strictly
  • Updates todos to track progress
目标:开发功能
  • 等待明确批准后再开始
  • 读取前一阶段所有相关文件
  • 按照选定的架构实现
  • 严格遵循代码库约定
  • 更新待办事项以跟踪进度

Phase 6: Quality Review

阶段6:质量评审

Goal: Ensure code is simple, DRY, elegant, and functionally correct
  • Launches 3
    code-reviewer
    agents in parallel:
    • Simplicity/DRY/Elegance: Code quality
    • Bugs/Correctness: Functional correctness
    • Conventions/Abstractions: Project standards
  • Consolidates findings and identifies high severity issues
  • Asks what to do: Fix now, fix later, or proceed as-is
Example output:
High Priority Issues:
1. Missing error handling in OAuth callback (src/auth/oauth.ts:67)
2. Memory leak: OAuth state not cleaned up (src/auth/oauth.ts:89)

Medium Priority:
1. Could simplify token refresh logic (src/auth/oauth.ts:120)

What would you like to do?
目标:确保代码简洁、DRY、优雅且功能正确
  • 并行启动3个
    code-reviewer
    Agent:
    • 简洁性/DRY原则/优雅度:代码质量
    • Bug/正确性:功能正确性
    • 约定/抽象:项目标准
  • 整合发现结果并识别高严重性问题
  • 询问处理方式:立即修复、后续修复或保持现状
示例输出:
高优先级问题:
1. OAuth回调缺少错误处理(src/auth/oauth.ts:67)
2. 内存泄漏:OAuth状态未清理(src/auth/oauth.ts:89)

中优先级:
1. 可简化令牌刷新逻辑(src/auth/oauth.ts:120)

你希望如何处理?

Phase 7: Summary

阶段7:总结

Goal: Document what was accomplished
  • Marks all todos complete
  • Summarizes what was built, key decisions, files modified
  • Suggests next steps
目标:记录完成的工作
  • 标记所有待办事项为完成
  • 总结开发内容、关键决策、修改的文件
  • 建议下一步行动

Specialized Agents

专用Agent

code-explorer

code-explorer

Purpose: Deeply analyzes existing codebase features by tracing execution paths
Focus:
  • Entry points and call chains
  • Data flow and transformations
  • Architecture layers and patterns
  • Implementation details
Output:
  • Entry points with file:line references
  • Step-by-step execution flow
  • Key components and responsibilities
  • Essential files to read
Triggered: Automatically in Phase 2, or manually
用途:通过追踪执行路径深入分析现有代码库功能
关注点:
  • 入口点和调用链
  • 数据流和转换
  • 架构层和模式
  • 实现细节
输出:
  • 带文件:行号引用的入口点
  • 分步执行流程
  • 关键组件及职责
  • 需阅读的核心文件
触发时机:阶段2自动触发,或手动触发

code-architect

code-architect

Purpose: Designs feature architectures and implementation blueprints
Focus:
  • Codebase pattern analysis
  • Architecture decisions
  • Component design
  • Implementation roadmap
Output:
  • Patterns and conventions found
  • Architecture decision with rationale
  • Complete component design
  • Implementation map with build sequence
Triggered: Automatically in Phase 4, or manually
用途:设计功能架构和实现蓝图
关注点:
  • 代码库模式分析
  • 架构决策
  • 组件设计
  • 实现路线图
输出:
  • 发现的模式和约定
  • 带理由的架构决策
  • 完整的组件设计
  • 含构建顺序的实现地图
触发时机:阶段4自动触发,或手动触发

code-reviewer

code-reviewer

Purpose: Reviews code for bugs, quality issues, and project conventions
Focus:
  • Project guideline compliance (CLAUDE.md)
  • Bug detection
  • Code quality issues
  • Confidence-based filtering (≥80% confidence only)
Output:
  • Critical issues (confidence 75-100)
  • Important issues (confidence 50-74)
  • Specific fixes with file:line references
Triggered: Automatically in Phase 6, or manually
用途:评审代码中的Bug、质量问题和项目约定合规性
关注点:
  • 项目指南合规性(CLAUDE.md)
  • Bug检测
  • 代码质量问题
  • 基于置信度的筛选(仅保留≥80%置信度的问题)
输出:
  • 严重问题(置信度75-100)
  • 重要问题(置信度50-74)
  • 带文件:行号引用的具体修复建议
触发时机:阶段6自动触发,或手动触发

Usage Patterns

使用模式

Full workflow (recommended for new features)

完整工作流(推荐用于新功能)

bash
/feature-dev Add rate limiting to API endpoints
bash
/feature-dev Add rate limiting to API endpoints

Manual agent invocation

手动调用Agent

Explore a feature:
"Launch code-explorer to trace how authentication works"
Design architecture:
"Launch code-architect to design the caching layer"
Review code:
"Launch code-reviewer to check my recent changes"
探索功能:
"Launch code-explorer to trace how authentication works"
设计架构:
"Launch code-architect to design the caching layer"
评审代码:
"Launch code-reviewer to check my recent changes"

When to Use

使用场景

Use for:
  • New features that touch multiple files
  • Features requiring architectural decisions
  • Complex integrations with existing code
  • Features where requirements are somewhat unclear
Don't use for:
  • Single-line bug fixes
  • Trivial changes
  • Well-defined simple tasks
  • Urgent hotfixes
适合使用的场景:
  • 涉及多文件的新功能开发
  • 需要做出架构决策的功能
  • 与现有代码的复杂集成
  • 需求存在一定模糊性的功能
不适合使用的场景:
  • 单行Bug修复
  • 微小改动
  • 需求明确的简单任务
  • 紧急热修复

Best Practices

最佳实践

  1. Use the full workflow for complex features: The 7 phases ensure thorough planning
  2. Answer clarifying questions thoughtfully: Phase 3 prevents future confusion
  3. Choose architecture deliberately: Phase 4 gives options for a reason
  4. Don't skip code review: Phase 6 catches issues before production
  5. Read the suggested files: Phase 2 identifies key files—read them for context
  1. 复杂功能使用完整工作流:7个阶段确保规划周全
  2. 认真回答澄清问题:阶段3避免后续混淆
  3. 谨慎选择架构方案:阶段4提供多种方案是有原因的
  4. 不要跳过代码评审:阶段6在上线前发现问题
  5. 阅读推荐文件:阶段2识别出的关键文件能提供上下文

Common Issues

常见问题

Agents take too long

Agent运行时间过长

Cause: Normal for large codebases Solution: Agents run in parallel when possible. Thoroughness pays off in better understanding.
原因:大型代码库的正常现象 解决方案:Agent尽可能并行运行,充分的理解能带来更好的结果。

Too many clarifying questions

澄清问题过多

Cause: Feature request too vague Solution: Be more specific in initial request. Provide context about constraints upfront.
原因:功能需求过于模糊 解决方案:初始需求更具体,提前提供约束条件的上下文。

Architecture options overwhelming

架构方案过于复杂

Cause: Multiple valid approaches presented Solution: Trust the recommendation (based on codebase analysis). Pick pragmatic option when in doubt.
原因:呈现了多种可行方案 解决方案:信任基于代码库分析给出的推荐方案。不确定时选择务实方案。

Requirements

要求

  • Claude Code installed
  • Git repository (for code review)
  • Existing codebase (workflow learns from existing patterns)
  • 已安装Claude Code
  • Git仓库(用于代码评审)
  • 现有代码库(工作流从现有模式中学习)

Tips

提示

  • Be specific in feature request: More detail = fewer clarifying questions
  • Trust the process: Each phase builds on the previous one
  • Review agent outputs: Agents provide valuable codebase insights
  • Don't skip phases: Each phase serves a purpose
  • Use for learning: Exploration phase teaches you about your own codebase
  • 功能需求尽量具体:细节越多,澄清问题越少
  • 信任流程:每个阶段都基于前一阶段的成果
  • 查看Agent输出:Agent能提供有价值的代码库洞察
  • 不要跳过阶段:每个阶段都有其作用
  • 用于学习:探索阶段能帮助你了解自己的代码库

Verification Checklist

验证清单

After using the workflow:
  • All 7 phases completed successfully
  • Clarifying questions answered in Phase 3
  • Architecture approach selected in Phase 4
  • Implementation approved before Phase 5 started
  • Code review findings addressed in Phase 6
  • Summary generated with next steps in Phase 7
  • Feature works as expected
  • Code follows project conventions
使用工作流后:
  • 所有7个阶段成功完成
  • 阶段3的澄清问题已回答
  • 阶段4已选定架构方案
  • 阶段5开始前已批准实现方案
  • 阶段6的代码评审发现已处理
  • 阶段7已生成含下一步行动的总结
  • 功能符合预期
  • 代码遵循项目约定

References

参考资料

For detailed workflow documentation, see
README.md
For agent specifications, see:
  • agents/code-explorer.md
  • agents/code-architect.md
  • agents/code-reviewer.md
For slash command implementation, see
commands/feature-dev.md
详细工作流文档请参阅
README.md
Agent规格请参阅:
  • agents/code-explorer.md
  • agents/code-architect.md
  • agents/code-reviewer.md
斜杠命令实现请参阅
commands/feature-dev.md