sparc-methodology

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sparc Methodology Skill

SPARC方法论技能

Purpose

目的

SPARC development workflow: Specification, Pseudocode, Architecture, Refinement, Completion. A structured approach for complex implementations that ensures thorough planning before coding.
SPARC开发工作流:Specification(需求定义)、Pseudocode(伪代码编写)、Architecture(架构设计)、Refinement(优化迭代)、Completion(完成交付)。这是一种针对复杂实现场景的结构化方法,确保在编码前完成充分规划。

When to Trigger

适用场景

  • new feature implementation
  • complex implementations
  • architectural changes
  • system redesign
  • integration work
  • unclear requirements
  • 新功能开发
  • 复杂功能实现
  • 架构变更
  • 系统重设计
  • 集成工作
  • 需求不明确的任务

When to Skip

跳过场景

  • simple bug fixes
  • documentation updates
  • configuration changes
  • well-defined small tasks
  • routine maintenance
  • 简单bug修复
  • 文档更新
  • 配置变更
  • 需求明确的小型任务
  • 日常维护

Commands

命令

Specification Phase

需求定义阶段

Define requirements, acceptance criteria, and constraints
bash
npx @claude-flow/cli hooks route --task "specification: [requirements]"
Example:
bash
npx @claude-flow/cli hooks route --task "specification: user authentication with OAuth2, MFA, and session management"
定义需求、验收标准和约束条件
bash
npx @claude-flow/cli hooks route --task "specification: [requirements]"
示例:
bash
npx @claude-flow/cli hooks route --task "specification: user authentication with OAuth2, MFA, and session management"

Pseudocode Phase

伪代码编写阶段

Write high-level pseudocode for the implementation
bash
npx @claude-flow/cli hooks route --task "pseudocode: [feature]"
Example:
bash
npx @claude-flow/cli hooks route --task "pseudocode: OAuth2 login flow with token refresh"
为实现方案编写高层级伪代码
bash
npx @claude-flow/cli hooks route --task "pseudocode: [feature]"
示例:
bash
npx @claude-flow/cli hooks route --task "pseudocode: OAuth2 login flow with token refresh"

Architecture Phase

架构设计阶段

Design system structure, interfaces, and dependencies
bash
npx @claude-flow/cli hooks route --task "architecture: [design]"
Example:
bash
npx @claude-flow/cli hooks route --task "architecture: auth module with service layer, repository, and API endpoints"
设计系统结构、接口和依赖关系
bash
npx @claude-flow/cli hooks route --task "architecture: [design]"
示例:
bash
npx @claude-flow/cli hooks route --task "architecture: auth module with service layer, repository, and API endpoints"

Refinement Phase

优化迭代阶段

Iterate on the design based on feedback
bash
npx @claude-flow/cli hooks route --task "refinement: [feedback]"
Example:
bash
npx @claude-flow/cli hooks route --task "refinement: add rate limiting and brute force protection"
根据反馈迭代优化设计方案
bash
npx @claude-flow/cli hooks route --task "refinement: [feedback]"
示例:
bash
npx @claude-flow/cli hooks route --task "refinement: add rate limiting and brute force protection"

Completion Phase

完成交付阶段

Finalize implementation with tests and documentation
bash
npx @claude-flow/cli hooks route --task "completion: [final checks]"
Example:
bash
npx @claude-flow/cli hooks route --task "completion: verify all tests pass, update API docs, security review"
通过测试和文档完善最终实现
bash
npx @claude-flow/cli hooks route --task "completion: [final checks]"
示例:
bash
npx @claude-flow/cli hooks route --task "completion: verify all tests pass, update API docs, security review"

SPARC Coordinator

SPARC协调器

Spawn SPARC coordinator agent
bash
npx @claude-flow/cli agent spawn --type sparc-coord --name sparc-lead
启动SPARC协调器Agent
bash
npx @claude-flow/cli agent spawn --type sparc-coord --name sparc-lead

Scripts

脚本

ScriptPathDescription
sparc-init
.agents/scripts/sparc-init.sh
Initialize SPARC workflow for a new feature
sparc-review
.agents/scripts/sparc-review.sh
Run SPARC phase review checklist
脚本路径描述
sparc-init
.agents/scripts/sparc-init.sh
为新功能初始化SPARC工作流
sparc-review
.agents/scripts/sparc-review.sh
执行SPARC阶段审查检查清单

References

参考文档

DocumentPathDescription
SPARC Overview
docs/sparc.md
Complete SPARC methodology guide
Phase Templates
docs/sparc-templates.md
Templates for each SPARC phase
文档路径描述
SPARC Overview
docs/sparc.md
完整的SPARC方法论指南
Phase Templates
docs/sparc-templates.md
各SPARC阶段的模板

Best Practices

最佳实践

  1. Check memory for existing patterns before starting
  2. Use hierarchical topology for coordination
  3. Store successful patterns after completion
  4. Document any new learnings
  1. 开始前检查已有模式的相关记录
  2. 使用分层拓扑结构进行协调
  3. 完成后保存成功的模式
  4. 记录所有新的经验总结