shape-implement
Implement technical plans from context/changes/<change-id>/plan.md with verification
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implement technical plans from context/changes/<change-id>/plan.md with verification
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Self-evaluation loop for the treadmill Claude plugins pack. Runs cursor-plugin-evals against bundled skills, tracks quality over time, and escalates recurring failures via PAMS. Use periodically or before publishing plugin updates.
Autonomously implement technical plans from context/changes/<change-id>/plan.md under Codex's /goal — no human interaction at any point. Sibling of /shape-implement for unattended runs, in an interactive /goal session or headless via Codex -p. Flips the plan's Automated Progress rows, verifies each phase through an automatic quality-gate stack (plan success criteria, deliberate-break check, full suite), commits each phase on green with Conventional Commits, and surfaces pending Manual rows as a closing human checklist. Use when the user wants autonomous or unattended plan execution, pairs /goal with a plan, asks to "run the plan under /goal", or needs headless implementation.
Review implementation against plan for drift, dangerous decisions, and pattern compliance
Review implementation plans for substance, feasibility, and architectural fitness. Use when user asks to review a plan, says "is this plan good", "check my plan", "review this plan", mentions plan review, or references a plan file and asks for feedback. Also trigger when user finishes /shape-plan and wants validation before starting /shape-implement.
Drive an approved implementation plan to completion phase by phase, test-first, through the red→green→refactor cycle, but only for phases whose implementation does not exist yet. Reads a plan from context/changes/<change-id>/plan.md and the canonical Progress section, and for each phase first checks whether the phase is TDD'able and still unimplemented — if it is, you write a failing test (RED), make it pass with the minimal code (GREEN), then clean up (REFACTOR); if it is not TDD'able, you redirect that phase to /shape-implement; if implementation is already present, you stop and explain that TDD does not work for already existing code, then suggest /shape-implement for that phase. Mirrors /shape-implement (same plan, same Progress source of truth, same phase-end commit ritual and clipboard handoffs) but flips the order so the failing test always comes before the code. Assumes test infrastructure is already in place — it does NOT set up runners, configs, fixtures, or CI. Use this skill when the user says "td
Run implementation review non-interactively in CI against a PR: discovers the plan, checks drift/safety/patterns/test coverage, writes context/changes/<change-id>/reviews/impl-review.md, commits it to the PR branch, and posts a summary comment. Use whenever the request mentions CI, GitHub Actions, GHA, Codex Action, automated PR review, or "review this PR in CI".
| name | shape-implement |
| description | Implement technical plans from context/changes/<change-id>/plan.md with verification |
| allowed-tools | ["Read","Glob","Grep","Write","Edit","Bash","Task","AskUserQuestion","TaskCreate","TaskUpdate","TaskList","TaskGet"] |
You are tasked with implementing an approved technical plan from context/changes/<change-id>/plan.md. These plans contain phases with specific changes and a canonical ## Progress section at the bottom that drives execution state (see references/progress-format.md).
When this command is invoked:
/shape-implement <change-id> [phase N], resolve to context/changes/<change-id>/plan.md.@context/changes/<change-id>/plan.md or a full path, accept it.context/archive/ — print "This change is archived. Open a new change with /shape-new instead." and STOP.I'll help you implement an approved technical plan. Please provide:
1. A change-id (e.g., `/shape-implement oauth-login phase 1`), or
2. A full path (e.g., `@context/changes/oauth-login/plan.md`).
You can list active changes with: `ls context/changes/`
Tip: Make sure the plan has been reviewed and approved before implementation.
When given a plan path:
## Progress section at the bottom is authoritative for execution state — checkmarks (- [x]) live ONLY there. Phase blocks contain plain - bullets (no checkboxes).context/foundation/lessons.md if present and internalize each entry before starting any phase — these are the team's accepted recurring rules and must shape every implementation choice you make in this run.change.md: on entry, set status: implementing (only if currently in {planned, plan_reviewed}) and updated: <today>.## Phase N: headers) and create one TaskCreate entry per phase (these appear in the user's status bar):
subject: "Phase N: [Phase Name]" and activeForm: "Implementing Phase N"in_progress via TaskUpdate before starting workcompleted via TaskUpdate when its success criteria pass## Progress section: the first - [ ] line in document order is where you start. If a phase N argument was passed, jump to the first - [ ] inside ### Phase N: instead.Plans are carefully designed, but reality can be messy. Your job is to:
When things don't match the plan exactly, think about why and communicate clearly. The plan is your guide, but your judgment matters too.
If you encounter a mismatch:
STOP and think deeply about why the plan can't be followed
Present the issue clearly as text:
Issue in Phase [N]:
Expected: [what the plan says]
Found: [actual situation]
Why this matters: [explanation]
Then use AskUserQuestion to get a structured decision:
AskUserQuestion:
The phase-end commit ritual (see "Verification Approach" below) stages files from a touched-file set that you maintain in working memory throughout each phase. This set is the canonical input to git add — never fall back to git status heuristics for staging decisions.
Discipline:
Edit or Write on a file during the current phase, add its repo-relative path to the touched-file set.context/changes/<change-id>/plan.md because each phase produces at least one Edit to its ## Progress section. Add it on entry to a phase even before any checkboxes flip.context/changes/<change-id>/ — typically change.md, research.md, plan.md, and any other context files created during planning. These files are part of the change and should land in the first commit rather than being left as untracked stragglers.git status. If the touched set is {a.md, b.md, plan.md} but git status --porcelain also reports c.md dirty, c.md is unrelated — handle it via the dirty-path prompt in the ritual, never silently bundle it into the commit.Before proposing any phase-end or epilogue commit message, scan the conversation context for tracking-system issue or task references tied to this implementation work, including Jira keys (for example ABC-123), Linear issue IDs (for example ENG-123), GitHub issue/PR references (for example #123, GH-123, or full GitHub issue/PR URLs), or explicit task links from Jira, Linear, or GitHub.
Refs: line, preserving the exact identifiers/URLs the user provided where possible.Refs: line.Refs: line to every phase-end commit and to the epilogue commit, unless the user narrows a reference to a specific phase.After implementing a phase:
Run the success criteria checks (usually make check test covers everything)
Fix any issues before proceeding
Update your progress in your todos and in the plan's ## Progress section
Mutate ONLY the ## Progress section. Phase blocks (Overview, Changes Required, Success Criteria) are read-only. Use Edit to flip - [ ] N.M <title> → - [x] N.M <title> in Progress as each step completes. Do NOT edit Phase block bullets, do NOT add HTML comment progress markers at the bottom of the plan, and do NOT write any state-file sidecar.
Run the phase-end commit ritual: After all automated checks pass for the phase, walk through this sequenced ritual to author one Conventional-Commits commit and write the closing short SHA back into every Progress row flipped during the phase.
Manual confirmation gate. Inform the human that automated verification passed and list the manual verification items from the plan. Pause here. Do not proceed until the human confirms manual testing succeeded. Use this format:
Phase [N] Complete - Ready for Manual Verification
Automated verification passed:
- [List automated checks that passed]
Please perform the manual verification steps listed in the plan:
- [List manual verification items from the plan]
Let me know when manual testing is complete so I can proceed to the commit step.
Cross-phase manual rollup (final phase only). Before printing the gate message, determine whether the current phase is the final phase: scan the ## Progress section for ### Phase M: headings and treat the current phase as final iff no heading with M > N exists in document order. If the current phase is not final, the gate message is exactly the format above — no rollup. If the current phase is final, after the "Please perform the manual verification steps listed in the plan:" block, scan the entire Progress section for - [ ] rows that sit under a #### Manual subsection in any phase other than the current one. If any such rows exist, append the following block to the gate message (in document order, one row per line, formatted as <phase>.<index> <title> — strip any - [ ] prefix and any trailing — <sha> suffix):
Pending manual checks from earlier phases:
- [phase.index title]
If no earlier-phase manual rows are pending, omit the rollup block entirely. The gate still pauses for human confirmation; this is informational, not a hard block. Mid-stream phases (any phase that is not the final one) keep the original gate format with no rollup.
Compute the staging set. Take the touched-file set maintained during the phase (see "Tracking files touched during a phase" above) and union it with {context/changes/<change-id>/plan.md}. The plan file is always staged because each phase produces at least one Edit to its ## Progress section.
Detect unrelated dirty paths. Run git status --porcelain and intersect with paths outside the staging set. If the dirty-but-untouched set is non-empty, present the offending paths and use AskUserQuestion:
If the dirty-but-untouched set is empty, skip this step.
Stage explicitly by path. git add each file in the chosen set by name. Do NOT use git add -A or git add . — explicit paths only.
Check empty diff. Run git diff --cached --quiet. Exit code 0 means no staged diff. If empty, print:
Phase [N] had no diff to commit; rows remain SHA-less; archive warn-only will surface them.
Set SHA="" and skip to step 8.
Propose a Conventional-Commits message. Build a subject line in the form <type>(<change-id>): <phase title> (p<N>), where <type> is one of feat / fix / chore / refactor / docs chosen from the phase's nature (e.g., feat for new user-visible behavior, chore for prompt/doc edits, refactor for restructuring without behavior change). The phase title is the meaningful part and leads; the (p<N>) suffix carries the phase index. Build a short body listing the touched files, plus the Refs: line from "Tracking issue/task references for commits" when applicable. Use AskUserQuestion:
Commit via heredoc. Run git commit per the global commit-message protocol:
git commit -m "$(cat <<'EOF'
<type>(<change-id>): <phase title> (p<N>)
<short body listing touched files>
<Refs: issue/task references, if applicable>
Co-Authored-By: Codex Opus 4.7 (1M context) <noreply@anthropic.com>
EOF
)"
Never pass --no-verify, --amend, or signing-bypass flags. If a pre-commit hook fails, fix the underlying issue and create a NEW commit — the original commit did NOT happen, so amending would touch the previous phase's commit instead.
Capture the short SHA. Run git rev-parse --short HEAD and store as SHA. Skip this step if SHA="" was set by step 5.
Write the SHA back into Progress. For every Progress row flipped during this phase, run a targeted Edit:
- [x] N.M <title> (no existing — <sha> suffix at end of line)- [x] N.M <title> — <SHA>Skip rows that already carry a SHA suffix (resume safety: if the ritual is re-entered after a partial run, do not double-append). If SHA="", skip the append entirely — the rows stay SHA-less and /shape-archive will surface them as informational warnings under its missing-SHA soft-warning check.
Update change.md. Set updated: <today>; keep status: implementing (idempotent until the final phase). On the final phase, set status: implemented after the SHA write-back lands (see "After all phases" below).
Reset the touched-file set. Clear it before starting the next phase. The ritual is self-contained per phase.
Next phase decision: If there is a next phase, help the user decide whether to continue or start fresh.
Use AskUserQuestion to present the decision:
AskUserQuestion:
If user chooses to review: Run /shape-impl-review @[path-to-plan] phase [N] to review the just-completed phase. After the review completes, re-present the continue/clear decision (without the review option this time).
If user chooses to continue: Proceed directly to the next phase — read the plan section for the next phase, set the task to in_progress, and implement. No need to re-read the entire plan or already-loaded files.
If user chooses to clear: Copy the resume command to clipboard and display it:
Copy:
echo -n "/shape-implement <change-id> phase [next-phase-number]" | pbcopy 2>/dev/null || echo -n "/shape-implement <change-id> phase [next-phase-number]" | clip.exe 2>/dev/null || echo -n "/shape-implement <change-id> phase [next-phase-number]" | xclip -selection clipboard 2>/dev/null || true
# PowerShell (Windows)
Set-Clipboard "/shape-implement <change-id> phase [next-phase-number]"
Display:
→ /shape-implement <change-id> phase [next-phase-number] (✓ copied)
If instructed to execute multiple phases consecutively, skip the AskUserQuestion between phases.
do not check off items in the manual testing steps until confirmed by the user.
The ## Progress section in plan.md is the single source of truth. No state file. No comment markers. See references/progress-format.md for the format contract.
Use Edit to flip exactly one Progress line at a time:
- [ ] N.M <title>- [x] N.M <title>Do not append the SHA suffix on a per-step Edit — the SHA is written back at phase end by the commit ritual (see "Verification Approach" above), and only the closing commit's SHA goes onto every row that flipped during the phase. Mid-phase, completed rows sit [x] without a SHA suffix; this is a valid intermediate state.
When all - [ ] items inside ### Phase N: are now - [x]:
change.md.updated is bumped as part of step 10 of the ritual.Empty-diff phases (manual-verification-only or no-op adapted phases) commit nothing and leave their rows SHA-less; /shape-archive will surface them as informational warnings under its missing-SHA soft-warning check. This is intentional — not every phase produces code.
When every - [ ] in the entire ## Progress section is now - [x]:
Defensive pending-items surface. Re-scan the entire ## Progress section one last time for any - [ ] rows. Under normal flow this is a no-op — the trigger condition for "After all phases" is already "every - [ ] is - [x]", so the surface should find nothing. It exists to make any unexpected stragglers explicit rather than silently lost (e.g., if a partial run, a manual edit, or a resume path bypassed the trigger). If the count is non-zero, list each row as <phase>.<index> <title> grouped by Automated vs Manual subsection in document order, then ask via AskUserQuestion:
On "Pause": STOP immediately. Do NOT update change.md, do NOT run the epilogue commit. On "Proceed to epilogue": continue with steps 2–4 below. If the count is zero, skip this step and continue.
Update change.md: set status: implemented, updated: <today>. (Do NOT set archived_at — that belongs to /shape-archive.)
Do NOT write any HTML comment progress marker at the bottom of the plan.
Run the epilogue commit. The final phase's commit cannot contain its own SHA (chicken-and-egg), so the SHA write-back into the final phase's Progress rows plus the change.md status flip both sit dirty in the working tree after the final phase ritual returns. Author one closing commit to land them — otherwise /shape-archive's hard-refusal gate (uncommitted paths inside the change folder) will block. Steps:
context/changes/<change-id>/plan.md and context/changes/<change-id>/change.md (explicit paths, no git add -A).git diff --cached --quiet; if exit code 0, skip the epilogue (nothing trailing to commit) and stop here.chore(<change-id>): close out plan (epilogue) with a short body noting the plan's final SHA write-back + change.md → implemented, plus the Refs: line from "Tracking issue/task references for commits" when applicable. Use AskUserQuestion to approve as proposed / edit subject / override entirely (same options as the phase ritual).Co-Authored-By: Codex Opus 4.7 (1M context) <noreply@anthropic.com> trailer; never --no-verify / --amend).Parse the ## Progress section. The first - [ ] line is the next step. The current phase is the ### Phase N: heading immediately above it. Completion is count([x]) / count([ ] + [x]). No JSON, no markers, no sidecar — just the Progress section.
When ALL phases are implemented and verified (every Progress checkbox is [x]):
change.md.status is now implemented.All phases implemented! 🎉
Summary:
- Phases completed: [N]
- Files changed: [list key files]
Use AskUserQuestion:
question: "Plan complete. Would you like a final implementation review?"
header: "Plan Complete"
options:
- label: "Run full review (/shape-impl-review)"
description: "Comprehensive review of all phases against the plan. Catches cross-phase issues."
- label: "Skip review — I'm satisfied"
description: "No review needed. Mark the plan as done."
multiSelect: false
If user chooses review → run /shape-impl-review <change-id> (no phase number = full plan review).
When something isn't working as expected:
Use sub-tasks sparingly — mainly for targeted debugging or exploring unfamiliar territory:
subagent_type: "Explore") — Fast search for files, patterns, similar codesubagent_type: "general-purpose") — Deep analysis requiring multi-step reasoningIf the plan's ## Progress section has existing [x] marks:
- [ ] lineRemember: You're implementing a solution, not just checking boxes. Keep the end goal in mind and maintain forward momentum.
After all phases/risks are complete, chain to the ship pipeline before opening a PR:
verify-and-self-fix for the full ship-readiness checklist.ci-babysitter to watch CI until green.shape-implement/shape-tdd/shape-e2e → verify-and-self-fix → PR → ci-babysitter