AgentSkillsCN

spec-driven-dev

A2A 功能的规范驱动开发框架。通过结构化的规格说明与任务分解,从需求构思一路贯穿至落地实施。可通过“/spec.plan”、“/spec.refine”、“/spec.tasks”、“/spec.run”、“我想构建”、“我想添加”、“创建规格”、“新功能”等短语触发。

SKILL.md
--- frontmatter
name: spec-driven-dev
description: >-
  Spec-driven development framework for A2A features. Orchestrates from
  intent to implementation via structured specs and task breakdown.
  Triggers on "/spec.plan", "/spec.refine", "/spec.tasks", "/spec.run",
  "I want to build", "I want to add", "create spec", "new feature".
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, Task

Spec-Driven Development

Iterative feature development ensuring zero ambiguity before execution.

Quick Reference

CommandPurpose
/spec.plan <intent>Create spec from feature description
/spec.refine [section]Improve spec with research
/spec.tasksBreak spec into executable tasks
/spec.run [task#]Execute tasks with TDD

Core Principle

Iterate until clarity: No task execution begins until ALL questions are resolved.


Phase 1: /spec.plan - Create Specification

Trigger: /spec.plan <description> or "I want to build/add X"

Workflow

  1. Check specs/ folder - create if missing
  2. Generate spec file: specs/{feature-slug}.md
  3. Fill initial sections from user intent
  4. Generate clarifying questions
  5. STOP and present questions

Phase 2: /spec.refine - Research & Improve

Trigger: /spec.refine [section]

Workflow

  1. Load active DRAFT spec
  2. Search codebase for similar patterns
  3. Update Technical Strategy
  4. Re-evaluate clarity
  5. If questions remain: STOP and present

Phase 3: /spec.tasks - Task Breakdown

Trigger: /spec.tasks

Prerequisites

  • Active spec must be DRAFT or APPROVED
  • "Open Questions" section must be empty
  • If questions exist: STOP → clarify first

Task Granularity

Tasks should be high-level logical units:

  • "Implement FileStorage class"
  • "Add agent discovery mechanism"
  • "Create tests for router agent"

Phase 4: /spec.run - Execute Tasks

Trigger: /spec.run [task#]

Execution Rules

  • TDD for each task: Red → Green → Refactor → Commit
  • Invoke /python for .py files
  • Mark completed in task file
  • Update status.md after each task

File Structure

code
specs/
├── file-storage.md           # Spec (APPROVED)
├── file-storage.tasks.md     # Task breakdown
├── agent-discovery.md        # Spec (DRAFT)
└── ...

Spec Status Flow

code
DRAFT -> APPROVED -> IN_PROGRESS -> COMPLETED
          |              |
          v              v
      (questions?)   (blocked?)
          |              |
          v              v
        DRAFT      IN_PROGRESS

A2A-Specific Scopes

When creating specs, consider these modules:

ModuleFilesConsiderations
Agentsagents/*.pyBase class, think/act pattern
Storagestorage/*.pyAbstract interface
Authauth/*.pyPermissions, roles
Protocolprotocol/*.pyMCP integration

Session Resume

On context compaction:

  1. READ .claude/status.md
  2. Check specs/ for files with status IN_PROGRESS
  3. Check .tasks.md files for unchecked items
  4. Report: "Found in-progress spec: X with Y tasks remaining"
  5. Ask: "Continue with /spec.run?"