home / skills / thilinatlm / claude-plugins / specdev

specdev skill

/specdev/skills/specdev

This skill manages multi-session specifications for complex feature development, enabling persistent tracking, structured artifacts, and cross-file progress

npx playbooks add skill thilinatlm/claude-plugins --skill specdev

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
4.8 KB
---
name: specdev
description: Specification-driven development workflow for AI agents. Use when tasks are too large for a single session, require multi-step implementation, span multiple files/features, or need persistent requirements tracking. Provides structured specification management with token-optimized artifacts for complex feature development, brownfield modifications, and cross-session continuity.
---

# Spec-Driven Development

## Overview

A CLI tool for managing structured specifications that persist across sessions, with JSON-first output designed for AI agents.

## Scripts

- Unix/Linux/macOS: `${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev`
- Windows PowerShell: `${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev.ps1`
- Windows Git Bash: Use `specdev` (bash script)

## Commands

### Initialize Specs Directory

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev init
```

Output: `{"ok":true,"created":[".specs/project.md",".specs/active/",".specs/archived/"]}`

### Create New Spec

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev new auth-feature
```

Output: `{"ok":true,"spec":"auth-feature","created":["spec.md","plan.md","tasks.yaml"],"path":".specs/active/auth-feature"}`

### Show Status

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev status
```

Output:
```json
{
  "ok": true,
  "specs": [
    {"name": "auth-feature", "progress": "3/5 (60%)", "phase": "implementation", "nextTask": "T3"}
  ]
}
```

### Get Context

Get current task context for implementation. Levels: `min` (tight context), `standard` (default), `full` (first time/planning).

```bash
# Minimal context (familiar spec)
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev context auth-feature --level min

# Full context (first time on spec)
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev context auth-feature --level full
```

Output (min): `{"ok":true,"spec":"auth-feature","task":{"id":"T3","title":"Add JWT validation","files":["src/auth.ts"]}}`

Output (full): Includes all phases, notes, dependencies, and checkpoint.

### Get Spec Path

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev path auth-feature
```

Output: `{"ok":true,"spec":"auth-feature","path":".specs/active/auth-feature"}`

### Archive Completed Spec

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev archive auth-feature
```

Output: `{"ok":true,"spec":"auth-feature","from":".specs/active/auth-feature","to":".specs/archived/auth-feature"}`

### Validate Spec

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev validate .specs/active/auth-feature
```

Output: `{"ok":true,"valid":true,"files":{"spec.md":true,"plan.md":true,"tasks.yaml":true}}`

### Compact File

Token-optimized version for context loading (~60% reduction).

```bash
${CLAUDE_PLUGIN_ROOT}/specdev-cli/specdev compact .specs/active/auth-feature/tasks.yaml
```

Output: `{"ok":true,"original":1200,"compacted":480,"reduction":"60%","content":"..."}`

## Directory Structure

```
.specs/
├── project.md           # Project conventions, stack
├── active/{spec}/       # Active specifications
│   ├── spec.md          # Requirements (WHAT)
│   ├── plan.md          # Technical approach (HOW)
│   └── tasks.yaml       # Task breakdown (WHEN)
└── archived/{spec}/     # Completed specs
```

## Common Usage Patterns

**Starting a new feature:**
1. `specdev init` - Initialize .specs/ if needed
2. `specdev new {name}` - Create spec structure
3. Edit `spec.md` → `plan.md` → `tasks.yaml`
4. Use `AskUserQuestion` to clarify ambiguities

**Resuming work:**
1. `specdev status` - See all active specs
2. `specdev context {spec} --level min` - Get current task
3. Read files, implement, test
4. Edit tasks.yaml → set `done: true`

**Completing a spec:**
1. `specdev status` - Verify 100% complete
2. `specdev archive {spec}` - Move to archived/

**Brownfield changes:**
- Create `delta.md` showing ADDED/MODIFIED/REMOVED sections
- Reference existing requirements by ID

## Error Responses

All errors follow a consistent JSON format:

```json
{
  "ok": false,
  "error": "Spec not found",
  "code": "SPEC_NOT_FOUND",
  "hint": "Check spec name with 'specdev status'"
}
```

**Error codes:** `SPEC_NOT_FOUND`, `ALREADY_EXISTS`, `NOT_INITIALIZED`, `VALIDATION_FAILED`, `PREREQ_MISSING`

## Hooks (Automatic)

- **SessionStart**: Shows spec context when `.specs/active/` exists
- **PostToolUse**: Validates tasks.yaml after edits
- **Stop**: Reminds to update checkpoint.md

## Tool Integration

| Tool | When |
|------|------|
| `AskUserQuestion` | Clarify requirements, get decisions |
| `Explore` agent | Understand codebase, find patterns |
| `Plan` agent | Design complex implementation approach |

## References

Templates and patterns available in `references/` directory:
- `spec-template.md` - Specification format
- `plan-template.md` - Planning format
- `tasks-template.md` - Task breakdown format
- `patterns.md` - Best practices

Overview

This skill provides a specification-driven development workflow for AI agents, enabling persistent, structured specs that survive across sessions. It focuses on JSON-first artifacts and token-optimized outputs so agents can implement multi-step features, coordinate cross-file changes, and track progress reliably. Use it to manage complex features, brownfield modifications, and long-running requirements.

How this skill works

The tool creates and maintains a .specs directory with spec.md (requirements), plan.md (technical approach), and tasks.yaml (task breakdown). CLI commands initialize specs, create new specs, show status, return context at different verbosity levels, validate and compact files, and archive completed work. Outputs are JSON-formatted for easy agent consumption and include error codes and hints for consistent automation.

When to use it

  • When a task is too large for a single agent session or chat turn.
  • When work spans multiple files, features, or engineers and needs persisted requirements.
  • When implementing brownfield changes that require deltas (added/modified/removed).
  • When you need token-optimized context for LLM-based agents to reduce cost and improve focus.
  • When formal progress tracking and archival of completed specs is required.

Best practices

  • Start each feature with specdev init, specdev new {name}, then fill spec.md → plan.md → tasks.yaml.
  • Use context levels: min for focused implementation, standard for normal work, full for onboarding or planning sessions.
  • Compact large files before feeding them to agents to reduce token usage (~60% typical reduction).
  • Keep tasks.yaml task IDs and done flags authoritative for progress reporting and automation hooks.
  • Create delta.md for brownfield work and reference requirement IDs to avoid ambiguity.

Example use cases

  • New feature development: create spec, draft plan, break work into tasks, iterate across sessions.
  • Cross-file refactor: document intended changes in delta.md, use tasks.yaml to sequence modifications and tests.
  • Long-lived features: persist requirements and checkpoints across days or sprints, resume with context --level min.
  • Agent-driven implementation: call context to get current task, run Explore/Plan agents, validate tasks.yaml after edits.
  • Archival and compliance: validate and archive completed specs for audit or knowledge reuse.

FAQ

How do I get the current task for an agent?

Use specdev context {spec} --level {min|standard|full}. Min returns tight task context; full returns complete spec and checkpoint.

How can I reduce tokens when loading specs into an LLM?

Run specdev compact on large files to produce token-optimized content (typical ~60% reduction) before sending to an agent.