AgentSkillsCN

technical-implementation

采用基于代理的TDD工作流,结合每项任务的审查与审批关口(可选自动模式),统筹规划的实施。在以下情况下使用此功能:(1) 从docs/workflow/planning/{topic}.md中实施计划;(2) 当用户说“实施”“构建”或“编写代码”且已有计划可用时;(3) 需要遵循TDD与质量标准的临时编码;(4) 修复Bug或开发受益于结构化实施的功能。根据每项任务派遣执行者与审查者代理,并在审查通过后提交代码。

SKILL.md
--- frontmatter
name: technical-implementation
description: "Orchestrate implementation of plans using agent-based TDD workflow with per-task review and approval gate (auto mode available). Use when: (1) Implementing a plan from docs/workflow/planning/{topic}.md, (2) User says 'implement', 'build', or 'code this' with a plan available, (3) Ad hoc coding that should follow TDD and quality standards, (4) Bug fixes or features benefiting from structured implementation. Dispatches executor and reviewer agents per task, commits after review approval."
user-invocable: false

Technical Implementation

Orchestrate implementation by dispatching executor and reviewer agents per task. Each agent invocation starts fresh — flat context, no accumulated state.

  • Executor (../../agents/implementation-task-executor.md) — implements one task via strict TDD
  • Reviewer (../../agents/implementation-task-reviewer.md) — independently verifies the task (opus)

The orchestrator owns: plan reading, task extraction, agent invocation, git operations, tracking, task gates.

Purpose in the Workflow

This skill can be used:

  • Sequentially: To execute a plan created by technical-planning
  • Standalone (Contract entry): To execute any plan that follows plan-format conventions

Either way: dispatch agents per task — executor implements via TDD, reviewer verifies independently.

What This Skill Needs

  • Plan content (required) - Phases, tasks, and acceptance criteria to execute
  • Plan format (required) - How to parse tasks (from plan frontmatter)
  • Specification content (optional) - For context when task rationale is unclear
  • Environment setup (optional) - First-time setup instructions

Before proceeding, verify all required inputs are available and unambiguous. If anything is missing or unclear, STOP — do not proceed until resolved.

  • No plan provided? "I need an implementation plan to execute. Could you point me to the plan file (e.g., docs/workflow/planning/{topic}.md)?"

  • Plan has no format field in frontmatter? "The plan at {path} doesn't specify an output format in its frontmatter. Which format does this plan use?"

  • Plan status is not concluded? "The plan at {path} has status '{status}' — it hasn't completed the review process. Should I proceed anyway, or should the plan be reviewed first?"

If no specification is available, the plan becomes the sole authority for design decisions.


Resuming After Context Refresh

Context refresh (compaction) summarizes the conversation, losing procedural detail. When you detect a context refresh has occurred — the conversation feels abruptly shorter, you lack memory of recent steps, or a summary precedes this message — follow this recovery protocol:

  1. Re-read this skill file completely. Do not rely on your summary of it. The full process, steps, and rules must be reloaded.
  2. Check task progress in the plan — use the plan adapter's instructions to read the plan's current state. Also read the implementation tracking file and any other working documents for additional context.
  3. Check task_gate_mode, fix_gate_mode, fix_attempts, and analysis_cycle in the tracking file — if gates are auto, the user previously opted out. If fix_attempts > 0, you're mid-fix-loop for the current task. If analysis_cycle > 0, you've completed analysis cycles — check for findings files on disk (analysis-*-c{cycle-number}.md in {topic}/) to determine mid-analysis state.
  4. Check git state. Run git status and git log --oneline -10 to see recent commits. Commit messages follow a conventional pattern that reveals what was completed.
  5. Announce your position to the user before continuing: what step you believe you're at, what's been completed, and what comes next. Wait for confirmation.

Do not guess at progress or continue from memory. The files on disk and git history are authoritative — your recollection is not.


Orchestrator Hard Rules

  1. No autonomous decisions on spec deviations — when the executor reports a blocker or spec deviation, present to user and STOP. Never resolve on the user's behalf.
  2. All git operations are the orchestrator's responsibility — agents never commit, stage, or interact with git.

Output Formatting

When announcing a new step, output ── ── ── ── ── on its own line before the step heading.


Step 1: Environment Setup

Run setup commands EXACTLY as written, one step at a time. Do NOT modify commands based on other project documentation (CLAUDE.md, etc.). Do NOT parallelize steps — execute each command sequentially. Complete ALL setup steps before proceeding.

Load environment-setup.md and follow its instructions.

If docs/workflow/environment-setup.md states "No special setup required"

→ Proceed to Step 2.

If setup instructions exist

Follow them. Complete ALL steps before proceeding.

→ Proceed to Step 2.

If no setup file exists

Ask:

"No environment setup document found. Are there any setup instructions I should follow before implementing?"

