| name | mach6-implement |
| description | Implement a plan from a PR, or fix review findings / CI failures. Usage: mach6-implement 42 [finding-numbers] or mach6-implement 42 ci |
| argument-hint | <pr-number> [finding-numbers | ci] |
mach6-implement — Implement Plans, Fix Findings, or Fix CI
User input: $ARGUMENTS
This skill has two modes:
- Implement mode (just a PR number): reads the plan comment and implements it
- Fix mode (with finding numbers or
ci): fixes specific review findings or CI failures
Global Rules
- GitHub as shared memory — Plans, reviews, and assessments are on the PR as comments with HTML markers.
- No
#N in comment bodies — Use "finding 3", "item 3" etc. instead.
- Safe git — Never use
git add -A or git add .. Stage files by name. Never stage secrets.
- Task tracking — Use the
update_task tool to show progress.
- Non-interactive
gh — Set GH_PAGER=cat and GH_EDITOR=cat before all gh commands to prevent interactive prompts from hanging the agent. Use --body-file instead of inline --body for all gh pr comment, gh pr create, and gh issue create calls to avoid shell interpretation of backticks.
Step 1: Parse input
Extract:
- PR number (required)
- Finding numbers to fix (optional — e.g.,
1,2,3)
ci flag (optional — fix CI failures instead of review findings)
If only a PR number is given → implement mode.
If finding numbers or ci → fix mode.
Step 2: Checkout
gh pr checkout <pr-number>
git pull
Implement Mode (PR number only)
Step 3i: Read the plan and full PR context
Read ALL PR comments and the PR body to get complete context:
gh pr view <pr-number> --json title,body,comments
Inline review comments (comments on specific lines of the diff) are NOT included in the above output. Fetch them separately:
gh api repos/{owner}/{repo}/pulls/<pr-number>/comments --jq '.[] | {user: .user.login, path: .path, line: (.original_line // .line // "?"), body: .body, diff_hunk: .diff_hunk, url: .html_url}'
Find the plan comment (contains <!-- mach6-plan --> marker) from the regular comments. If no plan comment exists, tell the user and suggest running /skill:mach6-plan first.
Also read any progress updates, prior review findings, assessments, inline review comments, and discussion — all of this context informs implementation.
Step 4i: Set up task tracking
Create tasks based on the plan's deliverables/features. Example:
- title: "read", description: "Read plan and codebase" <-- start here
- title: "feature-1", description: "Implement feature 1"
- title: "feature-2", description: "Implement feature 2"
- title: "test", description: "Add/update tests"
- title: "verify", description: "Build and verify"
Step 5i: Read the codebase
Read all files mentioned in the plan. Understand the existing code before making changes.
Step 6i: Implement
Use the implement role subagent to implement each deliverable. Use default model role if implement is not defined.
For each deliverable in the plan, launch a implement subagent via the Agent tool. Provide each agent with:
- The specific deliverable to implement (files to modify, what to change, expected behavior)
- The full plan context and any relevant PR discussion
- The list of files to read for understanding existing patterns
- Instructions to run tests and linting after making changes
- If the plan includes tests for this deliverable, tests MUST be written as part of the implementation — not deferred
Test coverage is part of the deliverable, not an afterthought. If the plan specifies tests for a deliverable, the feature-dev agent must implement them. If the target package lacks test infrastructure, add it.
Parallelism: If deliverables are independent (don't modify the same files), run their implement agents in parallel.
Small plans (1-2 simple deliverables): You may implement directly instead of delegating, if the changes are straightforward enough that subagent overhead isn't justified.
Update task tracking as each deliverable completes.
Step 7i: Verify
After all implement agents complete:
- Run the project's test suite
- Run any linting/formatting tools
- Build the project if applicable
- Verify each deliverable from the plan is addressed
- If any agent reported issues or partial completion, address the gaps
Suggest next step: /skill:mach6-push then /skill:mach6-review <pr-number> for review.
Fix Mode (finding numbers or ci)
Step 3f: Set up task tracking
- title: "gather", description: "Gather findings to fix" <-- start here
- title: "fix", description: "Implement fixes"
- title: "verify", description: "Verify fixes"
Step 4f: Gather context
If ci was specified:
gh pr checks <pr-number>
gh run view <run-id> --log-failed
Note: gh pr checks returns exit code 8 while checks are still pending — this is expected, not a failure. Wait and re-run if needed.
Read the failed CI logs and identify issues. Extract test failures, stack traces, error messages. If all checks pass, report this and stop.
If finding numbers were specified:
Read ALL PR comments to get full context:
gh pr view <pr-number> --json title,body,comments
Inline review comments (comments on specific lines of the diff) are NOT included in the above output. Fetch them separately:
gh api repos/{owner}/{repo}/pulls/<pr-number>/comments --jq '.[] | {user: .user.login, path: .path, line: (.original_line // .line // "?"), body: .body, diff_hunk: .diff_hunk, url: .html_url}'
Find the review (<!-- mach6-review -->) and assessment (<!-- mach6-assessment -->) comments, then extract the specific findings to fix. Also review inline review comments for any additional context or feedback. Prior progress comments and discussion may also provide useful context.
If no finding numbers and not ci:
Read ALL PR comments AND inline review comments, find review/assessment comments, present genuine findings, and ask which to fix. Use both commands above.
Step 5f: Batch sizing
- Simple fixes (typos, naming, imports): ~10 per batch
- Moderate fixes (logic changes, refactors): ~6 per batch
- Complex fixes (architecture, new features): ~3 per batch
If more than batch size, fix first batch and tell user to re-run.
Step 6f: Implement fixes
Use the implement subagent to implement fixes. implement is a model role. If it isn't specified, then just use default.
For each finding (or batch of related findings), launch a implement subagent with:
- The finding description and the assessment's classification/reasoning
- The specific files and code locations involved
- Instructions on what to fix and how
- Instructions to run tests after fixing
Parallelism: If findings touch different files, run their implement agents in parallel. If findings overlap (same file/function), batch them into a single agent.
Simple fixes (typos, naming, one-line changes): You may fix these directly instead of delegating.
Defer out-of-scope items to new issues. Update task tracking per finding.
Step 7f: Verify
After all implement agents complete:
- Run tests and linting
- Verify each fix addresses its finding
- If any agent reported issues, address the gaps
Suggest next step: /skill:mach6-push then /skill:mach6-review <pr-number> for re-review.