← 返回
开发者工具 中文

OpenSpec Workflow

Autonomous spec-driven development with OpenSpec CLI and Claude Code. You orchestrate (draft artifacts, make judgment calls, ship PRs) while Claude Code revi...
基于 OpenSpec CLI 和 Claude Code 的自主规范驱动开发。由你主导(起草产物、决策判断、提交PR),Claude Code 负责审查……
bobbyradford bobbyradford 来源
开发者工具 clawhub v1.0.0 1 版本 99909.7 Key: 无需
★ 0
Stars
📥 1,107
下载
💾 70
安装
1
版本
#latest

概述

OpenSpec Workflow

Ship spec-driven changes autonomously with review quality gates.

Architecture

You are the orchestrator. You serve as the "human in the loop" — you make judgment calls, draft spec artifacts, process review feedback, and decide what ships. Claude Code is your hands — it explores the codebase, reviews with real code context, and implements tasks.

RoleWhoWhat
-----------------
OrchestratorYou (the agent running this skill)OpenSpec CLI, artifact drafting, review judgment, PR shipping
ReviewerClaude Code (or subagent)Codebase exploration, claim verification, artifact challenges
ImplementerClaude CodeTask implementation, code changes, commits

Why this split: The OpenSpec CLI is designed for scripting and automation — perfect for an orchestrator. Claude Code gets full codebase context automatically — perfect for review and implementation. The interactive plugin adds friction that doesn't help when an AI is the decision-maker.

When to Use This Skill

Use OpenSpec when the change affects what the product does:

  • New features or capabilities
  • Refactors that change behavior
  • Breaking changes or migrations
  • Anything that modifies or creates specs

Skip OpenSpec, just ship a PR when the change is supplementary:

  • Examples, tutorials, sample projects
  • Typo fixes, README updates, comment tweaks
  • CI/CD config (GitHub Actions, linting)
  • Dependency bumps

The key question: "Does this change what the product does, or just add stuff around it?"

Prerequisites

  • openspec CLI installed (npm install -g @fission-ai/openspec)
  • claude CLI installed (Claude Code)
  • gh CLI authenticated with repo access
  • Git repo with openspec/ directory initialized
  • Working directory is the repo root (or a git worktree)

Timeouts

When running this workflow as a sub-agent, set runTimeoutSeconds based on change size:

Change typeTimeoutWhy
---------------------------
Doc-only / trivial300 (5 min)1-2 artifacts, maybe skip review, quick implementation
Standard code change900 (15 min)4 artifacts × Claude Code review + implementation
Large / multi-file1200 (20 min)Complex reviews, big implementation, possible re-reviews

Each Claude Code invocation (review or implement) takes 1-3 minutes. A full workflow with 4 reviewed artifacts + implementation = 5-8 Claude Code calls minimum.

Quick Start

1. openspec new change "<name>"
2. For each artifact: draft → review loop → write
3. Implement tasks
4. Commit, push, open PR with "OpenSpec change: <name>" in body

Workflow

Step 1: Create the Change

openspec new change "<kebab-case-name>"
openspec status --change "<name>"

Step 2: Artifact Loop

For each artifact in order (typically: proposal → design → specs → tasks):

openspec instructions <artifact-id> --change "<name>"

Read the template and dependencies. Draft the artifact content.

Then decide: review or skip?

  • Skip review if the artifact is genuinely trivial (one-liner, obvious config, mechanical rename). Log: Skipped review — trivial: .
  • Send to review for anything with real design decisions, trade-offs, or ambiguity.

Spawn reviewers as subagents with the repo path so they can explore the codebase independently — read files, grep for patterns, verify "no code changes" claims. Don't just paste the artifact; give them the tools to challenge it. See references/review-loop.md for the full protocol and prompt template.

After writing the artifact, confirm progress:

openspec status --change "<name>"

Continue to the next artifact.

Step 3: Implement via Claude Code

Do not implement tasks directly. Delegate to Claude Code, which has full codebase context and can make changes safely.

# Get the task list for Claude Code's prompt
cat openspec/changes/<name>/tasks.md

Launch Claude Code in the repo (or worktree) with PTY and --dangerously-skip-permissions:

