agentleFS
leshchenko1979leshchenko1979/fast-mcp-telegram/.cursor/skills/sourcery-pr-cycle/SKILL.md

sourcery-pr-cycle

Skill50 starsChanged 4 months agoMITView on GitHub

Runs the PR creation and Sourcery AI review loop until merge-ready: open PR with gh, poll checks and comments, fix blocking issues, push, re-request review, repeat. Use when the user asks to create a PR, run the Sourcery cycle, address Sourcery review comments, or get a branch merge-ready after review.

  • Reads credentials
  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Run exit tests/commands from the approved plan before every commit and push.

    line 44
  2. Distinctive:

    If fixes changed behavior, re-run exits after fixes and before commit.

    line 46
  3. Very specific:

    Use gh for all GitHub operations.

    line 52
  4. Distinctive:

    Check whether the branch tracks remote and is up to date.

    line 61
  5. Very specific:

    Commit rules: Only commit when the user asks.

    line 81
  6. Distinctive:

    Wait several minutes after triggering before expecting new results.

    line 107
  7. Distinctive:

    Version bumps: If Sourcery flags a version bump, ask the user before changing version files.

    line 121
  8. Distinctive:

    Use sourcery-pr-review-analysis to build a status table (Fixed / Not done / Skipped) before implementing.

    line 123
  9. Distinctive:

    After fixes, run code-reviewer (readonly) when the diff is non-trivial — aligns with implementation-workflow step 5 closeout.

    line 125
  10. Distinctive:

    Only when the user asked to commit:

    line 131
  11. Distinctive:

    After pushing fixes, trigger a fresh review:

    line 152

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Sourcery PR Cycle

End-to-end loop: open PR → Sourcery review → fix → push → re-review → repeat → merge.

For triage and status tables on individual comments, read sourcery-pr-review-analysis. This skill is the workflow loop only.

When to use

  • User asks to create a PR or run the Sourcery review cycle
  • Post-implementation work is done and the branch needs merge readiness
  • Sourcery left comments and the user wants fixes + another review pass

Cycle checklist

Copy and track progress:

PR + Sourcery cycle:
- [ ] 1. Pre-push: exit tests green
- [ ] 2. Create PR (gh push + gh pr create)
- [ ] 3. Wait / poll Sourcery (checks + comments)
- [ ] 4. Triage comments; fix blocking issues
- [ ] 5. Pre-push: exit tests green again
- [ ] 6. Commit + push fixes
- [ ] 7. Request new Sourcery review
- [ ] 8. Repeat 3–7 until clean
- [ ] 9. Closeout + merge when ready

1. Pre-push gate (every push)

Run exit tests/commands from the approved plan before every commit and push. Do not push with failing exits.

If fixes changed behavior, re-run exits after fixes and before commit.


2. Create the PR

Use gh for all GitHub operations. Before creating the PR, gather branch state in parallel:

git status
git diff
git log --oneline -10
git diff main...HEAD   # or master — use repo default base

Check whether the branch tracks remote and is up to date.

Push and create (sequential):

git push -u origin HEAD

gh pr create --title "the pr title" --body "$(cat <<'EOF'
## Summary
- ...

## Test plan
- [ ] ...

EOF
)"

Return the PR URL to the user.

Commit rules: Only commit when the user asks. Never commit secrets (.env, tokens, acl.dev.yaml with real bearers).


3. Wait for / check Sourcery

Sourcery runs after the PR exists. Poll until the review finishes or stale.

CI / check status:

gh pr checks <N>

Review comments (issue-level, from sourcery-ai[bot]):

gh api repos/{owner}/{repo}/pulls/<N>/comments --jq '.[] | select(.user.login=="sourcery-ai[bot]") | .body'

Grouped review body (top-level suggestions):

gh api repos/{owner}/{repo}/pulls/<N>/reviews --jq '.[] | select(.user.login=="sourcery-ai[bot]") | .body'

Wait several minutes after triggering before expecting new results. Full fetch/triage commands: reference.md.


4. Triage and fix

Default: always fix post-review blocking issues unless the user explicitly narrows scope.

PriorityTypesAction
1 — Blockingbug_risk, security, correctnessAlways fix
2 — Qualitytesting on changed codeFix when straightforward
3 — Optionalcomplexity, suggestion, styleFix only if user said "do all"; otherwise ask or skip with brief reason

Version bumps: If Sourcery flags a version bump, ask the user before changing version files. Do not bump silently.

Use sourcery-pr-review-analysis to build a status table (Fixed / Not done / Skipped) before implementing.

After fixes, run code-reviewer (readonly) when the diff is non-trivial — aligns with implementation-workflow step 5 closeout.


5. Commit and push fixes

Only when the user asked to commit:

git status
git diff
git log --oneline -5
git add <relevant files>
git commit -m "$(cat <<'EOF'
fix: address Sourcery review on <topic>

EOF
)"
git push

Re-run exit tests before push (step 1).


6. Request another Sourcery review

After pushing fixes, trigger a fresh review:

gh pr comment <N> --body "@sourcery-ai review"

Then return to step 3 (poll checks and comments).


7. Repeat until merge-ready

Loop 3 → 4 → 5 → 6 until:

  • gh pr checks are green (or only known/flaky exceptions the user accepts)
  • All blocking Sourcery items are fixed or explicitly deferred by the user
  • Exit tests pass on the final branch state

Optional refactors left open: document in PR comment or triage table with reason.


8. Phase close — merge

Merge when checks are green and blocking review items are resolved.

Closeout (matches implementation-workflow step 5):

#Check
1Diff matches approved plan; no unapproved scope
2Re-run exit commands on final state
3Fix blocking findings only; no scope creep
4Update docs / memory bank if the plan required it

Merge via user-preferred method (gh pr merge, squash, etc.) when the user asks.


Related skills

SkillRole
sourcery-pr-review-analysisTriage tables, fetch patterns, categorization
release-notesVersion bump + release after merge (not part of this loop); before Telegram posts, see release-notes CI gate
implementation-workflowPlan approval, exit tests, step 5 closeout

Additional resources

  • reference.md — gh command snippets and poll helpers

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.