Code and Plan Review Skill

  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 pull request. After a successful push, open a PR using gh pr create (or equivalent). Capture the PR URL. If the PR creation fails, skip Steps 7 and 8 and warn the human.

7b. Bot review loop (draft PRs only).

This step only applies when the PR was opened as a draft. If the PR is not a draft, skip to Step 8. If /critique was invoked recursively from within this loop (e.g., by /address-pr-comments or /resolve-ci-failures), skip Step 7b entirely — the bot loop is already running in the parent invocation.

After the draft PR is open, wait for automated reviewers (bots, linters, CI) to post their feedback:

  1. Estimate the wait time based on PR size and recent CI history:

    a. Measure the PR size:

       gh pr diff {number} --patch | wc -l
    

    Classify: small (< 200 lines), medium (200–800 lines), large (> 800 lines).

    b. Sample recent CI run durations from the last 5 completed workflow runs on the repo’s default branch:

       gh run list --branch {default_branch} --status completed --limit 5 --json databaseId,updatedAt,createdAt
    

    For each run, compute duration = updatedAt - createdAt in minutes. Take the median as the baseline CI duration.

    c. Compute the wait estimate:

    d. Announce the estimate: “Based on recent CI runs (median: {N}min) and PR size ({size}), waiting {estimate} minutes for bot reviews on {PR_URL}. Say ‘skip’ to proceed immediately or give me a different number.”

    e. Use ScheduleWakeup with the final delay (converted to seconds) to set the timer.

  2. When the timer fires, run the feedback loop:
  3. Mark the PR as ready for review:
  4. 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.

  5. 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 or /build during this session (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 a Farty Bobo identity line 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 Farty Bobo 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.