关于 superpowers
Superpowers 是面向编码 Agent 的结构化软件开发框架,以需求澄清、设计、规划、实施和审查的循环取代直接编写代码。它强调小任务、测试先行和全程验证。
主要功能
- 01澄清需求并探索代码库
- 02将工作规划为独立小任务
- 03采用 RED–GREEN–REFACTOR 测试循环
- 04检查规范符合度、代码质量与集成
- 05涵盖调试和协作实践
适用场景
- 01开发跨多个文件的复杂功能
- 02以可验证的小步骤重构代码
- 03实践测试驱动开发
- 04排查问题并防止回归
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ founderjourney/ claude-skills --skill superpowers安装后在 Claude Code 中输入/superpowers确认已加载。
详细介绍
Superpowers
一种结构化软件开发框架,可改变编码 Agent 的开发方式,避免“立即编写代码”这一反模式。
何时使用此技能
- 复杂功能开发
- 多文件重构
- 测试驱动开发
- 代码审查流程
- 系统化调试
- 与 AI 协作的团队合作
理念
传统 AI 编码:
User: "Add auth to the app"
AI: *immediately writes 500 lines of code*
Superpowers 方法:
User: "Add auth to the app"
AI: "Let me understand requirements first..."
→ Questions → Design → Plan → Execute → Review
核心工作流
阶段 1:理解
1. Ask clarifying questions
2. Explore existing codebase
3. Understand constraints
4. Validate assumptions
阶段 2:设计
1. Create isolated workspace (git branch)
2. Break work into 2-5 minute tasks
3. Define exact specifications
4. Get approval before coding
阶段 3:执行
1. RED: Write failing test
2. GREEN: Minimum code to pass
3. REFACTOR: Clean up
4. Review before next task
阶段 4:审查
1. Specification compliance check
2. Code quality review
3. Integration verification
4. Branch completion decision
核心原则
1. 先设计,再编码
未理解以下内容之前,绝不编写代码:
- 我们要解决什么问题?
- 有哪些约束?
- 如何与现有代码相适配?
- 有哪些边缘情况?
2. 任务小而专注
每项任务都应:
- 能在 2-5 分钟内完成
- 只承担单一职责
- 可独立测试
- 有明确的成功标准
3. 测试优先开发
RED → GREEN → REFACTOR
- 先编写测试
- 编写通过测试所需的最少代码
- 随后进行清理
- 绝不跳过此循环
4. 系统化,而非临时应付
┌─────────────────────────────────────┐
│ Systematic vs. Ad-hoc │
├─────────────────────────────────────┤
│ Plan then execute │ Jump in │
│ Verify with tests │ Hope it works│
│ Review each step │ Review at end│
│ Evidence-based │ Assumption │
└─────────────────────────────────────┘
5. 以证据为准,而非依赖假设
- 不要假设代码能正常工作——要验证
- 不要假设自己已经理解——要确认
- 不要假设任务已完成——要证明
技能库
测试
- 单元测试模式
- 集成测试
- 测试覆盖率分析
- 模拟策略
调试
1. Reproduce the issue
2. Isolate the cause
3. Root cause analysis
4. Verify the fix
5. Prevent regression
协作
- 头脑风暴:探索各种选项
- 规划:构建方案
- 并行执行:多个 Agent
- 审查:质量关卡
元技能
- 扩展框架
- 创建自定义技能
- 优化工作流
使用方法
开始一项功能
I want to add user authentication.
Help me think through:
1. What auth mechanism?
2. Session vs JWT?
3. Where to store credentials?
4. What existing code to modify?
开发期间
I'm implementing the login endpoint.
Current state:
- User model exists
- Password hashing ready
Next: Create POST /login endpoint
Tests first, then implementation.
代码审查
Review my changes:
[paste diff]
Check against:
- Original spec
- Test coverage
- Code quality
- Security concerns
示例:添加一项功能
1. 探索
User: "Add forgot password feature"
Agent: "Before we start, let me understand:
1. How should the reset link be delivered? (email?)
2. What's the token expiry? (1 hour?)
3. Should we rate limit attempts?
4. Any existing email infrastructure?"
2. 规划
Tasks:
1. Create password_reset_tokens table
2. Add POST /forgot-password endpoint
3. Add POST /reset-password endpoint
4. Create email template
5. Add rate limiting middleware
3. 执行(任务 1)
## Task: Create password_reset_tokens table
### Test (RED)
- Test migration creates table
- Test table has correct columns
### Implementation (GREEN)
- Create migration file
- Define schema
### Verify
- Run migration
- Check table exists
4. 审查
## Task 1 Complete
✓ Migration runs successfully
✓ Table has: id, user_id, token, expires_at
✓ Foreign key constraint works
Ready for Task 2?
最佳实践
- 不要急于求成:减少错误才能提升速度
- 提出问题:实现之前先澄清
- 小步前进:更易验证和调试
- 测试一切:信任源于证据
- 经常审查:及早发现问题
集成
支持:
- Claude Code:通过 marketplace
- Codex:安装插件
- OpenCode:直接集成
应避免的反模式
- 未理解需求就编写代码
- 为了“节省时间”而跳过测试
- 包含多个关注点的大型 PR
- 未经验证就假设代码能正常工作
- 没有证据就宣称完成
评论
支持 Markdown