plugins/dev/skills/implement-plan/SKILL.md
Implement approved technical plans from thoughts/shared/plans/. **ALWAYS use when** the user says 'implement the plan', 'start implementing', 'build from the plan', or wants to execute a previously created implementation plan using TDD (Red-Green-Refactor). Supports team mode for parallel implementation.
npx skillsauth add coalesce-labs/catalyst implement-planInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are tasked with implementing an approved technical plan from thoughts/shared/plans/. These
plans contain phases with specific changes and success criteria.
# Check project setup (thoughts, CLAUDE.md snippet, config)
if [[ -f "${CLAUDE_PLUGIN_ROOT}/scripts/check-project-setup.sh" ]]; then
"${CLAUDE_PLUGIN_ROOT}/scripts/check-project-setup.sh" || exit 1
fi
# Auto-discover most recent plan (workflow context + filesystem fallback)
RECENT_PLAN=""
if [[ -f "${CLAUDE_PLUGIN_ROOT}/scripts/workflow-context.sh" ]]; then
RECENT_PLAN=$("${CLAUDE_PLUGIN_ROOT}/scripts/workflow-context.sh" recent plans)
fi
if [[ -n "$RECENT_PLAN" ]]; then
echo "📋 Auto-discovered recent plan: $RECENT_PLAN"
else
echo "⚠️ No recent plan found in workflow context or filesystem"
fi
SESSION_SCRIPT="${CLAUDE_PLUGIN_ROOT}/scripts/catalyst-session.sh"
if [[ -x "$SESSION_SCRIPT" ]]; then
CATALYST_SESSION_ID=$("$SESSION_SCRIPT" start --skill "implement-plan" \
--ticket "${TICKET_ID:-}" \
--workflow "${CATALYST_SESSION_ID:-}")
export CATALYST_SESSION_ID
"$SESSION_SCRIPT" phase "$CATALYST_SESSION_ID" "implementing" --phase 1
fi
Auto-discovery has already run in Prerequisites above. Check its output and follow this priority:
If user provided a plan path as parameter: Use the provided path (user override). Skip to Step 3.
If no parameter provided AND Prerequisites output shows a discovered plan (📋):
If no parameter AND Prerequisites shows no plan found (⚠️):
thoughts/shared/plans/STEP 3: Read and prepare
Once you have a plan path:
source_ticket field) and update Linear state
to stateMap.inProgress from config using Linearis CLI (run linearis issues usage for syntax).
If Linearis CLI is not available, skip silently and continue implementation.
Skip the status transition when CATALYST_PHASE is set — under a phase agent
(e.g. phase-implement, or this skill invoked as a sub-task from phase-pr /
phase-monitor-merge during PR resolution / CI fix-up loops) the deterministic
coordinator (CTL-558) owns the Linear status write-back. A direct write here
would regress the ticket from PR back to Implement, producing operator-visible
state flicker (CTL-601). Mirrors the gate in create-pr/SKILL.md:227-232.Plans are carefully designed, but reality can be messy. Your job is to:
For each phase, follow Red → Green → Refactor:
This order is non-negotiable. If a phase doesn't have a "Tests First" section, write tests for the phase's expected behavior before implementing. The tests serve as executable acceptance criteria.
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:
Issue in Phase [N]:
Expected: [what the plan says]
Found: [actual situation]
Why this matters: [explanation]
How should I proceed?
Within each phase (TDD cycle):
After completing a phase:
make check test covers everything)implement-plan-draft-pr-early fence); interactive
/catalyst-dev:implement-plan runs skip this automatically via the CATALYST_PHASE gate.# CTL-783: make the PR the durable off-disk work record from the FIRST commit.
# Run after EVERY plan-phase commit: first run opens the draft PR, later runs
# just push (draft_pr_ensure is idempotent). Interactive runs (no
# CATALYST_PHASE) skip — no surprise pushes. Fail-open: never blocks the phase.
if [[ -n "${CATALYST_PHASE:-}" && -r "${CLAUDE_PLUGIN_ROOT}/scripts/lib/draft-pr.sh" ]]; then
# shellcheck source=/dev/null
source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/draft-pr.sh"
if [[ "$(draft_pr_enabled)" == "true" ]]; then
draft_pr_push || true
draft_pr_ensure "main" "${TICKET_ID:-${CATALYST_TICKET:-}}" >/dev/null 2>&1 || true
fi
fi
Don't let verification interrupt your flow - batch full suite runs at natural stopping points. But always run the specific tests you wrote during each Red → Green cycle.
Monitor context proactively throughout implementation:
After Each Phase:
✅ Phase {N} complete!
## 📊 Context Status
Current usage: {X}% ({Y}K/{Z}K tokens)
{If >60%}:
⚠️ **Context Alert**: We're at {X}% usage.
**Recommendation**: Create a handoff before continuing to Phase {N+1}.
**Why?** Implementation accumulates context:
- File reads
- Code changes
- Test outputs
- Error messages
- Context clears ensure continued high performance
**Options**:
1. ✅ Create handoff and clear context (recommended)
- Use `/create-handoff` to generate properly formatted handoff
- Format: `thoughts/shared/handoffs/{ticket}/YYYY-MM-DD_HH-MM-SS_description.md`
- Includes timestamp for lexical sorting by recency
2. Continue to next phase (if close to completion)
**To resume**: Start fresh session, run `/implement-plan {plan-path}`
(The plan file tracks progress with checkboxes - you'll resume automatically)
{If <60%}:
✅ Context healthy. Ready for Phase {N+1}.
When to Warn:
Educate About Phase-Based Context:
Creating a Handoff:
When recommending a handoff, guide the user:
/create-handoffthoughts/shared/handoffs/{ticket}/YYYY-MM-DD_HH-MM-SS_description.mdAfter all implementation phases pass, run quality gates before marking work as done. These gates catch issues that per-phase testing might miss.
Gate execution order:
Quality Gates:
├── 1. /validate-type-safety → tsc + reward hacking scan + tsconfig check + tests + lint
├── 2. /security-review → scan for security vulnerabilities (built-in Claude Code skill)
├── 3. code-reviewer agent → style/guideline adherence check
└── 4. pr-test-analyzer agent → test coverage verification
Gate 1: Type Safety Validation
Invoke /validate-type-safety. This runs the full 5-step gate (type check, reward hacking scan,
test inclusion, tests, lint). If it fails, fix issues and re-run before proceeding.
Gate 2: Security Review
Invoke the built-in /security-review skill. Review findings and fix any vulnerabilities before
proceeding.
Gate 3: Code Review
Spawn the code-reviewer agent:
Agent(subagent_type="pr-review-toolkit:code-reviewer",
prompt="Review the uncommitted changes for adherence to project guidelines and style.")
Address any findings that violate project conventions.
Gate 4: Test Coverage
Spawn the pr-test-analyzer agent:
Agent(subagent_type="pr-review-toolkit:pr-test-analyzer",
prompt="Analyze test coverage for the uncommitted changes. Identify critical gaps.")
If critical gaps exist, write the missing tests.
Recording findings during implementation. When a phase surfaces friction worth fixing — a bug noticed in adjacent code, a step that shouldn't need manual intervention, a gap in tooling — record it the moment it's observed:
"${CLAUDE_PLUGIN_ROOT}/scripts/add-finding.sh" \
--title "Short imperative title" \
--body "Reproduction + expected + observed + any links" \
--skill implement-plan
Findings go to a shared queue (under orchestrate/oneshot, that skill's queue; direct
invocations get a per-session queue). The block below files the queue at end-of-run. It's a
safety net: when implement-plan runs under /orchestrate or /oneshot, the parent's
filing step drains the same queue first and this block finds an empty file:
FEEDBACK="${CLAUDE_PLUGIN_ROOT}/scripts/file-feedback.sh"
CONSENT="${CLAUDE_PLUGIN_ROOT}/scripts/feedback-consent.sh"
FINDINGS_FILE="${CATALYST_FINDINGS_FILE:-.catalyst/findings/${CATALYST_SESSION_ID:-current}.jsonl}"
if [ -x "$FEEDBACK" ] && [ -f "$FINDINGS_FILE" ] && [ -s "$FINDINGS_FILE" ]; then
COUNT=$(wc -l < "$FINDINGS_FILE" | tr -d ' ')
if [ "$("$CONSENT" check)" != "granted" ] && [ -z "${CATALYST_AUTONOMOUS:-}" ] && [ -t 0 ]; then
read -r -p "File $COUNT improvement tickets now? [Y/n] " yn
case "$yn" in [Nn]*) : ;; *) "$CONSENT" grant >/dev/null ;; esac
fi
if [ "$("$CONSENT" check)" = "granted" ]; then
FILED=0
while IFS= read -r line; do
TITLE=$(jq -r '.title' <<<"$line")
BODY=$(jq -r '.body' <<<"$line")
SKILL=$(jq -r '.skill // "implement-plan"' <<<"$line")
RESULT=$("$FEEDBACK" --title "$TITLE" --body "$BODY" --skill "$SKILL" --json 2>/dev/null || true)
STATUS=$(jq -r '.status // "failed"' <<<"$RESULT")
if [ "$STATUS" = "filed" ]; then
ID=$(jq -r '.identifier // .url // ""' <<<"$RESULT")
echo " filed: $ID ($TITLE)"
FILED=$((FILED + 1))
fi
done < "$FINDINGS_FILE"
[ "$FILED" -eq "$COUNT" ] && rm -f "$FINDINGS_FILE"
fi
fi
After all quality gates pass (or are skipped), end the session:
if [[ -n "${CATALYST_SESSION_ID:-}" && -x "$SESSION_SCRIPT" ]]; then
"$SESSION_SCRIPT" end "$CATALYST_SESSION_ID" --status done
fi
For gates 1 and 2, attempt to fix issues automatically and re-run the gate. For gates 3 and 4, address findings and verify. If a gate fails after 2 fix attempts, report the remaining issues to the user and ask how to proceed.
If the plan or user specifies --skip-quality-gates, skip this section entirely. Report that
quality gates were skipped in the completion summary.
When something isn't working as expected:
Use sub-tasks sparingly - mainly for targeted debugging or exploring unfamiliar territory.
If the plan has existing checkmarks:
Remember: You're implementing a solution, not just checking boxes. Keep the end goal in mind and maintain forward momentum.
When invoked with --team flag or when the plan spans 3+ independent domains:
Lead (Opus) — Coordinates implementation
├── Teammate 1 (Sonnet) — Frontend changes
│ └── Can spawn subagents for research
├── Teammate 2 (Sonnet) — Backend changes
│ └── Can spawn subagents for research
└── Teammate 3 (Sonnet) — Test changes
└── Can spawn subagents for research
If a ticket is detected (from plan document's source_ticket frontmatter or from context):
stateMap.inProgress from config
using Linearis CLI (run linearis issues usage for syntax).CATALYST_PHASE is set — the deterministic coordinator
(CTL-558) owns Linear write-back under phase agents. See the gate at Step 3 above for
details. CTL-601 — without this gate, invoking this skill as a sub-task from another phase
agent (typical in phase-pr / phase-monitor-merge resolution loops) regresses the ticket
state to Implement and produces operator-visible flicker.development
Migrate a single-harness repo to the dual-harness layout so both Claude Code and Codex load the same instructions and skills — AGENTS.md as the portable canonical doc, a thin CLAUDE.md `@AGENTS.md` bridge, and a `.agents/skills` dir with a `.claude/skills` symlink onto it. Use when asked to migrate to dual-harness, make this repo work in both Claude and Codex, or for agent metadata cleanup.
tools
Goal-driven senior-engineer pipeline-unstick sweep (CTL-1176 rung 3). Given the stuck/failed/needs-human set (or ONE ticket handed by the recovery router), its GOAL is to get the pipeline MOVING again — not to fix one ticket's review findings (that is phase-remediate). It runs AFTER the eyes (diagnostician evidence) and the hands (deterministic unstuck-sweep seams) have already tried, and it CONSUMES their output from a recovery-pass.json brief rather than re-diagnosing or redoing their narrow work. It acts like a senior engineer with full tool access — it resolves merge conflicts, rebases, force-pushes, merges green PRs, and re-dispatches stalled phases AUTONOMOUSLY — and escalates to the operator ONLY for a genuine value judgment / something that degrades other functionality / a real cost-benefit trade-off / a serious architecture change / an ADR conflict. On escalation it AUTHORS the operator inbox row + the push notification (executive-voiced). Dispatched as a `claude --bg` job by phase-agent-dispatch via slash command, AND invocable bare by the operator as a sweep — hence `user-invocable: true`. Ships behind CATALYST_RECOVERY_PASS (off by default — no live behavior change until shadow/enforce).
tools
Diagnose and fix Catalyst setup issues. Validates tools, database, config, OTel, direnv, and thoughts. Automatically fixes what it can — creates directories, initializes the database, sets WAL mode, runs migrations. Use for new installs, upgrades, or when something isn't working.
tools
--- name: phase-triage description: Phase agent that triages a Linear ticket — expands acronyms, classifies (feature/bug/docs/refactor/chore), identifies genuine blockers (a semantic second-pass over the backlog — NOT a prose scrape; CTL-838), estimates scope, writes triage.json, and posts a triage analysis comment to Linear. Triage completion is signaled by that comment plus the local triage.json — there is no `triaged` label. Emits phase.triage.complete.<TICKET> on success and phase.triage.fai