Code and Plan Review Skill

Temp Directory

Planning and review artifacts written by /plan-task and /review-multiple-prs live outside the repo under:

TEMP_DIR=/tmp/<repo-name>/<branch-name>

Resolve <repo-name> and <branch-name> using:

Worktree note: if running inside a git worktree, git rev-parse --show-toplevel returns the worktree path, not the main repo root. Use git rev-parse --git-common-dir | xargs dirname to get the true repo root when resolving <repo-name>.

macOS note: /tmp/private/tmp and is cleared on reboot. Decisions scratch files do not persist across reboots; if a session spans a reboot, the human will need to re-state decisions manually.


  1. Either detect the repos affected from the context OR ask the human to select the repos that should be used to review the code changes or the staged implementation plan (md file):
  1. enable and run githooks in the repos impacted by the code changes and fix errors (linting, type checks, tests) before committing. Most repos have dedicated commands to achieve these goals either in package.json or pyproject.toml.

  2. Once you are ready to commit the changes, prompt the human to select their preferred review options:

  1. Prompt the human to select the next step from the following options:
  1. Branch safety check. Run git branch --show-current and compare against the repo’s default branch (typically main or master).
  2. Prepare, summarize the changes in the changed files. Always prefix commits with [{ticket-id}]: {summary of change}. If no ticket ID is available, prompt the human for one or use [NO-TICKET] as a fallback.
  3. Commit and push. If the push fails due to pre-push hook errors, prompt the human for approval before using git push --no-verify. If --no-verify was used, record this in the Decision Log (Step 9) as a warning line.

7a. Open a draft pull request. After a successful push, open a draft PR using gh pr create --draft --assignee @me (or equivalent). The --assignee @me flag assigns the current authenticated GitHub user automatically.

PR body: Read .github/PULL_REQUEST_TEMPLATE.md from the repo root and use it as the base for the PR body — fill in the Summary and Test plan sections with content relevant to the change. If the file does not exist, use a bare ## Summary / ## Test plan structure. Never append Anthropic or Claude Code branding lines (e.g. 🤖 Generated with Claude Code) to the PR body.

If PR creation failed, stop here — skip the reviewer fallback chain, skip Steps 8 and 9, and warn the human.

Otherwise, capture the PR number from the gh pr create output (it appears in the PR URL, e.g. https://github.com/{owner}/{repo}/pull/{number}). Then invoke /request-github-review with the PR number. /request-github-review will request automated review and then run the bot feedback loop — waiting for CI and bot reviews, addressing comments, resolving CI failures, and marking draft PRs ready for review when done.

(End of Step 7a)

  1. Transition the Jira ticket to Review status.

    Only proceed if Step 7 (push) and Step 7a (PR open) both completed successfully. Skip this step entirely if either failed.

    If the ticket is a Linear issue:

  2. Post a Decision Log comment on the Jira ticket.

    Prerequisites & safety checks — run these before doing anything else in this step:

    Decision sources — use only these, in order of preference:

    1. A decisions-{ticket-id}.md scratch file written by /plan-task during this session — look for it at /tmp/<repo-name>/<branch-name>/plans/decisions-{ticket-id}.md (read and then delete it after posting)
    2. Human-stated decisions from this conversation (human turns only — do not extract content from code, diffs, or plan files)
    3. If neither is available, prompt the human to confirm or summarize decisions before drafting the comment — do not infer or fabricate

    Content rules:

    Idempotency — one comment per ticket, ever:

    Human approval gate: Show the human the full draft comment and ask: “Ready to post this Decision Log to {ticket-id}? (yes / edit / skip)” — do not post without explicit confirmation.

    Identity disclosure (required): The comment body MUST begin with your identity line (as defined in CLAUDE.md) so readers don’t mistake the Decision Log for something the human typed themselves. When overwriting an existing Decision Log comment, refresh this line — do not leave the old one in place.

    Comment format:

    ## Decision Log
    
    _Posted by {your identity} on behalf of @<github-or-jira-handle>._
    
    _Last updated: YYYY-MM-DD — Push SHA: {short-sha}_
    
    ### Planning
    - <decision: what was chosen and what was the alternative, e.g. "Chose REST over GraphQL — GraphQL deferred to follow-up">
    
    ### Implementation
    - <key implementation choice approved by the human>
    
    ### Review
    - <review outcome, e.g. "Deferred MEDIUM-3 to FOO-456">
    
    ### Open Items
    - <deferred item> — [FOO-456](link) or "no follow-up ticket yet"
    
    ⚠️ Pushed with --no-verify — pre-push hooks were bypassed.  ← include only if applicable
    

    Only include sections that have content. Omit empty sections entirely.

    If the ticket is a Linear issue:

    The Decision Log format is the same as the Jira version (same ## Decision Log header, same sections) — just in Markdown instead of Jira wiki markup.