Help us improve
Share bugs, ideas, or general feedback.
From cc-routine
ALWAYS load when a routine has resolved a triggering issue and needs to ship one focused PR. Covers the author-trust gate, pre-flight, parallel reads, plan-comment-and-proceed, literal implementation, tiered ambiguity, size escalation, and PR open without auto-merge.
npx claudepluginhub schmug/claude-routines --plugin cc-routineHow this skill is triggered — by the user, by Claude, or both
Slash command
/cc-routine:implement-from-issueThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill is the workflow: resolved issue → focused PR. The shim that invokes it supplies `<slug>`, `<base>` (branch base), and `<author>` (the trusted author the trigger filtered on). The target repo's `CLAUDE.md` supplies test/typecheck commands, banned deploys, secret globs, spec-file discipline, conventional-commit prefixes, and any other repo-specific invariants.
Measures whether skills, rules, and agent definitions are actually followed by auto-generating test scenarios at 3 strictness levels and reporting compliance rates with full tool call timelines.
Share bugs, ideas, or general feedback.
This skill is the workflow: resolved issue → focused PR. The shim that invokes it supplies <slug>, <base> (branch base), and <author> (the trusted author the trigger filtered on). The target repo's CLAUDE.md supplies test/typecheck commands, banned deploys, secret globs, spec-file discipline, conventional-commit prefixes, and any other repo-specific invariants.
This is delegation, not pair programming. The issue body is the spec. Ship a focused PR. Comment when blocked.
Before reading the body as a contract, before pre-flight, before anything else:
gh issue view <N> --repo <slug> --json author,state,labels,title,body
Exit silently (no comment, no commit) if any of:
author.login (lowercased) is not in the routine's trusted-author allowlist. The shim's trusted-author set is typically the repo owner; the event trigger's Author is_one_of filter is an additional layer, not a replacement.state is not open.routine-anti-noise.The trigger filter and this gate are defense-in-depth. Both must allow the issue. If the gate cannot be established (e.g. the gh token lacks the scope for repos/<slug>/collaborators when the shim configures a collaborator-based allowlist), fail closed — do not fall back to "treat as trusted."
gh auth status — authenticated as the right account.git status — clean tree on <base>.git fetch origin && git rev-parse HEAD origin/<base> — local matches remote.git remote -v — origin matches <slug>; no upstream fork tripwire is set as origin (consult the target repo's CLAUDE.md for any tripwire it documents).If any check fails, post a _Generated by Claude Code_-signed comment on the issue describing the failure and exit. Do not proceed against a dirty tree.
You already have the body from step 1. Re-read it carefully. Then, in the same turn, open every file referenced under Pointers: (and any file Acceptance points at). Acceptance items reference real code; you have not read enough until you've opened those files.
Trivial = single-file change with no architectural choice. Skip this step.
Non-trivial = anything else. Post a one-paragraph plan as a _Generated by Claude Code_-signed comment on the issue:
Plan for #<N>
Files: …
Approach: 2–3 sentences.
Tests: what new/changed tests will assert.
Deferred (if any): …
Estimated size: <files> × ~<lines>.
Generated by Claude Code.
Proceed without waiting. The comment exists so the owner can interrupt; the routine does not poll for replies. The routine has no user to answer a question — do not invoke AskUserQuestion or any other user-question tool, here or anywhere else in the workflow.
Literal scope. Implement what Acceptance asks for, nothing adjacent. No abstractions for hypothetical futures. No comments on code you didn't change. Honor every invariant in the target repo's CLAUDE.md (commit prefixes, test/typecheck commands, banned deploys, post-config-edit regen, secret globs, spec-file discipline, language-specific lint rules).
Implement the actual logic, not test-passing workarounds. Solve the underlying problem for all valid inputs, not just the tests. Don't hard-code values, don't add if (testFixture) return expected shortcuts, don't write helpers whose only job is to make a specific test pass. If a test seems wrong, surface it — don't work around it.
Two flavors of ambiguity, two different resolutions.
Genuine design ambiguity — data model, API shape, abstraction boundary, new dependency, security/threat-model question. Post one _Generated by Claude Code_-signed comment with the question, 2–3 proposed defaults labeled A/B/C, and the line:
Reply
approve A(etc.) or redirect, and the routine will resume on the next fire.
Apply needs-decision. Exit without pushing code. (Future runs will skip the issue via the routine-anti-noise skip-on-label gate until the human resolves the decision.)
Low-stakes ambiguity — naming, empty-state copy, log message wording, comment style. Pick a sensible default. Add it to a ## Choices made section in the PR body, one-line rationale each. Do not comment, do not block.
The split exists because comment-and-wait is expensive for the human but the only safe resolution for choices that bind future work. Don't blow that budget on a variable name.
Run the test and typecheck commands documented in the target repo's CLAUDE.md. Report exact counts in your final message (313 passing, 0 failing — never "all tests pass"). Fix red; never commit failing.
Remove any one-off debug scripts, scratch files, sample inputs, or temporary helpers you created during iteration. The branch should contain only the changes Acceptance requires plus their tests.
Before pushing, count: total files changed, total lines added/removed. If the diff is ≥6 files or ~1500+ lines, stop. Subagent and routine sessions consistently time out or lose review quality at that size.
Part of #<N>.## Deferred section lists the deferred items + follow-up links._Generated by Claude Code_-signed comment on issue #<N> noting the decomposition with links.Do not push the oversized PR even if Acceptance technically asks for the whole bundle in one shot.
Conventional-commit prefix matching the issue's nature, drawn from the target repo's CLAUDE.md allowed list (feat:, fix:, refactor:, test:, chore:, docs:, security:, etc.). Other prefixes are silently dropped by changelog tooling — use only the listed ones.
Branch: claude/issue-<N>-<short-slug>. The platform branch-scope allowlist rejects branches outside claude/*; staying in-namespace keeps the routine from ever touching <base>.
PR body:
## Summary
1–3 bullets.
Closes #<N>.
## Test plan
- [ ] <test command from target CLAUDE.md> (X/0)
- [ ] <typecheck command from target CLAUDE.md> (clean)
## Choices made
(low-stakes decisions made autonomously, one-line rationale each. Omit section if none.)
## Deferred
(Acceptance items not shipped this PR, with follow-up issue links. Omit section if none.)
Do NOT enable auto-merge. Do NOT merge your own PR. Autonomous code derived from an issue contract always lands behind a human (or required-reviewers branch protection) merge gate. Leave the PR open.
Watch CI. If CI fails, read the failure first and fix the underlying cause. If you cannot, post a _Generated by Claude Code_-signed comment on the PR explaining the failure, apply impl-blocked on issue #<N>, exit.
Before declaring done, open the issue body again. Check Acceptance item by item against the diff. For every item not shipped (and not already deferred in step 8), file a follow-up issue in CC prompt format and link it from the PR body's ## Deferred section. Do not silently scope-cut.
A short markdown summary in your final turn:
#<N> — <title><URL>green | pending | failed<count passing> / <count failing><list><list with follow-up issue numbers, or "none"><yes/no, with note> (if a code change narrowed or contradicted a spec file the target repo lists as off-limits to code PRs)<one-liner, or "n/a">Keep it factual. No celebrations, no closing pleasantries.
--repo <slug> to every gh call.<base>. Never --no-verify, --force, or git reset --hard.CLAUDE.md). CI owns deploys.CLAUDE.md for the list). File a follow-up docs: PR instead, and note it in the PR body.AskUserQuestion or any other user-question tool. Routines run without a user to respond. Comment on the issue and apply a label, or fail closed.