规范开发
specclaw
by chanbistec
Spec-driven development framework for OpenClaw. Propose features, generate specs, spawn coding agents, validate implementations.
安装
claude skill add --url https://github.com/openclaw/skills文档
SpecClaw — Spec-Driven Development
Overview
SpecClaw brings structured, spec-driven development to OpenClaw agents. It manages the full lifecycle: propose → plan → build → verify → archive.
Directory Structure
When initialized (.specclaw/ exists in project root):
.specclaw/
├── config.yaml # Project configuration
├── STATUS.md # Project dashboard (auto-generated)
├── patterns.md # Recurring pattern registry (cross-change)
└── changes/
├── <change-name>/
│ ├── proposal.md # Problem + solution + scope
│ ├── spec.md # Requirements + acceptance criteria
│ ├── design.md # Technical approach + file map
│ ├── tasks.md # Ordered tasks with status markers
│ ├── status.md # Progress tracking
│ ├── errors.md # Build error journal (auto-generated on failures)
│ └── learnings.md # Build learnings (spec gaps, patterns, insights)
└── archive/ # Completed changes
Commands
The user triggers commands conversationally. Recognize these patterns:
specclaw init
Trigger: "specclaw init", "initialize specclaw", "set up spec-driven development"
- Create
.specclaw/directory structure - Generate
config.yamlfrom template (seetemplates/config.yaml) - Ask user for project name/description
- Create initial
STATUS.md - Add
.specclaw/tracking to git
specclaw propose "<idea>"
Trigger: "specclaw propose", "propose a change", "new feature proposal"
- Create
.specclaw/changes/<slugified-name>/ - Generate
proposal.mdfrom template - Include: problem statement, proposed solution, scope, impact, open questions
- Present proposal to user for review
- Update
STATUS.md
specclaw plan <change>
Trigger: "specclaw plan", "plan the feature", "generate spec for"
- Read the proposal
- Analyze existing codebase (file structure, patterns, dependencies)
- Generate:
spec.md— functional requirements, acceptance criteria, edge casesdesign.md— technical approach, architecture, file changes maptasks.md— ordered implementation tasks with dependencies
- Present plan summary to user
- Update status
specclaw build <change>
Trigger: "specclaw build", "implement the feature", "start building"
This is where OpenClaw shines. Follow this execution flow exactly:
Step 1 — Setup
Run the setup script to parse config, create a git branch, and get build configuration:
bash skill/scripts/build.sh setup .specclaw <change_name>
This returns JSON config including parallel_tasks, models.coding, git.strategy, and notifications.channel. Capture this output — you'll need parallel_tasks and model values throughout the build.
Send a build started notification:
🦞 **Build Started**
**Change:** <change_name>
**Branch:** specclaw/<change_name>
**Tasks:** <total_count> across <wave_count> waves
Step 2 — Parse Tasks
Get all actionable tasks:
bash skill/scripts/parse-tasks.sh --status pending .specclaw/changes/<change>/tasks.md
This outputs JSON: [{"id": "T1", "title": "...", "wave": 1, "depends": [], "files": [...], "estimate": "small"}, ...]
For retries (re-running build on a change with prior failures):
bash skill/scripts/parse-tasks.sh --status failed .specclaw/changes/<change>/tasks.md
Reset failed tasks to pending before re-executing:
bash skill/scripts/update-task-status.sh .specclaw/changes/<change>/tasks.md <TASK_ID> pending
Then re-parse with --status pending and continue from the appropriate wave.
Step 3 — Wave Loop
Execute tasks wave-by-wave. For each wave number (1, 2, 3...):
a. Filter tasks for this wave:
bash skill/scripts/parse-tasks.sh --wave N --status pending .specclaw/changes/<change>/tasks.md
If no tasks returned for this wave, the build is complete — skip to Step 4.
Skip waves with blocked tasks: If a task's dependency failed in a prior wave, skip it and mark it failed:
bash skill/scripts/update-task-status.sh .specclaw/changes/<change>/tasks.md <TASK_ID> failed
b. For each task in the wave (up to parallel_tasks from config):
-
Mark in-progress:
bashbash skill/scripts/update-task-status.sh .specclaw/changes/<change>/tasks.md <TASK_ID> in_progress -
Build context payload:
bashbash skill/scripts/build-context.sh .specclaw <change> <TASK_ID>This outputs a complete context string containing: spec sections, design sections, task details, relevant source file contents, and constraints. Use this output directly as the agent's task.
-
Spawn coding agent:
codesessions_spawn( task: <output from build-context.sh>, label: "specclaw-<change>-<task_id>", mode: "run", model: <models.coding from config> )
c. Yield and wait:
After spawning all tasks in the wave batch, call sessions_yield to wait for agent completions. Results auto-announce back to you.
d. Process completed agents:
For each agent that succeeded:
-
Mark complete:
bashbash skill/scripts/update-task-status.sh .specclaw/changes/<change>/tasks.md <TASK_ID> completeIf this task previously failed (was
[!]before): Runbash skill/scripts/log-error.sh .specclaw <change> --resolve <task_id> -
Git commit the changes:
bashbash skill/scripts/build.sh commit .specclaw <change> <TASK_ID> "<task_title>" <files...> -
Send a task complete notification:
code✅ **Task Complete:** <TASK_ID> — <task_title> **Change:** <change_name> | **Wave:** <N>/<total_waves>
e. Process failed agents:
For each agent that failed:
-
Mark failed:
bashbash skill/scripts/update-task-status.sh .specclaw/changes/<change>/tasks.md <TASK_ID> failed -
Log error: Run
bash skill/scripts/log-error.sh .specclaw <change> <task_id> <wave> <agent_label> "<failure summary>"— pipe agent error output if available -
Log the error in
status.mdwith the failure reason -
Send a task failed notification:
code❌ **Task Failed:** <TASK_ID> — <task_title> **Change:** <change_name> | **Wave:** <N>/<total_waves> **Error:** <brief failure reason> -
Mark all dependent tasks in later waves as skipped/failed — they cannot proceed
f. Repeat for the next wave number until no pending tasks remain.
Step 4 — Finalize
Run the finalize script to execute tests and merge the branch:
bash skill/scripts/build.sh finalize .specclaw <change_name>
This runs the configured test_command (if any) and merges the branch per git.strategy.
Step 5 — Post-Build Review
If automation.post_build_review is true in config, run an automated review before updating the dashboard:
a. Scope deviation check:
Compare files actually changed against files declared in tasks:
# Get files changed since pre-build commit (branch point)
git diff --name-only main...HEAD
Cross-reference with files listed in each task in tasks.md. Flag any files changed but not declared in any task's Files: field.
b. Review prompt:
Evaluate the build and auto-log findings (~150 words max):
🦞 Post-Build Review — <change-name>
Results: X/Y tasks passed, Z failed
Evaluate:
1. Were any spec requirements ambiguous or incomplete?
2. Did the design need adjustment during implementation?
3. Were any files modified outside declared task scope?
4. Did any agents struggle with context or instructions?
5. Any reusable patterns discovered?
For each finding, log with:
bash skill/scripts/log-learning.sh .specclaw <change> <category> <priority> "<detail>" "<action>"
c. Auto-log scope deviations:
For any files changed outside declared task scope, automatically log as design_gap:
bash skill/scripts/log-learning.sh .specclaw <change> design_gap medium "File <path> modified but not declared in any task" "Review task file declarations for completeness"
d. Pattern scan: Run bash skill/scripts/detect-patterns.sh .specclaw scan <change> to check for recurring patterns across changes.
e. If any patterns have recurrence >= 3, alert the user: "⚠️ Pattern PAT-XXX has N occurrences — consider promoting its prevention rule to agent context."
Step 6 — Update Dashboard
Regenerate the project status dashboard:
bash skill/scripts/update-status.sh .specclaw
Step 7 — Notify
Send the build summary via the message tool to the configured notification channel:
🦞 **Build Complete**
**Change:** <change_name>
**Status:** <succeeded|partial|failed>
**Tasks:** <completed>/<total> complete, <failed> failed, <skipped> skipped
**Branch:** specclaw/<change_name> → merged to <target_branch>
**Duration:** <elapsed time>
If any tasks failed, include a remediation section:
⚠️ **Failed Tasks:**
- <TASK_ID>: <brief error> — re-run with `specclaw build <change>` to retry
Retry Flow
When specclaw build is called on a change that has failed tasks:
- Parse failed tasks:
parse-tasks.sh --status failed - Reset each to pending:
update-task-status.sh ... pending - Re-parse pending tasks and determine which waves need re-execution
- Execute only the waves containing reset tasks (and their dependents)
- Retried tasks automatically get previous error context via
build-context.sh
- Retried tasks automatically get previous error context via
- Finalize and notify as normal
Key Principles
- Fresh context always — each agent gets ONLY what it needs via
build-context.sh. No stale context from prior tasks. This is critical for quality. - Parallel within waves — tasks in the same wave with no cross-dependencies spawn simultaneously, up to
parallel_taskslimit. - Sequential across waves — wave N+1 starts only after wave N completes.
- Fail-fast on dependencies — if a task fails, all tasks depending on it are immediately marked failed.
specclaw learn <change> "<insight>"
Trigger: "specclaw learn", "log a learning", "what did we learn", "capture insight"
Capture build learnings — spec gaps, design misses, and patterns discovered during implementation.
Log a learning:
bash skill/scripts/log-learning.sh .specclaw <change> <category> <priority> "<detail>" ["<action>"]
Categories: spec_gap | design_gap | pattern | best_practice | agent_issue
Priorities: low | medium | high
List learnings for a change:
bash skill/scripts/log-learning.sh .specclaw <change> --list
Promote a learning (mark for elevation to agent prompts/SKILL.md):
bash skill/scripts/log-learning.sh .specclaw <change> --promote <id>
When to log:
- After a build reveals a spec gap (requirements were unclear or missing)
- When a design decision needed mid-build adjustment
- When agents discovered a useful pattern worth reusing
- When parallel tasks created conflicts (duplicate code, shared dependencies)
- When an agent struggled with the context or instructions
Learnings are stored in .specclaw/changes/<change>/learnings.md and feed into the pattern detection system for cross-change analysis.
specclaw patterns
Trigger: "specclaw patterns", "check patterns", "recurring issues", "what keeps happening"
Track recurring patterns across changes — errors and learnings that repeat become prevention rules.
Scan a change for patterns:
bash skill/scripts/detect-patterns.sh .specclaw scan <change>
Reads errors.md and learnings.md, matches against existing patterns, creates new or increments existing.
List all patterns:
bash skill/scripts/detect-patterns.sh .specclaw list [--min-recurrence N]
Promote a pattern (mark for elevation to agent prompts):
bash skill/scripts/detect-patterns.sh .specclaw promote <pat-id>
Auto-promotion: Patterns with 3+ occurrences are flagged ⚠️ — their prevention rules should be added to agent context templates or SKILL.md build instructions.
Pattern registry lives at .specclaw/patterns.md (global, not per-change).
specclaw verify <change>
Trigger: "specclaw verify", "validate implementation", "check against spec"
- Read
spec.mdacceptance criteria - Check each criterion against the implementation
- Run tests if configured (
config.yaml test_command) - Generate verification report
- Update
status.mdwith pass/fail per criterion - If failures: suggest remediation tasks
specclaw status
Trigger: "specclaw status", "project status", "what's the progress"
- Read all changes in
.specclaw/changes/ - Compile dashboard showing:
- Active changes with progress %
- Pending proposals
- Recently archived
- Overall project health
- Update
STATUS.md
specclaw archive <change>
Trigger: "specclaw archive", "mark as done", "archive the change"
- Verify change is complete (all tasks done, verification passed)
- Move to
.specclaw/changes/archive/YYYY-MM-DD-<change-name>/ - Update
STATUS.md - Optionally create git tag
specclaw auto
Trigger: "specclaw auto", "autonomous mode", "auto-build"
- Check
STATUS.mdfor next actionable item - If proposal exists without plan → generate plan
- If plan exists without implementation → build
- If built without verification → verify
- Respect
config.yamllimits (max_tasks_per_run) - Notify user of results
Task Format in tasks.md
## Tasks
### Wave 1 (no dependencies)
- [ ] `T1` — Create theme context provider
- Files: `src/contexts/ThemeContext.tsx`
- Estimate: small
- [ ] `T2` — Add CSS custom properties
- Files: `src/styles/variables.css`
- Estimate: small
### Wave 2 (depends on Wave 1)
- [ ] `T3` — Create toggle component
- Files: `src/components/ThemeToggle.tsx`
- Depends: T1
- Estimate: small
### Wave 3 (depends on Wave 2)
- [ ] `T4` — Integration tests
- Files: `tests/theme.test.ts`
- Depends: T1, T2, T3
- Estimate: medium
Status markers:
[ ]— pending[~]— in progress[x]— complete[!]— failed (needs remediation)
Agent Context Preparation
Context construction is handled by the build-context.sh script:
bash skill/scripts/build-context.sh .specclaw <change> <TASK_ID>
The script automatically assembles a complete context payload containing:
- Task header — task ID, title, and estimate
- Spec context — relevant sections from
spec.md(requirements, acceptance criteria) - Design context — relevant sections from
design.md(architecture, approach) - Task details — full task description, file list, and dependencies from
tasks.md - Source files — current contents of files listed in the task's
Files:field - Constraints — standard rules (follow patterns, write tests, stay in scope)
The output is a single string ready to pass directly as the task parameter to sessions_spawn. Do not manually construct context — always use the script to ensure consistency and freshness.
Configuration Reference
See templates/config.yaml for the full config schema.
Key settings:
models.planning— model for proposals, specs, design (default: opus)models.coding— model for implementation (default: codex)models.review— model for verification (default: sonnet)git.strategy— "branch-per-change" or "direct"notifications.channel— where to send updatesautomation.max_tasks_per_run— limit for auto mode
Best Practices
- Keep proposals focused — one change per proposal, small scope
- Review specs before building — garbage in, garbage out
- Wave-based execution — group independent tasks, respect dependencies
- Fresh context always — never let agents accumulate stale context
- Verify early — run verification after each wave, not just at the end
相关 Skills
前端设计
by anthropics
面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。
✎ 想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。
网页构建器
by anthropics
面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。
✎ 在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。
网页应用测试
by anthropics
用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。
✎ 借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。
相关 MCP 服务
GitHub
编辑精选by GitHub
GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。
✎ 这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。
Context7 文档查询
编辑精选by Context7
Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。
✎ 它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。
by tldraw
tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。
✎ 这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。