diff --git a/.agents/skills/sdd/SKILL.md b/.agents/skills/sdd/SKILL.md new file mode 100644 index 0000000..1f3ebe9 --- /dev/null +++ b/.agents/skills/sdd/SKILL.md @@ -0,0 +1,293 @@ +--- +name: sdd +version: 1.5.0 +description: > + Spec-driven development pipeline with 6 phases: Explore, Requirements, + Design, Task Plan, Implementation, Review. Enforces human approval gates + between phases. Also provides a standalone documentation workflow for + generating or updating project docs without starting a feature pipeline. + Use when user wants structured feature development, spec-first approach, + or says "I want to add feature X", "new feature", "implement", "build", + "generate documentation", "update docs", "actualize the documentation". + Keywords: spec, requirements, design document, TDD plan, task plan, + implementation, code review, pipeline, approval gates, WHEN/SHALL, + generate docs, update docs, documentation queue. +--- + +# Spec-Driven Development + +You are operating in **spec-driven development mode**. +This project uses a 6-phase pipeline with human approval gates between each phase. + +## Pipeline + +``` +Explore → [APPROVE] → Requirements → [APPROVE] → Design → [APPROVE] → Task Plan → [APPROVE] → Implementation → [APPROVE] → Review → [APPROVE] → Done +``` + +Each phase has a dedicated prompt template. Read the template for the **current** phase before generating any output. + +## Quick Reference + +### Core Commands + +| Action | Command | +|--------|---------| +| Check state | `sh ./scripts/pipeline.sh status` | +| Start feature | `sh ./scripts/pipeline.sh init ` | +| Register output | `sh ./scripts/pipeline.sh artifact [path]` | +| Advance phase | `sh ./scripts/pipeline.sh approve` (only after user says "approve") | +| Mark task done | `sh ./scripts/pipeline.sh task T-N` (implementation phase only) | +| Multi-feature | Add `--feature ` before any command | + +### Decision Points + +At these moments, **ask the user** before running a command: + +#### Starting a feature (`init`) + +If config has `auto_branch: true` or `auto_worktree: true` → use the config default silently. +Otherwise, ASK: *"Create a separate branch for this feature? (branch / worktree / no)"* + +| User answer | Command | +|------------|--------| +| "branch" | `pipeline.sh init --branch ` | +| "worktree" | `pipeline.sh init --worktree ` | +| "no" / "нет" | `pipeline.sh init ` | + +#### Finishing a feature (`finish`) + +After pipeline reaches `done` and docs maintenance is handled, ASK: *"What to do with the branch? (merge / PR / keep / discard)"* + +| User answer | Command | +|------------|--------| +| "merge" | `pipeline.sh finish merge` | +| "PR" / "pull request" | `pipeline.sh finish pr` | +| "keep" / "оставить" | `pipeline.sh finish keep` | +| "discard" / "удалить" | `pipeline.sh finish discard --confirm` | +| On default branch / no git | `pipeline.sh finish keep` (auto, no question) | + +#### Documentation updates + +When `docs-check` reports issues, ASK the user (already described in Pre-flight Checklist step 3). + +| User answer | Command | +|------------|--------| +| "generate docs" | `pipeline.sh docs-init --all` | +| "update docs" | `pipeline.sh docs-init --update` | +| "skip" / "пропустить" | (no command) | + +**Hard rules:** check status first · never skip phases · never auto-approve · save artifacts to `.spec/features//` · max 3 revisions then ask user + +**Config:** `.spec/config.yaml` → `context`, `rules.`, `test_skill`, `test_reference`, `docs_dir`, `auto_branch`, `branch_prefix`, `auto_worktree`, `worktree_dir` + +**Phase flow:** read template → generate artifact → save → `artifact` → present → wait for "approve" → `approve` + +## Phases + +| # | Phase | Template | Produces | +|---|----------------|---------------------------------|---------------------------------| +| 1 | Explore | `./templates/explore.md` | Exploration & research document | +| 2 | Requirements | `./templates/requirements.md` | Formal requirements document | +| 3 | Design | `./templates/design.md` | Architecture & design document | +| 4 | Task Plan | `./templates/task-plan.md` | TDD implementation plan | +| 5 | Implementation | `./templates/implementation.md` | Implementation report | +| 6 | Review | `./templates/review.md` | Code review document | + +## State Machine + +The pipeline state is managed via a shell script: + +```sh +# Check current phase and progress +sh ./scripts/pipeline.sh status + +# Start a new feature pipeline (see Decision Points for branching options) +sh ./scripts/pipeline.sh init + +# Register the artifact you generated for the current phase +sh ./scripts/pipeline.sh artifact [path] + +# Advance to the next phase (only after user says "approve") +sh ./scripts/pipeline.sh approve + +# View revision history +sh ./scripts/pipeline.sh revisions [phase] + +# View all features and their status +sh ./scripts/pipeline.sh history + +# Mark an implementation task as completed (enables resume) +sh ./scripts/pipeline.sh task + +# Validate config file +sh ./scripts/pipeline.sh config-check + +# Inject a pre-written artifact and skip to that phase +sh ./scripts/pipeline.sh inject + +# Abandon an active pipeline +sh ./scripts/pipeline.sh abandon [feature] +``` + +For standalone documentation workflow commands (`docs-init`, `docs-next`, `docs-done`, `docs-status`, `docs-reset`), see `./templates/docs-maintenance.md`. + +For all available flags and options: `sh ./scripts/pipeline.sh help` + +### Parallel Pipelines + +When multiple features are active simultaneously, add `--feature ` before the command: + +```sh +sh ./scripts/pipeline.sh --feature auth-flow status +sh ./scripts/pipeline.sh --feature payment approve +``` + +Without the flag, the pipeline auto-detects the active feature. If more than one is active, it will error and prompt you to use `--feature`. + +## Project Configuration + +If the file `.spec/config.yaml` exists in the project root, read it before starting any phase. See `.spec/config.yaml.example` for a template with all supported keys. + +> **Format limitation:** the pipeline parser reads flat `key: value` pairs only. Nested YAML structures, multi-line values, and quoted strings are not supported. + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| `context` | string | — | Project-wide background for ALL phases | +| `rules.` | string | — | Phase-specific rules (supplement template) | +| `rules.docs` | string | — | Rules for documentation generation | +| `test_skill` | string | — | Skill name for delegated test generation | +| `test_reference` | string | — | Glob/paths to representative test files | +| `docs_dir` | string | `.spec` | Directory for project documentation | +| `doc_freshness_days` | integer | `30` | Days before a generated doc is stale | +| `auto_branch` | boolean | `false` | Auto-create git branch on `init` | +| `branch_prefix` | string | `feature/` | Prefix for auto-created branches | +| `auto_worktree` | boolean | `false` | Auto-create git worktree on `init` (mutually exclusive with `auto_branch`) | +| `worktree_dir` | string | `.worktrees` | Directory for worktrees (add to `.gitignore`) | + +Phase-specific rule keys: `rules.explore`, `rules.requirements`, `rules.design`, `rules.task-plan`, `rules.implementation`, `rules.review`, `rules.docs`. + +Injection order: **context → phase rules → template instructions.** + +If the file does not exist, skip this step. + +## Standalone Documentation Workflow + +If the user requests documentation generation or update **without referring to a feature** (e.g. *"generate docs"*, *"update documentation"*, *"actualize the docs"*, *"refresh AUTH.md"*) — **do NOT run `pipeline.sh init`**. This is a standalone workflow with its own state machine. + +1. Read `./templates/docs-maintenance.md` § Standalone Documentation Workflow. +2. Run `pipeline.sh docs-init [--all|--update|