agentleFS
shep-aishep-ai/shep/.claude/skills/shep-kit-commit-pr/SKILL.md

shep-kit:commit-pr

Skill262 starsChanged 8 months agoMITView on GitHub

Use when ready to commit, push, and create a PR with CI verification. Triggers include "commit and pr", "push pr", "create pr", "ship it", or when implementation is complete and needs CI validation. Watches CI and auto-fixes failures. Part of the Shep autonomous SDLC platform — https://shep.bot

  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. About 0 are common, 19 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create commit, push branch, open PR, watch CI, then autonomously handle review feedback until approval.

    line 14
  2. Distinctive:

    Follow conventional commits.

    line 89
  3. Very specific:

    Release-aware type selection: Only feat and fix trigger semantic release.

    line 91
  4. Distinctive:

    Test plan with checkboxes

    line 103
  5. Distinctive:

    Analyze root cause: Read the error, understand the issue

    line 122
  6. Distinctive:

    After CI passes, wait for review comments (bot and human), then classify them.

    line 132
  7. Distinctive:

    If the Claude Code Review check does not appear within 5 minutes, skip Phase A and proceed to Phase B (the review may not be configured for …

    line 145
  8. Distinctive:

    No reviews at all: after waiting 2 minutes past bot check completion → Done.

    line 190
  9. Distinctive:

    If there ARE actionable comments, continue to Step 7.

    line 192
  10. Very specific:

    GitHub suggestion blocks: Read the suggested code from the suggestion block.

    line 200
  11. Distinctive:

    Change instructions: Read the comment, understand the requested change, apply it to the referenced file/line.

    line 201
  12. Distinctive:

    If a comment references an outdated diff, re-read the current file and apply the fix if still relevant.

    line 204
  13. Distinctive:

    If CI fails, enter the fix loop (Step 5) until CI passes, then continue.

    line 230
  14. Distinctive:

    After CI passes, return to Step 6 to check for new review comments on the updated code.

    line 234
  15. Distinctive:

    Don't claim "PR created" without watching CI

    line 257
  16. Distinctive:

    Don't abandon after first CI failure

    line 258
  17. Distinctive:

    Don't push broken code hoping "CI will pass this time"

    line 259
  18. Distinctive:

    Don't skip the watch step "to save time"

    line 260
  19. Distinctive:

    Don't skip the review watch after CI passes

    line 261
  20. Distinctive:

    Don't apply fixes without tracking comment IDs

    line 262
  21. Distinctive:

    Don't exceed max iterations (default 5) without stopping

    line 263

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Commit, Push, PR with CI Watch + Review Loop

Create commit, push branch, open PR, watch CI, then autonomously handle review feedback until approval.

Workflow

digraph commit_pr_flow {
    rankdir=TB;
    node [shape=box];

    start [label="Start" shape=ellipse];
    on_main [label="On main branch?" shape=diamond];
    create_branch [label="Create feature branch"];
    stage [label="Stage changes"];
    commit [label="Create commit"];
    push [label="Push with -u"];
    create_pr [label="Create PR (gh pr create)"];
    watch_ci [label="Watch CI (gh run watch --exit-status)"];
    ci_pass [label="CI passed?" shape=diamond];
    analyze_failure [label="Analyze failure logs"];
    fix_issue [label="Fix the issue"];
    commit_fix [label="Commit fix"];
    push_fix [label="Push fix"];

    review_watch [label="Step 6: Wait for reviews\n(bot + human)"];
    has_actionable [label="Actionable\ncomments?" shape=diamond];
    apply_fixes [label="Step 7: Apply fixes,\ncommit, push"];
    max_iter [label="Max iterations?" shape=diamond];
    done [label="Done - PR approved" shape=ellipse];
    stop [label="Stop - notify user" shape=ellipse];

    start -> on_main;
    on_main -> create_branch [label="yes"];
    on_main -> stage [label="no"];
    create_branch -> stage;
    stage -> commit;
    commit -> push;
    push -> create_pr;
    create_pr -> watch_ci;
    watch_ci -> ci_pass;
    ci_pass -> analyze_failure [label="no"];
    analyze_failure -> fix_issue;
    fix_issue -> commit_fix;
    commit_fix -> push_fix;
    push_fix -> watch_ci [label="CI fix loop"];

    ci_pass -> review_watch [label="yes"];
    review_watch -> has_actionable;
    has_actionable -> done [label="no / approved"];
    has_actionable -> apply_fixes [label="yes"];
    apply_fixes -> watch_ci [label="push + watch CI"];
    apply_fixes -> max_iter;
    max_iter -> stop [label="yes"];
    max_iter -> watch_ci [label="no"];
}

Steps

1. Branch Check

CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" = "main" ]; then
    # Create descriptive branch from changes
    git checkout -b <branch-name>
fi

2. Stage & Commit

git add <specific-files>  # Prefer specific files over -A
git commit -m "<type>(<scope>): <description>"

Follow conventional commits. Commit message must be lowercase.

Release-aware type selection: Only feat and fix trigger semantic release. If the change is visible to end users (UI, CLI output, API behavior), you MUST use feat or fix — never style, refactor, or chore. See .claude/rules/commit-conventions.md for the full decision table.

3. Push & Create PR

git push -u origin $(git branch --show-current)
gh pr create --title "<title>" --body "<body>"

PR body should include:

  • Summary section with bullet points
  • Test plan with checkboxes

4. Watch CI (Critical)

# Get the latest run ID for current branch
gh run list --limit 5  # Find the run ID
gh run watch <run-id> --exit-status

MUST wait for CI to complete. The --exit-status flag returns non-zero if CI fails.

Note: gh run watch requires a run ID when not in interactive terminal.

5. Fix-Push-Watch Loop

If CI fails:

  1. Get failure logs: gh run view <run-id> --log-failed
  2. Analyze root cause: Read the error, understand the issue
  3. Fix the issue: Make necessary code changes
  4. Commit the fix: git commit -m "fix(<scope>): <what was fixed>"
  5. Push: git push
  6. Get new run ID: gh run list --limit 1
  7. Watch again: gh run watch <new-run-id> --exit-status
  8. Repeat until CI passes

6. Review Watch

After CI passes, wait for review comments (bot and human), then classify them.

Phase A — Wait for review check to complete:

# Wait for all checks including Claude Code Review to complete
gh pr checks --watch --fail-fast

# Fallback: poll for the review workflow directly
gh run list --workflow=claude-code-review.yml --limit 1 --json status,conclusion \
  --jq '.[0] | {status, conclusion}'

If the Claude Code Review check does not appear within 5 minutes, skip Phase A and proceed to Phase B (the review may not be configured for this repo).

Phase B — Fetch all reviews from the three GitHub API endpoints:

# 1. PR reviews (state, body, author)
gh api repos/{owner}/{repo}/pulls/{number}/reviews \
  --jq '.[] | {id, state, user: .user.login, user_type: .user.type, body}'

# 2. Inline review comments (file, line, content)
gh api repos/{owner}/{repo}/pulls/{number}/comments \
  --jq '.[] | {id, path, line, body, user: .user.login, user_type: .user.type, diff_hunk}'

# 3. Issue-level comments on the PR
gh api repos/{owner}/{repo}/issues/{number}/comments \
  --jq '.[] | {id, body, user: .user.login, user_type: .user.type}'

Replace {owner}, {repo}, and {number} with actual values from the PR URL.

Identify reviewers:

  • Bot reviewer: user.login == "claude[bot]" or user.type == "Bot"
  • Human reviewer: user.type != "Bot"

Process comments from both bot and human reviewers.

Classify each comment as actionable or non-actionable:

TypeActionable?Handling
GitHub suggestion blockYes (direct)Apply the suggested code as a line replacement
Change instructionYesInterpret the request and apply the change
Bug reportYesAnalyze the issue, add the fix
Style feedbackYes (low)Apply the style correction
QuestionNoSkip — non-actionable
PraiseNoSkip — non-actionable
FYI / informationalNoSkip — informational only

GitHub suggestion blocks (```suggestion ... ```) are a special case: they contain exact replacement code mapped to the comment's path and line fields. Apply them directly as file edits.

Exit conditions (no fix loop needed):

  • Any reviewer submitted APPROVED state → Done. PR is approved.
  • No actionable comments found (all praise, questions, or informational) → Done. PR is clean.
  • No reviews at all after waiting 2 minutes past bot check completion → Done. Proceed.

If there ARE actionable comments, continue to Step 7.

7. Review Fix Loop

Apply fixes for all actionable review comments, commit, push, and loop until resolved.

7.1 Apply fixes for each actionable comment:

  • GitHub suggestion blocks: Read the suggested code from the ```suggestion ``` block. Apply it as a direct line replacement at the comment's path and line.
  • Change instructions: Read the comment, understand the requested change, apply it to the referenced file/line.
  • Bug reports: Analyze the reported issue, implement the fix.

If a comment references an outdated diff, re-read the current file and apply the fix if still relevant. Skip if the issue no longer applies.

7.2 Commit all fixes for this iteration:

git add <modified-files>
git commit -m "$(cat <<'EOF'
fix(review): address PR review feedback (iteration N/M)

Addressed review comments:
- [bot] path/file.ts:42 - description of fix
- [human] path/other.ts:15 - description of fix
EOF
)"
git push

