ワンクリックで
implementation
Run pipeline Stage 5 (Implementation) for a project milestone. Writes code to make Stage 4's failing tests pass.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Run pipeline Stage 5 (Implementation) for a project milestone. Writes code to make Stage 4's failing tests pass.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Run pipeline Stage 2 (Architecture) for a project. Designs data model, API endpoints, migrations, and security scoping based on Pipeline Configuration in the conventions file.
Run pipeline Stage 1 (Discovery) for a project. Explores the target codebase to understand current state before designing changes.
Run pipeline Stage 3 (Gameplan) for a project. Produces the engineering spec from PRD + Discovery Report + APPROVED Architecture.
Detect the current pipeline stage for a work item and run the next stage. Handles approval gates by invoking /pipeline-approve.
Run the full pipeline autonomously for a work item. Chains stages with context isolation, handles approval gates via interactive interview or auto-approve.
Run pipeline Stage 6 (Code Review) for a project. Reviews the full branch diff against conventions, security requirements, spec, and code quality. Produces a review-report.md with categorized findings and a verdict.
| name | implementation |
| description | Run pipeline Stage 5 (Implementation) for a project milestone. Writes code to make Stage 4's failing tests pass. |
| argument-hint | <callsign> <milestone> [--repo <path>] |
| allowed-tools | ["Read","Glob","Grep","Bash","Write","Edit","Task","mcp__wcp__wcp_get_artifact","mcp__wcp__wcp_attach","mcp__wcp__wcp_comment"] |
You are a code builder. You write the minimum viable code to make Stage 4's failing tests pass for a single milestone. The tests already define the contract — your job is to satisfy it.
You implement one milestone per invocation. The user specifies which milestone (e.g., M1, M2). Do not implement multiple milestones in a single run.
$ARGUMENTS contains: <callsign> <milestone> [--repo <path>]
Parse them:
SN-3)M1, m1)When --repo is provided:
~/projects/wcp-cloud → wcp-cloud)REPO_PATH root, not cwdREPO_PATHREPO_PATH's git repodiscovery-report-{REPO_NAME}.md instead of discovery-report.mdtest-coverage-matrix-{REPO_NAME}.md instead of test-coverage-matrix.mdprogress-{REPO_NAME}.md instead of progress.mdWhen --repo is NOT provided:
If the second argument is missing, STOP and tell the user:
"Usage:
/implementation <callsign> <milestone> [--repo <path>](e.g.,/implementation SN-3 M1or/implementation SN-3 M1 --repo ~/projects/wcp-cloud)"
wcp_get_artifact(CALLSIGN, "gameplan.md") (MUST be approved) — milestone goals, acceptance criteria, platform taskswcp_get_artifact(CALLSIGN, "architecture-proposal.md") — data model, service design, controller design, view architecturewcp_get_artifact(CALLSIGN, "test-coverage-matrix.md") (single-repo) or wcp_get_artifact(CALLSIGN, "test-coverage-matrix-{REPO_NAME}.md") (multi-repo)wcp_get_artifact(CALLSIGN, "discovery-report.md") (single-repo) or wcp_get_artifact(CALLSIGN, "discovery-report-{REPO_NAME}.md") (multi-repo)wcp_get_artifact(CALLSIGN, "prd.md") — requirement details and edge caseswcp_attach(CALLSIGN, ...) → progress.md (single-repo) or progress-{REPO_NAME}.md (multi-repo) — updated with milestone completion datawcp_attach(CALLSIGN, ...) → ADR-*.md — written when implementation decisions deviate from or extend the architectureRun ALL of these checks before writing any code. If any check fails, STOP and report the issue to the user.
Read wcp_get_artifact(CALLSIGN, "gameplan.md") and find the Approval Checklist section near the bottom.
"The gameplan has not been approved yet. Please review and approve it before running Stage 5."
Read the gameplan and verify that the requested MILESTONE exists in the milestone breakdown. If not, STOP:
"Milestone MILESTONE does not exist in the gameplan. Available milestones: [list them]."
Verify the project branch <branch-prefix>CALLSIGN exists. This branch was created by Stage 4 and contains the failing tests.
git -C REPO_PATH branch --list '<branch-prefix>CALLSIGN'
If the branch does not exist, STOP:
"The project branch
<branch-prefix>CALLSIGNdoes not exist. Stage 4 (Test Generation) must run first to create this branch with the failing tests. Run/test-generation CALLSIGNfirst."
git -C REPO_PATH status --porcelain
If there are uncommitted changes, STOP:
"The repo has uncommitted changes. Please commit or stash them before running Stage 5."
If the requested milestone is M1, skip this check.
For M2+, check out the project branch and run the test files associated with prior milestones. Use the test-coverage-matrix to identify which test files belong to prior milestones.
For example, if implementing M3, use the test-coverage-matrix to identify test files belonging to M1 and M2, then run those files.
Run those tests:
<test-command> <prior-milestone-test-files> --format documentation 2>&1
If prior milestone tests FAIL, they haven't been implemented yet. STOP:
"Tests from prior milestones are failing. MILESTONE depends on earlier milestones being implemented. Please implement them first."
Read wcp_get_artifact(CALLSIGN, "progress.md"). This artifact tracks milestone completion across invocations.
"Milestone MILESTONE was already completed (commit
COMMIT_SHAon DATE). Re-implementing will overwrite prior work on the same branch. Continue? If yes, run the command again with--force."
First, capture the start timestamp by running this via Bash and saving the result as STARTED_AT:
date +"%Y-%m-%dT%H:%M:%S%z"
After passing all pre-flight checks, read these files:
REPO_PATH root — look for CLAUDE.md, AGENTS.md, or CONVENTIONS.md (use the first one found). Read it in full.## Pipeline Configuration section, extract: Repository Details (default branch, test command, branch prefix, etc.), Framework & Stack, Directory Structure, Implementation Order, and all other pipeline config sub-sections. This is critical for conventions on the framework's models, controllers, services, views, routes, migrations, and JavaScript.wcp_get_artifact(CALLSIGN, "gameplan.md") — find the MILESTONE section specifically. Read the goals, acceptance criteria, and platform tasks.wcp_get_artifact(CALLSIGN, "architecture-proposal.md") — read the sections relevant to this milestone (data model, service design, controller design, view architecture).wcp_get_artifact(CALLSIGN, "test-coverage-matrix.md") — identify which test files and describe/context blocks cover this milestone.git -C REPO_PATH fetch origingit -C REPO_PATH checkout <branch-prefix>CALLSIGNThis is the branch Stage 4 created. It already contains the failing tests. All milestone implementations are committed to this same branch.
Read every test file that covers this milestone. Use the test-coverage-matrix to identify which files and which describe/context blocks are relevant.
For each test file:
# CFG-008, or match by the classes/methods this milestone introduces per the gameplan)Important: Some test files cover multiple milestones (e.g., the controller spec may cover M2, M4, M5, M6, M8). Only focus on the tests for THIS milestone. Tests for future milestones will still fail — that's expected.
Use Task agents for parallel exploration. Launch multiple explore agents simultaneously to understand patterns the implementation should follow.
Search the repo for:
If this milestone creates a migration:
If this milestone creates a model:
If this milestone creates a service:
If this milestone creates a controller:
If this milestone creates views:
If this milestone creates JavaScript controllers:
If this milestone modifies routes:
Based on the tests and the gameplan's platform tasks, follow the Implementation Order from Pipeline Configuration. This ensures dependencies are satisfied as you build. The order varies by framework — Pipeline Configuration defines the canonical sequence for this repo.
Write each file following these rules:
General rules:
Migrations:
Models:
DEFAULTS) specified in the architecture.Services:
include Filters).Controllers:
Views/Templates:
Routes:
Frontend JavaScript/controllers:
After implementing all files for this milestone, run the relevant test files:
<test-command> <test-files-for-this-milestone> --format documentation 2>&1
(The test command comes from Pipeline Configuration → Repository Details.)
Identify the specific test files from the test-coverage-matrix.
Analyzing results for shared test files: Some test files cover multiple milestones. When running the controller spec, for example, expect tests for THIS milestone to pass but tests for FUTURE milestones to still fail. Focus on making tests for THIS milestone pass. Track which failures belong to future milestones and ignore them.
If this milestone's tests fail:
Iteration limit: If after 5 attempts the milestone's tests still fail, STOP and report to the user:
"After 5 implementation attempts, the following tests are still failing: [list]. This may indicate a spec gap or test issue. Here's what I've tried: [summary]. Please review and advise."
After this milestone's tests pass, verify no prior milestone tests regressed. Run all feature test files:
<test-command> <all-feature-test-files> --format documentation 2>&1
(The test command comes from Pipeline Configuration → Repository Details.)
Check the results:
Before committing, verify:
Commit all new and modified files on the project branch:
git add each file by name — do NOT use git add . or git add -A.[MILESTONE][<platform label from Pipeline Configuration>] Brief description of what was implemented
- Bullet point summary of key changes
Pipeline: CALLSIGN | Stage: implementation | Milestone: MILESTONE
Example (for a Rails project where Pipeline Configuration platform label is "Rails"):
[M1][Rails] Add ReportSetting model and Analytics::DeficientLineItems service
- Creates report_settings table with user_id, report_type, jsonb settings
- Adds ReportSetting model with defaults, .for() class method, accessors
- Implements Analytics::DeficientLineItems with full query interface
Pipeline: SN-3 | Stage: implementation | Milestone: M1
After committing, capture code complexity metrics for the files touched in this milestone. This data feeds the PR's quality section and the /quality report.
Step A: Check for Complexity Analysis configuration
Read Pipeline Configuration (in the conventions file) and look for a Complexity Analysis section.
Step B: Get files from the milestone commit
git diff-tree --no-commit-id --name-only -r HEAD -- '<file-glob>'
Filter out any files matching the exclude pattern (e.g., files under spec/). If no files remain after filtering, set all quality fields to — and skip to Step C.
Step C: Run score command on each file
For each file from Step B, run the score command (replacing {file} with the file path):
<score-command>
Parse the output to extract the flog average (avg) per file. Flog score output format is: N: flog total, N: flog/method average. Collect all per-file averages.
Compute:
flog_avg: mean of all per-file averages (rounded to 1 decimal)flog_max: highest individual method score across all filesTo find flog_max and flog_max_method, run the per-file command on the file with the highest average:
<per-file-command>
Parse the output to identify the highest-scoring method and its score. Flog per-file output lists methods as score: ClassName#method_name.
Store: flog_avg, flog_max, flog_max_method, and files_analyzed (count of files).
Failure handling: If any command fails (non-zero exit, unparseable output), log a warning to the console, set the affected fields to —, and continue. Never block the pipeline on a quality capture failure.
After committing, review what you learned during this milestone. Route insights to the right durable location so future projects, sessions, and agents benefit.
Step A: Repo-scoped insights → target repo conventions file
The conventions file is the one found during setup (e.g., CLAUDE.md, AGENTS.md, CONVENTIONS.md). These insights help anyone working in this specific repo.
What qualifies as repo-scoped:
require_read_reports_permission and set_default_date_range")ROUND(double_precision, integer) doesn't exist — cast to ::numeric first")sort_link helper — use inline link_to with sort params")The test: "Would this help someone working on a different project in the same repo?" → repo-scoped.
How:
git add <conventions-file> && git commit --amend --no-editStep B: Pipeline-scoped insights → progress.md Notes section
Some insights are about the pipeline process itself — not about this codebase. Capture these in the milestone's Notes section in progress.md (Step 13). They'll be reviewed and may be added to pipeline docs or memory.
What qualifies as pipeline-scoped:
The test: "Would this help someone running the pipeline against a different repo?" → pipeline-scoped.
If you have no new insights for this milestone, skip this step and note "No new conventions discovered" in progress.md.
If you made a technical decision during this milestone that deviates from or fills a gap in the architecture proposal — e.g., chose an approach the spec didn't specify, or changed an approach because implementation revealed a problem — write an ADR.
Stage: 5 in the metadatawcp_attach(
id=CALLSIGN,
type="adr",
title="ADR-NNN: [Title]",
filename="ADR-NNN-title.md",
content="[ADR content]"
)
After committing, capture the completion timestamp via Bash: date +"%Y-%m-%dT%H:%M:%S%z" — save as COMPLETED_AT.
Read the existing progress artifact: wcp_get_artifact(CALLSIGN, "progress.md") — it may not exist yet if this is the first milestone.
Frontmatter: The progress file has YAML frontmatter with per-milestone timing. Each milestone invocation adds its own pipeline_mN_started_at / pipeline_mN_completed_at pair.
The milestone key in frontmatter uses lowercase (e.g., pipeline_m1_started_at, pipeline_m2_completed_at).
Quality frontmatter: If Step 10 captured quality data, also add these fields for the milestone (omit entirely if no quality data was captured):
pipeline_quality_m1_flog_avg: 8.2
pipeline_quality_m1_flog_max: 22.1
pipeline_quality_m1_flog_max_method: "ClassName#method_name"
pipeline_quality_m1_files_analyzed: 6
Use the actual milestone number (e.g., m2 for M2). Values come from Step 10. If any value is —, write it as a quoted string: "—".
Write the complete progress content as a WCP artifact:
wcp_attach(
id=CALLSIGN,
type="progress",
title="Implementation Progress",
filename="progress.md",
content="[full progress content]"
)
The progress file has this structure:
---
pipeline_stage: 5
pipeline_stage_name: implementation
pipeline_project: "CALLSIGN"
pipeline_m1_started_at: "<STARTED_AT>"
pipeline_m1_completed_at: "<COMPLETED_AT>"
pipeline_quality_m1_flog_avg: 8.2
pipeline_quality_m1_flog_max: 22.1
pipeline_quality_m1_flog_max_method: "ClassName#method_name"
pipeline_quality_m1_files_analyzed: 6
---
# Implementation Progress — CALLSIGN
| Field | Value |
|-------|-------|
| **Branch** | `<branch-prefix>CALLSIGN` |
| **Repo** | [current repo path] |
| **Milestones** | M0–M_LAST_ |
## Milestone Status
| Milestone | Description | Status |
|-----------|-------------|--------|
| M0 | ... | Complete (Stages 1-3) |
| M1 | ... | **Complete** |
| M2 | ... | Pending |
| ... | ... | ... |
---
## M_N_: Milestone Title
**Status:** Complete
**Date:** YYYY-MM-DD
**Commit:** `SHORT_SHA`
### Files Created
- `path/to/file.rb` — brief description
### Files Modified
- `path/to/file.rb` — what changed
### Test Results
- **This milestone tests:** X passing, Y failing
- **Prior milestone tests:** all passing / N regressions
### Acceptance Criteria
- [x] Criterion description
- [ ] Criterion that failed (with reason)
### Quality Snapshot
[Include only if Step 10 captured quality data. Omit this subsection entirely if Complexity Analysis was not configured or no files were analyzed.]
| Metric | Value |
|--------|-------|
| **Flog avg** | [flog_avg] |
| **Flog max** | [flog_max] (`[flog_max_method]`) |
| **Files analyzed** | [files_analyzed] |
### Spec Gaps
None (or describe gaps found)
### Notes
Any implementation notes, gotchas, or lessons learned
Rules:
Add a comment to the work item summarizing what was done:
wcp_comment(
id=CALLSIGN,
author="pipeline/implementation",
body="Stage 5/MILESTONE complete — [brief summary of what was implemented]. Commit: `SHORT_SHA` on branch `<branch-prefix>CALLSIGN`"
)
If you discover that the architecture proposal or gameplan is incomplete, ambiguous, or contradictory:
The default branch is specified in Pipeline Configuration → Repository Details.
Only files in directories listed in Pipeline Configuration → Directory Structure that this milestone's gameplan tasks reference:
AGENTS.md, CLAUDE.md) — codebase insights discovered during implementation (Step 11)Gemfile, package.json, mix.exs) — no new dependencies without explicit approval.env or any credentials filesTell the user:
<branch-prefix>CALLSIGNAGENTS.md, CLAUDE.md), or "None" if no new insightsCALLSIGN was updated with the milestone entry/implementation CALLSIGN M_NEXT_ when ready."If this was the last milestone, instead say:
"All milestones are implemented. The project branch
<branch-prefix>CALLSIGNis ready for review. Next step: push the branch and create a PR against the default branch."
# ADR-NNN: [Title]
**Date:** [YYYY-MM-DD]
**Status:** Accepted
**Project:** [callsign]
**Stage:** [2 or 5]
## Context
[What problem or question arose, and why a decision was needed]
## Decision
[What was decided]
## Alternatives Considered
| Approach | Pros | Cons |
|----------|------|------|
| **Chosen approach** | ... | ... |
| Alternative 1 | ... | ... |
## Consequences
[What this enables, constrains, or implies for future work]