exec pty:true workdir:<repo-path> background:true command:"claude --dangerously-skip-permissions -p 'Implement these tasks from openspec/changes/<name>/tasks.md. Read the tasks file, the proposal, design, and specs in that change directory for full context. Mark tasks complete as you go. Commit when done.

When completely finished, run: openclaw system event --text \"Done: implemented <name>\" --mode now'"

Monitor via process action:log sessionId:. Claude Code will:

  • Read the OpenSpec artifacts for context
  • Implement each task
  • Mark [x] as it goes
  • Commit the changes

For trivial changes (pure doc edits, one-line fixes), you may implement directly instead. Log: Implemented directly — trivial: .

Step 4: Ship

Before committing, verify the change name matches the actual directory:

# Get the exact change directory name
CHANGE=$(ls openspec/changes/ | grep -v archive | head -1)
echo "Change name: $CHANGE"

Use this exact name everywhere — commit message AND PR body:

git add -A
git commit -m "<type>(scope): <description> (#<issue>)

OpenSpec change: $CHANGE"
git push origin <branch>
gh pr create --repo <owner/repo> --base main --head <branch> \
  --title "<type>: <description>" \
  --body "Closes #<issue>

OpenSpec change: $CHANGE"

Critical: The OpenSpec change: in the PR body must exactly match the directory name under openspec/changes/. The auto-archive GitHub Action uses this to locate the change. A mismatch means the archive silently skips. Always verify with ls openspec/changes/ before writing the PR body.

Step 5: Address PR Review Comments

After opening the PR, code review agents may leave comments. Monitor and respond:

# Check for review comments
gh pr view <number> --repo <owner/repo> --json reviews,comments
gh api repos/<owner>/<repo>/pulls/<number>/comments

For each review comment:

  1. Evaluate — Is it significant? Does it catch a real bug, missing edge case, or design issue?
  2. If significant: Fix it in the worktree, commit, push. The PR updates automatically.

```bash

# Fix, then:

git add -A && git commit -m "fix: address review — "

git push origin

```

  1. If not significant: Reply inline with your justification.

```bash

gh api repos///pulls//comments//replies \

-f body=""

```

Apply the same judgment rules as the artifact review loop: accept valid concerns, reject with reasoning, partially accept where appropriate. Don't blindly apply every suggestion — you're the decision-maker.

Step 6: Document & Report

Post the workflow log to the GitHub issue:

gh issue comment <number> --repo <owner/repo> --body '<workflow log>'

Include: each artifact's draft, review challenges, revisions, skip decisions with reasoning, and final implementation notes.

Always end by linking the user to the issue and PR:

  • Issue: https://github.com///issues/
  • PR: https://github.com///pull/

Artifact Guidelines

proposal.md

  • Why (1-2 sentences), What Changes (bullet list), Capabilities (new + modified specs), Impact
  • List every spec that will be created or modified in Capabilities — this drives the specs artifact

design.md

  • Context, Goals / Non-Goals, Decisions (with alternatives considered), Risks / Trade-offs
  • Skip for trivial changes (pure doc fixes, one-line config changes)

specs/\/spec.md

  • Delta format: ## ADDED Requirements, ## MODIFIED Requirements, ## REMOVED Requirements
  • Every requirement needs ### Requirement: + at least one #### Scenario:
  • MODIFIED must include the full updated requirement text (not just the diff)
  • Use existing spec names from openspec/specs/ for modified capabilities

tasks.md

  • Numbered groups with checkboxes: - [ ] 1.1 Task description
  • Small enough to complete in one session
  • Ordered by dependency

GitHub Action: Auto-Archive on Merge

For repos that want automatic spec sync and archiving, add this workflow. See references/archive-action.md for the complete GitHub Action YAML.

The action:

  1. Triggers on PR merge
  2. Extracts change name from OpenSpec change: in PR body
  3. Runs openspec archive --yes on a new branch
  4. Opens a PR with the archive and spec sync changes
  5. Deletes the original merged branch

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 08:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,088 📥 816,342
ai-agent

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。适用于以下场景:创建/查询实体(人物、项目、任务、事件、文档)、关联相关对象、强制执行约束、将多步操作规划为图谱变换,或当技能需要共享状态时。触发关键词包括"记住""我知道关于什么""将X链
★ 723 📥 245,244
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,386 📥 321,165