Replace N with current iteration number and M with max iterations (default 5).

7.3 Watch CI again (reuse Step 4):

gh run list --limit 1 --json databaseId --jq '.[0].databaseId'
gh run watch <run-id> --exit-status

If CI fails, enter the fix loop (Step 5) until CI passes, then continue.

7.4 Loop back to Step 6:

After CI passes, return to Step 6 to check for new review comments on the updated code.

Loop control parameters:

ParameterDefaultDescription
maxIterations5Maximum review-fix cycles before stopping
reviewWaitTimeout120sTime to wait for reviews after bot check completes
pollInterval30sPolling interval when waiting for review checks

Comment-ID deduplication: Track which comment IDs were addressed in each iteration. If the same comment IDs reappear after a fix attempt, the fix did not resolve the issue — exit with convergence failure.

All exit conditions (in priority order):

  1. Approved — Any reviewer submits APPROVED state → Done (success)
  2. No actionable comments — All remaining comments are non-actionable → Done (success)
  3. Max iterations reached — Stop, notify user with summary of remaining issues
  4. Convergence failure — Same comment IDs reappear after fix → Stop, notify user
  5. No reviews received — Timeout with no new reviews → Done (assumed clean)
  6. Merge conflict — git push fails due to conflicts → Stop, notify user

Red Flags - STOP

  • Don't claim "PR created" without watching CI
  • Don't abandon after first CI failure
  • Don't push broken code hoping "CI will pass this time"
  • Don't skip the watch step "to save time"
  • Don't skip the review watch after CI passes
  • Don't apply fixes without tracking comment IDs
  • Don't exceed max iterations (default 5) without stopping

Quick Reference

CommandPurpose
gh run list --limit 5List recent runs with IDs
gh run watch <id> --exit-statusWatch CI, exit 1 if fails
gh run view <id> --log-failedGet failure logs
gh pr view --webOpen PR in browser
gh pr checks --watch --fail-fastWait for all checks to complete
gh api repos/{o}/{r}/pulls/{n}/reviewsFetch PR reviews (state, body)
gh api repos/{o}/{r}/pulls/{n}/commentsFetch inline review comments
gh api repos/{o}/{r}/issues/{n}/commentsFetch issue-level PR comments

Example

# Stage and commit
git add src/feature.ts tests/feature.test.ts
git commit -m "feat(cli): add new command"

# Push and create PR
git push -u origin feat/new-command
gh pr create --title "feat(cli): add new command" --body "..."

# Watch CI
gh run watch --exit-status
# If fails, fix and repeat

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.