From winrey-toolkit
Use when a feature branch is ready for merge — orchestrates PR creation, spec/quality check, review-loop, test-completeness, Copilot review, Codex review, doc consistency, conflict check, and CI verification in a strict sequential pipeline
How this skill is triggered — by the user, by Claude, or both
Slash command
/winrey-toolkit:finish-featureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Orchestrate a feature branch through a comprehensive quality pipeline before merge. 9 sequential steps, each runs once to completion.
Orchestrate a feature branch through a comprehensive quality pipeline before merge. 9 sequential steps, each runs once to completion.
Pre-flight → Step selection → PR creation → Spec/Quality check → review-loop
→ test-completeness → Copilot review → Codex review → Doc consistency
→ Conflict check → CI verification → Finalize PR → DONE
Each step runs once. Later steps do NOT re-trigger earlier steps — CI at the end is the final safety net.
Don't use for:
review-loop instead)digraph finish_feature {
rankdir=TB;
"Pre-flight:\ndetect state, infer branch\nsearch spec/plan" [shape=box];
"AskUserQuestion:\nselect steps + automation" [shape=box, style=filled, fillcolor=lightyellow];
"Step 1: PR creation" [shape=box];
"Step 2: Spec/Quality" [shape=box];
"Step 3: review-loop" [shape=box];
"Step 4: test-completeness" [shape=box];
"Step 5: Copilot review" [shape=box];
"Step 6: Codex review" [shape=box];
"Step 7: Doc consistency" [shape=box];
"Step 8: Conflict check" [shape=box];
"Step 9: CI check" [shape=box];
"Finalize PR" [shape=box];
"DONE" [shape=doublecircle];
"Pre-flight:\ndetect state, infer branch\nsearch spec/plan" -> "AskUserQuestion:\nselect steps + automation";
"AskUserQuestion:\nselect steps + automation" -> "Step 1: PR creation";
"Step 1: PR creation" -> "Step 2: Spec/Quality";
"Step 2: Spec/Quality" -> "Step 3: review-loop";
"Step 3: review-loop" -> "Step 4: test-completeness";
"Step 4: test-completeness" -> "Step 5: Copilot review";
"Step 5: Copilot review" -> "Step 6: Codex review";
"Step 6: Codex review" -> "Step 7: Doc consistency";
"Step 7: Doc consistency" -> "Step 8: Conflict check";
"Step 8: Conflict check" -> "Step 9: CI check";
"Step 9: CI check" -> "Finalize PR";
"Finalize PR" -> "DONE";
}
Skipped steps are bypassed. If automation=checkpoint, a pause is inserted after every step.
All optional — infer from context:
| Parameter | Default | Description |
|---|---|---|
| TARGET_BRANCH | Auto-inferred | PR target branch (dev > main; infer → memory → ask user) |
| SPEC_PATH | Auto-searched | Design spec document path |
| PLAN_PATH | Auto-searched | Implementation plan path |
| AUTOMATION | Ask user | full / confirm / checkpoint |
Before any step executes, gather context and get user confirmation.
git status)gh pr view)If uncommitted changes exist, ask user whether to commit first or abort.
Priority order:
dev or develop branch exists locally or on remote → use itAskUserQuestion to ask userSave confirmed target branch to memory for future runs.
Scan docs/ directory for design/plan documents matching current branch name or recent dates. Also check for docs/superpowers/specs/ and docs/superpowers/plans/ patterns. If found, record paths for use in Steps 2-3.
Use AskUserQuestion to present all 9 steps. If a PR already exists with a Quality Checklist, parse it to detect which steps may have already been completed and suggest skipping them.
Which steps should I run? (all selected by default)
[x] 1. PR creation
[x] 2. Spec/Quality check
[x] 3. Review loop (Claude)
[x] 4. Test completeness
[x] 5. Copilot PR review
[x] 6. Codex review
[x] 7. Documentation consistency
[x] 8. Conflict + upstream check
[x] 9. CI check
Note: Steps 3, 5 appear already completed based on PR checklist.
Use AskUserQuestion:
Automation level:
(a) Full auto — only pauses on errors or trade-off decisions
(b) Confirm — pauses at key decisions (fix proposals, review disputes)
(c) Checkpoint — pauses after every step with summary
Applies to ALL steps that receive review feedback (Steps 3, 5, 6). This is a core principle — do not skip it.
For each review opinion:
├─ Clearly valid → fix code
├─ Clearly invalid / false positive →
│ ├─ Do NOT fix
│ ├─ Reply with explanation (PR comment for Copilot, summary for Codex)
│ ├─ Resolve the conversation where applicable
│ └─ automation=confirm/checkpoint → show user before declining
└─ Uncertain →
├─ automation=full → dispatch verifier (review-loop) or judge conservatively
├─ automation=confirm/checkpoint → show user with analysis, let them decide
└─ After judgment → treat as valid or invalid
You MUST validate review opinions independently. Do not blindly accept or reject. Read the relevant code, understand context, then judge. This applies equally to Claude reviewers, Copilot, and Codex.
Check existing PR: gh pr view
├─ Already exists → skip, record PR URL and number
└─ Does not exist → create PR
├─ Collect: git log, diff stat, spec summary
├─ Generate PR title + body
├─ automation=full → create directly
├─ automation=confirm/checkpoint → show draft for user confirmation
└─ gh pr create --draft --title "..." --body "..."
Always create as Draft PR. Subsequent steps are still running — don't allow premature merge.
PR body must include a Quality Checklist. Step 1 (PR creation) is self-evidently complete once the PR exists, so the checklist covers Steps 2-9 (8 items):
## Summary
{from spec or git log}
## Quality Checklist
- [ ] Spec/Quality check
- [ ] Review loop (Claude)
- [ ] Test completeness
- [ ] Copilot review
- [ ] Codex review
- [ ] Documentation consistency
- [ ] No merge conflicts
- [ ] CI passing
## Test Plan
{from test files or spec}
After each subsequent step completes, update the corresponding checkbox via gh pr edit --body "...".
Route based on available context:
Has plan/spec?
├─ Has plan → per-task check
│ ├─ Extract task list + acceptance criteria from plan
│ ├─ Dispatch spec-checker subagent per task (parallel via Agent tool)
│ └─ Merge results into summary report
├─ Has spec, no plan → per-module check
│ ├─ Group changed files by module from diff
│ ├─ Dispatch spec-checker subagent per module (parallel)
│ └─ Merge results into summary report
└─ Neither → generic quality check
├─ Dispatch subagent for general code quality review on diff
└─ Check: naming, error handling, type safety, code smells
For each subagent, fill the spec-checker-prompt.md template. Read it from this skill's directory (plugins/winrey-toolkit/skills/finish-feature/spec-checker-prompt.md).
Placeholder mapping:
| Placeholder | Source |
|---|---|
{MODE} | task (has plan), module (has spec, no plan), or generic (neither) |
{TASK_OR_MODULE} | Task name from plan, or module/file group name |
{ACCEPTANCE_CRITERIA} | From plan task; empty string if no plan |
{SPEC_REQUIREMENTS} | Relevant spec section content; empty string if no spec |
{TARGET_FILES} | Source file paths with brief descriptions |
{PROJECT_CONVENTIONS} | Language, framework, style conventions |
You MUST dispatch subagents. Do NOT check spec compliance yourself. The controller coordinates — it does not review. Even for a single task, dispatch a subagent.
| Dimension | Description |
|---|---|
| Functional completeness | Code implements all features required by spec/task |
| Acceptance criteria | All acceptance criteria from plan are satisfied |
| Interface consistency | Actual APIs/interfaces match spec definitions |
| Code quality | Naming, structure, error handling, type safety |
| Omission detection | Features in spec but missing in code |
Invoke skill winrey-toolkit:review-loop with:
| Parameter | Value |
|---|---|
| BASE_SHA | Pre-evaluate: git merge-base HEAD origin/TARGET_BRANCH → pass the resulting SHA |
| HEAD_SHA | HEAD (current commit SHA) |
| DESCRIPTION | From spec summary or PR body; fallback to git log --oneline summary |
| PLAN_OR_REQUIREMENTS | Read SPEC_PATH file contents and pass as text (if available) |
The skill handles multi-round iteration, verification, and fixing internally. Controller passes parameters and waits for the result. Do not interfere with review-loop's internal process.
After completion → push, update PR body checkbox.
Invoke skill winrey-toolkit:test-completeness with:
| Parameter | Value |
|---|---|
| scope | diff |
| base | TARGET_BRANCH |
| mode | interactive |
Run in interactive mode — allow generating and fixing tests. This is intentional: finish-feature is user-initiated, not an automated sub-step, so interactive remediation is appropriate. The skill handles its own dynamic + static audit, remediation loop, and verification internally.
After completion → push, update PR body checkbox.
gh pr edit <PR_NUMBER> --add-reviewer @copilot
If this fails:
Poll for Copilot review completion:
gh api repos/{owner}/{repo}/pulls/{pr}/reviews
→ Filter: user.login == "copilot-pull-request-reviewer[bot]"
→ Check state: APPROVED / CHANGES_REQUESTED / COMMENTED
→ Poll interval: 30s, max wait: 10 minutes
→ Timeout → ask user: wait longer / skip / manually trigger
For each Copilot review comment, apply the Review Opinion Handling Principle:
# Reply to comment
gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies -f body="..."
# Get thread ID via GraphQL, then resolve
gh api graphql -f query='mutation($id: ID!) {
resolveReviewThread(input: {threadId: $id}) { thread { id } }
}' -f id='THREAD_NODE_ID'
After all opinions processed:
Delegate review to Codex via codex:rescue skill (from the codex plugin — an external dependency). Construct prompt using codex-reviewer-prompt.md template from this skill's directory. The controller must provide the diff content in the prompt since Codex may not have bash tool access.
If codex:rescue is not available, fall back to dispatching the codex-reviewer-prompt.md via the Agent tool as a regular subagent. The review value is reduced (same model) but still provides a fresh-eyes pass.
Template placeholders:
| Placeholder | Source |
|---|---|
{DIFF_RANGE} | BASE_SHA..HEAD |
{DIFF_CONTENT} | Output of git diff BASE_SHA..HEAD (provide the actual diff text) |
{DESCRIPTION} | PR/feature description |
{SPEC_SUMMARY} | Key spec requirements (if available) |
{PROJECT_CONVENTIONS} | Language, framework, style conventions |
Codex must output a structured issue list: file path, line number, severity, description, suggested fix.
For each Codex opinion, apply the Review Opinion Handling Principle:
After fixes → push, update PR body checkbox.
| Step 3: review-loop | Step 6: Codex review | |
|---|---|---|
| Model | Claude subagents | Codex/GPT |
| Rounds | Multi-round until PASS | Single round |
| Verification | Built-in verifier subagent | Claude controller validates |
| Value | Deep iterative polish | Different model catches Claude blind spots |
Dispatch a doc-checker subagent using doc-checker-prompt.md template from this skill's directory.
You MUST dispatch a subagent. Do NOT check documentation yourself.
Placeholder mapping:
| Placeholder | Source |
|---|---|
{CHANGED_FILES} | git diff --name-only BASE_SHA..HEAD file list |
{DIFF_SUMMARY} | git diff --stat BASE_SHA..HEAD output |
{DOC_FILES} | List of documentation file paths found in project (README, docs/, CHANGELOG, etc.) |
{SPEC_CONTENT} | Read spec file contents; empty string if no spec |
{PROJECT_CONTEXT} | Language, framework, project structure summary |
| Dimension | What to check |
|---|---|
| README | Feature descriptions match code |
| API docs | Interface changes reflected |
| Spec document | Needs "implemented" marking or updates |
| CHANGELOG | Needs new entry |
| Code comments | Docstrings match implementation |
| Config docs | Env examples, deploy docs need updates |
| Level | Behavior |
|---|---|
full | Update documents directly |
confirm / checkpoint | Show suggestions, update after user confirmation |
After fixes → push, update PR body checkbox.
git fetch origin TARGET_BRANCH
git merge --no-commit --no-ff origin/TARGET_BRANCH
git merge --abort, continuegit merge; if resolved, commit with standard merge message and report resolution to user; if unresolvable, report and ask usergit log origin/TARGET_BRANCH --not HEAD --oneline
git diff HEAD...origin/TARGET_BRANCH -- <files in current branch scope>
After check → update PR body checkbox.
gh pr checks <PR_NUMBER> --watch
gh run view <run_id> --log-failedgh run rerun <run_id> --failedAfter all steps complete:
gh pr ready <PR_NUMBER>## Feature Finish Report
**PR:** #123 — {title}
**Branch:** feature/xxx → TARGET_BRANCH
**Steps executed:** 7/9 (skipped: 4, 6)
| Step | Status | Summary |
|------|--------|---------|
| 1. PR creation | DONE | Created #123 (draft) |
| 2. Spec/Quality | PASS | 5 tasks checked, 2 issues fixed |
| 3. review-loop | PASS | 3 rounds, 8 issues fixed |
| 4. test-completeness | SKIPPED | User skipped |
| 5. Copilot review | PASS | 4 comments: 3 fixed, 1 declined |
| 6. Codex review | SKIPPED | User skipped |
| 7. Documentation | PASS | README updated |
| 8. Conflicts | PASS | No conflicts, no upstream impact |
| 9. CI | PASS | All checks green |
PR Status: Draft removed, all checks passed, ready for merge.
| Scenario | Behavior |
|---|---|
| Step fails, cannot auto-fix | Report reason, ask user: skip / fix manually then continue / abort |
| Conversation interrupted | Next run detects PR checklist, suggests skipping completed steps |
| Push permission denied | Report error, suggest checking git remote config (SSH → HTTPS fallback) |
| Copilot review unavailable | Report, skip step, continue pipeline |
| Codex unavailable | Report, skip step, continue pipeline |
| Mistake | Fix |
|---|---|
| Reviewing code yourself instead of dispatching subagents | Always dispatch subagents for Steps 2, 7. Controller coordinates, never reviews |
| Blindly accepting all review opinions | Apply Review Opinion Handling Principle — validate each opinion independently |
| Blindly rejecting review opinions | Read the code, understand context, then judge. When uncertain, lean conservative |
| Re-running earlier steps after later fixes | Each step runs once. CI at the end is the backstop |
| Creating non-draft PR | Always create as draft — remove draft only in Finalize step |
| Forgetting to update PR body checkbox | Update after EVERY step completion |
| Skipping AskUserQuestion for step selection | Always ask — user may want to skip steps already done |
| Not pushing after fixes | Push after every step that modifies code |
| Skill | Relationship |
|---|---|
review-loop | Invoked as Step 3; handles its own multi-round loop |
test-completeness | Invoked as Step 4; handles its own audit-fix loop |
codex:rescue | Used in Step 6 to dispatch Codex review |
verification-before-completion | Complementary — finish-feature is a superset |
writing-plans | Plans can include finish-feature as the final acceptance step |
npx claudepluginhub winrey/claude-code-toolkit --plugin winrey-toolkitProvides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.