AgentSkillsCN

spec-driven

以需求规格为导向的开发流程,分为初始化、规划、任务执行与验证等结构化阶段。通过清晰的结构化方式,将功能需求与需求规格一一对应,确保全程可追溯。适用于项目启动、功能规划、带验证的实施,或跨多个会话持续追踪决策过程。触发词包括:“映射代码库”、“初始化”、“初始化项目”、“创建功能”、“规划”、“任务执行”、“实施”、“验证”、“归档”。

SKILL.md
--- frontmatter
name: spec-driven
description: >-
  Specification-driven development with structured phases: Initialize, Plan, Tasks, Implement+Validate.
  Creates structured feature specs with traceability to requirements.
  Use when: starting projects, planning features, implementing with verification,
  or tracking decisions across sessions. Triggers on "map codebase", "initialize",
  "initialize project", "create feature", "plan", "tasks", "implement",
  "validate", "archive".
metadata:
  author: github.com/adeonir
  version: "1.0.1"

Spec-Driven Development

Structured development workflow: Initialize -> Plan -> Tasks -> Implement+Validate.

Workflow

code
initialize --> plan --> tasks --> implement --> validate --> archive

Project Structure

code
.specs/
├── project/
│   ├── PROJECT.md          # Vision, goals, constraints
│   ├── ROADMAP.md          # Planned features, milestones
│   ├── CHANGELOG.md        # Feature implementation history
│   └── STATE.md            # Persistent memory (decisions, blockers)
├── codebase/               # Brownfield analysis (optional)
│   ├── STACK.md
│   ├── ARCHITECTURE.md
│   ├── CONVENTIONS.md
│   ├── STRUCTURE.md
│   ├── TESTING.md
│   └── INTEGRATIONS.md
├── research/               # Research cache (optional)
│   └── {topic}.md
└── features/
    └── {ID}-{name}/
        ├── spec.md         # WHAT: Requirements
        ├── plan.md         # HOW: Architecture
        └── tasks.md        # WHEN: Tasks

docs/
└── features/
    └── {name}.md           # Consolidated implementation

Context Loading Strategy

Base load (~15k tokens):

  • PROJECT.md (context)
  • STATE.md (persistent memory)
  • Current feature spec.md

On-demand:

  • codebase/*.md (brownfield)
  • plan.md (implementing)
  • tasks.md (executing)
  • research/*.md (new technologies)

Never simultaneous:

  • Multiple feature specs
  • Archived features

Triggers

Project-Level

Trigger PatternReference
Initialize project, setup projectproject-init.md
Create roadmap, plan featuresroadmap.md
Map codebase, analyze codebasecodebase-mapping.md
Record decision, log blockersession-state.md

Feature-Level

Trigger PatternReference
Create new feature, new featureinitialize.md (greenfield)
Modify feature, improve featureinitialize.md (brownfield)
Create technical planplan.md
Research technology, cache researchresearch.md
Create taskstasks.md
Implement taskimplement.md
Validatevalidate.md
Archivearchive.md
List features, show statusstatus-specs.md

Guidelines

Trigger PatternReference
How to write specsspec-writing.md
How to decompose taskstask-decomposition.md
Codebase explorationcodebase-exploration.md
Research patternsresearch.md
Baseline discoverybaseline-discovery.md
Extract from PRD/docsdoc-extraction.md
Coding principlescoding-principles.md

Cross-References

code
project-init.md ----> roadmap.md
project-init.md ----> codebase-mapping.md
initialize.md ------> plan.md (when spec complete)
plan.md ------------> tasks.md
plan.md ------------> research.md (if new tech)
tasks.md -----------> implement.md
implement.md -------> coding-principles.md (loaded before coding)
implement.md -------> validate.md
validate.md --------> implement.md (if issues)
validate.md --------> archive.md (if passed)

Guidelines

  • Content separation: spec=WHAT, plan=HOW, tasks=WHEN
  • Status flow: draft -> ready -> in-progress -> to-review -> done -> archived
  • Feature IDs: sequential (001, 002), never reused
  • Research cache: Reusable across features in .specs/research/
  • STATE.md: Populated from persistent storage if available
  • Archive generates: docs/features/{name}.md (no ID)

Error Handling

  • No .specs/: Suggest initialize project first
  • Spec not found: List available features
  • Open questions blocking architecture: Resolve before planning
  • Plan not found: Suggest plan before tasks
  • Tasks not found: Suggest tasks before implement