# 0021 — Implement skills: implement-feature, tdd, refactor, diagnose **Type:** HITL **Parent PRD:** `docs/prd/chunk-3-skills-library.md` ## What to build The 4 implement phase skills. One is new; three are preserved Pocock placeholders upgraded to the authoring standard. All authored via `write-skill` (0018), evals via `write-eval` (0017). `write-docs` has been moved to issue 0018 phase 2. **Skills, origins, and trigger descriptions:** | Flat name | Origin | Trigger description | |---|---|---| | `implement-feature` | New | Implement a feature, build this, write the code for X | | `tdd` | Preserved; frontmatter + standard added | TDD, test-driven, red-green-refactor | | `refactor` | New | Refactor this code, improve structure, clean up | | `diagnose` | Preserved; frontmatter + standard added | Diagnose this, what's wrong with X, debug this | **Key constraints per skill:** - `implement-feature`: must start from a linked issue with an EARS spec (checks `docs/issues/` in the file-based phase, Gitea MCP when configured); flags if none exists; no unrequested abstractions; updates `docs/spec/` as part of implementation if behaviour changes; calls `tdd` as its implementation methodology - `tdd`: composable and separate from `implement-feature` so TDD can be used outside full feature implementation; red-green-refactor loop - `refactor`: preserves all existing behaviour; documents what changed and why - `diagnose`: preserved behavior; add frontmatter, authoring standard sections, and dead-reference cleanup ## Implementation notes Follow the per-skill workflow defined in `docs/notes/skill-implementation-workflow.md`. **Known upstream sources to review for this category:** - `mattpocock/skills` — original `tdd` and `diagnose` placeholders; review at current HEAD; record SHAs in `source:` for any adopted content - `bmad-method/bmad-method` — BMAD developer role and implementation patterns; relevant for `implement-feature` and `refactor` For new skills (`implement-feature`, `refactor`, `write-docs`): search for prior art in the above repos before writing from scratch. ## Acceptance criteria - [ ] All 4 SKILL.md files exist at `.agents/skills//SKILL.md`; `metadata.category: implement`; authoring standard met (`write-docs` is in issue 0018 phase 2) - [ ] Dead references removed from Pocock skills (`tdd`, `diagnose`) - [ ] `implement-feature` checks for linked issue with EARS spec before proceeding; calls `tdd` by name - [ ] `source:` fields populated for adopted upstream content - [ ] Each skill has a co-located eval at `.agents/evals/implement//eval.yaml` via `write-eval` - [ ] `install.sh` deploys all 4 to `~/.agents/skills/` - [ ] **HITL:** human runs behavioral test per skill - [ ] **HITL:** human reviews each SKILL.md and eval before committing - [ ] Per-skill process followed for all 4 skills: source discovery (sub-agent) → source review with licence/security check (sub-agent) → conflict check against constitution + factory principles (sub-agent) → synthesis grill → co-write iteratively - [ ] Trigger description for each skill tested against explicit, implicit, and negative queries before body written - [ ] `when:` frontmatter field present in all SKILL.md files - [ ] `source:` and `references:` fields correctly populated or absent - [ ] eval.yaml for each skill contains all 5 required test types - [ ] Body ≤500 lines for each skill - [ ] `write-docs` confirmed removed from scope (implemented in issue 0018 phase 2) - [ ] `docs/spec/overview.md` updated to reflect all 4 skills deployed ## Blocked by - 0016 (per-skill workflow) - 0017 (`write-eval`) - 0018 (`write-skill`)