STOP. Wait for user response.

Save their instructions to docs/workflow/environment-setup.md (or "No special setup required." if none needed). Commit.

→ Proceed to Step 2.


Step 2: Read Plan + Load Plan Adapter

  1. Read the plan from the provided location (typically docs/workflow/planning/{topic}.md)
  2. Plans can be stored in various formats. The format field in the plan's frontmatter identifies which format this plan uses.
  3. Load the format's per-concern adapter files from ../technical-planning/references/output-formats/{format}/:
    • reading.md — how to read tasks from the plan
    • updating.md — how to write progress to the plan
  4. If no format field exists, ask the user which format the plan uses.
  5. These adapter files apply during Step 6 (task loop) and Step 7 (analysis).
  6. Also load the format's authoring.md adapter — needed in Step 7 if analysis tasks are created.

→ Proceed to Step 3.


Step 3: Initialize Implementation Tracking

If docs/workflow/implementation/{topic}/tracking.md already exists

Reset task_gate_mode and fix_gate_mode to gated, fix_attempts to 0, and analysis_cycle to 0 (fresh session = fresh gates/cycles).

→ Proceed to Step 4.

If no tracking file exists

Create docs/workflow/implementation/{topic}/tracking.md:

yaml
---
topic: {topic}
plan: ../../planning/{topic}.md
format: {format from plan}
status: in-progress
task_gate_mode: gated
fix_gate_mode: gated
fix_attempts: 0
linters: []
analysis_cycle: 0
project_skills: []
current_phase: 1
current_task: ~
completed_phases: []
completed_tasks: []
started: YYYY-MM-DD  # Use today's actual date
updated: YYYY-MM-DD  # Use today's actual date
completed: ~
---

# Implementation: {Topic Name}

Implementation started.

Commit: impl({topic}): start implementation

→ Proceed to Step 4.


Step 4: Project Skills Discovery

If project_skills is populated in the tracking file

Present the existing configuration for confirmation:

Output the next fenced block as markdown (not a code block):

code
Previous session used these project skills:
- `{skill-name}` — {path}
- ...

· · · · · · · · · · · ·
- **`y`/`yes`** — Keep these, proceed
- **`c`/`change`** — Re-discover and choose skills
· · · · · · · · · · · ·

STOP. Wait for user choice.

  • yes: → Proceed to Step 5.
  • change: Clear project_skills and fall through to discovery below.

If .claude/skills/ does not exist or is empty

Output the next fenced block as a code block:

code
No project skills found. Proceeding without project-specific conventions.

→ Proceed to Step 5.

If project skills exist

Scan .claude/skills/ for project-specific skill directories. Present findings:

Output the next fenced block as markdown (not a code block):

code
Found these project skills that may be relevant to implementation:
- `{skill-name}` — {brief description}
- `{skill-name}` — {brief description}
- ...

· · · · · · · · · · · ·
- **`a`/`all`** — Use all listed skills
- **`n`/`none`** — Skip project skills
- **Or list the ones you want** — e.g. "golang-pro, react-patterns"
· · · · · · · · · · · ·

STOP. Wait for user to confirm which skills are relevant.

Store the selected skill paths in the tracking file.

→ Proceed to Step 5.


Step 5: Linter Discovery

Load linter-setup.md and follow its discovery process to identify project linters.

If linters is already populated in the tracking file, present the existing configuration for confirmation (same pattern as project skills in Step 4). If confirmed, skip discovery and proceed.

Otherwise, present discovery findings to the user:

Output the next fenced block as markdown (not a code block):

code
**Linter discovery:**
- {tool} — `{command}` (installed / not installed)
- ...

Recommendations: {any suggested tools with install commands}

· · · · · · · · · · · ·
- **`y`/`yes`** — Approve these linter commands
- **`c`/`change`** — Modify the linter list
- **`s`/`skip`** — Skip linter setup (no linting during TDD)
· · · · · · · · · · · ·

STOP. Wait for user choice.

  • yes: Store the approved linter commands in the tracking file.
  • change: Adjust based on user input, re-present for confirmation.
  • skip: Store empty linters array.

→ Proceed to Step 6.


Step 6: Task Loop

Load steps/task-loop.md and follow its instructions as written.

After the loop completes:

→ If the task loop exited early (user chose stop), proceed to Step 8.

→ Otherwise, proceed to Step 7.


Step 7: Analysis Loop

Load steps/analysis-loop.md and follow its instructions as written.

→ If new tasks were created in the plan, return to Step 6.

→ If no tasks were created, proceed to Step 8.


Step 8: Mark Implementation Complete

Update the tracking file (docs/workflow/implementation/{topic}/tracking.md):

  • Set status: completed
  • Set completed: YYYY-MM-DD (use today's actual date)
  • Update updated date

Commit: impl({topic}): complete implementation


References