agentleFS
vhmarquezvhmarquez/argo/skills/pr-prepare/SKILL.md

pr-prepare

Skill1 starsChanged 7 months agoMITView on GitHub

Prepare a pull-request body from the current branch — runs /code-review pr, /test-coverage diff, /diff-deploy --validate, /security-scan, and assembles a Markdown PR body with summary, test plan, and gate results. Optionally posts via `gh pr create` if confirmed.

  • 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

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If there are no changes vs the base, exit 2 with a clear message.

    line 37
  2. Very specific:

    Cite sub-skill outputs: If /code-review flagged a critical, the PR body shows it in Summary so the reviewer doesn't have to dig

    line 132
  3. Distinctive:

    Skip "ADRs" section if none added: Don't pad the body with empty sections

    line 134

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

You are preparing a pull-request body. The body is assembled from the outputs of several argo skills and presented as a single Markdown ready to paste (or push via gh).

Read Project Config First

source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
PROJECT_NAME="$(sf_config_get '.project.name' "$ENV")"
DEFAULT_ORG="$(sf_config_get '.platform.defaultTargetOrg' "$ENV")"

Input

$ARGUMENTS:

  • (empty) — generate PR body from current branch vs main
  • --vs <ref> — base ref (default main)
  • --out <path> — write to file (default stdout)
  • --push — after generating, run gh pr create with the body (only if gh CLI is installed and authed)
  • --target-org <alias> / --env <name> — for the deploy validation step
  • --no-validate — skip the deploy validation step (useful when prod can't be hit)

Steps

1. Compute git context

BASE="${VS:-main}"
HEAD_REF=$("$GIT" rev-parse --abbrev-ref HEAD)
CHANGED_FILES=$("$GIT" diff --name-only "$BASE...HEAD")
COMMIT_COUNT=$("$GIT" rev-list --count "$BASE...HEAD")

If there are no changes vs the base, exit 2 with a clear message.

2. Run the skill chain in parallel (where possible)

/argo:code-review pr --ci --format json --out /tmp/pr-review.json
/argo:coverage-trend diff --vs "$BASE" --ci > /tmp/pr-coverage.json
/argo:diff-deploy --vs "$BASE" --validate --target-org "$DEFAULT_ORG" --ci > /tmp/pr-deploy.json
/argo:security-scan --ci --format json --out /tmp/pr-security.json

Capture exit codes — they become PR-body badges.

3. Synthesize summary from commits

"$GIT" log "$BASE...HEAD" --pretty='format:%s' | grep -E '^(feat|fix|perf|refactor)' | head -5

Map prefixes to bullet labels:

  • feat: → "Adds"
  • fix: → "Fixes"
  • perf: → "Speeds up"
  • refactor: → "Refactors"

4. Assemble the body

## Summary

- Adds: paginated organizations table with status filter (acmeOrgList LWC, OrgController Apex)
- Fixes: Order_Item__c master-detail cascade delete bug (OrderTriggerHandler)
- Refactors: extracted shared retry policy into RetryPolicy.cls

(Drawn from <COMMIT_COUNT> commits since `<BASE>`.)

## Test plan

- [x] LWC unit tests pass (Jest, 47 tests, 0 failures)
- [x] Apex unit tests pass (run via /argo:test-coverage)
- [x] Apex coverage at or above target (87.7% overall, target 85%)
- [x] /argo:code-review pr — no critical findings
- [x] /argo:diff-deploy --validate against DevSandbox succeeded
- [x] /argo:security-scan — no critical findings
- [ ] Manual smoke (browser) — _reviewer to verify the LWC renders against acmeOrgList page_

## Gates

| Gate | Status |
|------|--------|
| Code review (PR scope) | ✅ no critical |
| Coverage trend         | ✅ +0.2% overall, OrderApiClient regressed -8.7% (still > target) |
| Deploy validation      | ✅ 12 components, tests passed |
| Security scan          | ⚠️ 1 medium (SEC-USE-NAMED-CRED in legacy file — pre-existing) |

## Components changed

- LightningComponentBundle: acmeOrgList (new), acmeOrgRow (new)
- ApexClass: OrgController (new), OrgService (new), OrderTriggerHandler (modified)
- CustomObject (field-only changes): Order_Item__c.Discount_Pct__c (new)

## ADRs

(no new ADRs in this PR)

## Risk

- **Risk level**: Medium (master-detail relationship change on Order_Item__c)
- **Reversibility**: Backfill query + destructive change available; documented in ADR-0011
- **Mitigation**: validate against sandbox first, deploy off-hours

🤖 Body generated by /argo:pr-prepare. Re-run after pushing changes.

If --push:

gh pr create --title "$(git log -1 --format=%s)" --body "$(cat /tmp/pr-body.md)"

The title comes from the latest commit subject by default; user can override.

5. Output

Stdout (or --out file): the assembled Markdown. CI mode: same body, plus exit 1 if any gate failed.

Exit codes

  • 0 — body generated, all gates pass
  • 1 — body generated, at least one gate failed (caller decides whether to push anyway)
  • 2 — invocation error (no diff vs base, sub-skill failures)

Rules

  • Always include the Test plan as an unchecked list for the reviewer's manual smoke step. Automation can check most rows; the reviewer keeps the last one
  • Don't auto-push without --push. Generating ≠ pushing; the user reviews first
  • Cite sub-skill outputs. If /code-review flagged a critical, the PR body shows it in Summary so the reviewer doesn't have to dig
  • Don't include the AI co-author footer in the PR body. Strip lines matching ^Co-Authored-By: from the synthesized commit-subject summary
  • Skip "ADRs" section if none added. Don't pad the body with empty sections

Consumers

  • Devs run before opening a PR
  • CI runs to gate PR merges (looks for the body to be present and gates to pass)

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.