agentleFS
abipalliabipalli/agent-skills/skills/pr/SKILL.md

pr

Skill1 starsChanged 18 days agoApache-2.0View on GitHub

Make a change and open a GitHub PR from a fork: sync the fork, branch, verify, push and open the PR upstream. Use for \"/pr\", \"create a PR\", \"open a pull request\".

  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

43 rules. About 0 are common, 29 are distinctive, and 14 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈29

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to turn the user's change context into a GitHub pull request using their fork as the head repository.

    line 12
  2. Very specific:

    Treat the text after /pr as the context for the change to implement.

    line 17
  3. Distinctive:

    Prefer doing the work end to end.

    line 18
  4. Very specific:

    Use the GitHub CLI (gh) and Git.

    line 20
  5. Distinctive:

    Keep the user's uncommitted work safe.

    line 22
  6. Distinctive:

    Use the repository's actual default branch.

    line 24
  7. Distinctive:

    Use a fork remote owned by the authenticated GitHub user.

    line 25
  8. Very specific:

    If the user did not provide a branch name, create one from the context using <type>/<ticket>-<short-kebab-slug>, or …

    line 45
  9. Distinctive:

    Run these checks before changing branches or remotes:

    line 57
  10. Distinctive:

    If the worktree is dirty:

    line 68
  11. Distinctive:

    If they are relevant, carry them forward carefully onto the PR branch.

    line 71
  12. Distinctive:

    If they are unrelated or hard to classify, pause and ask which changes belong in the PR.

    line 72
  13. Very specific:

    If the current GitHub repo is a fork, use its parent.nameWithOwner as the upstream target.

    line 79
  14. Very specific:

    If the upstream repository is already owned by GH_USER, a separate fork is not needed.

    line 93
  15. Distinctive:

    If it does not exist, create it:

    line 105
  16. Very specific:

    If no local remote points at the fork, add one.

    line 115
  17. Very specific:

    Avoid running gh repo fork --remote without --remote-name in an existing clone because it can rename the current origin remote.

    line 124
  18. Very specific:

    If gh repo sync reports that the fork default branch cannot be fast-forwarded, stop and explain the situation.

    line 137
  19. Distinctive:

    Create the feature branch from the synced fork default branch:

    line 143
  20. Very specific:

    Before creation, verify an inferred name contains the required slash-delimited type prefix.

    line 150
  21. Distinctive:

    If the requested branch already exists:

    line 153
  22. Distinctive:

    If relevant dirty work was present before the branch switch, verify it carried over cleanly with git status --short and git diff.

    line 158
  23. Distinctive:

    Run the narrowest meaningful verification first, then broader checks if the change touches shared behavior.

    line 173
  24. Distinctive:

    Commit only the intended files:

    line 177
  25. Distinctive:

    If the user already had relevant commits, do not rewrite them unless needed.

    line 184
  26. Very specific:

    Before pushing or opening a non-draft PR, run a reviewer-minded readiness pass over the final diff.

    line 188
  27. Distinctive:

    If the repository publishes a filtered or sanitized public tree, do public-tree files, Make targets, scenarios, and docs still work after …

    line 206
  28. Very specific:

    Do scripts fail fast for invalid flags, missing files/images/tools, contradictory options, unsupported platforms, and warm retries?

    line 209
  29. Distinctive:

    Do config/schema changes keep parsers, shell helpers, Terraform/cloud-init, docs, and tests aligned, including defaulted and legacy syntax …

    line 211
  30. Distinctive:

    If the pass finds material issues, fix them before creating or marking the PR ready.

    line 214
  31. Distinctive:

    Look for repository PR templates:

    line 243
  32. Distinctive:

    Use a template when one clearly applies.

    line 251
  33. Distinctive:

    No per-commit or per-review-round history.

    line 260
  34. Distinctive:

    Leave out: rationale essays, alternatives the reviewer did not ask about, review-tool round logs, and @-mentions (ping reviewers in Slack …

    line 262
  35. Distinctive:

    Create the PR from the fork branch to upstream default:

    line 285
  36. Very specific:

    Add --draft only when the user asked for a draft or the work is intentionally not ready for review.

    line 296
  37. Distinctive:

    Commit hash or short commit summary

    line 308
  38. Distinctive:

    If the PR could not be created, leave the branch and commits intact, explain the blocker, and give the exact next command or decision …

    line 312
  39. Very specific:

    Origin is already the user's fork: use origin as FORK_REMOTE.

    line 317
  40. Distinctive:

    User wants a PR for existing local commits: do not recreate the branch just for ceremony.

    line 322
  41. Distinctive:

    Protected upstream branch: never push the feature branch to upstream unless the user explicitly asks and has permission.

    line 326
  42. Very specific:

    Sync requires force: ask before gh repo sync --force.

    line 329
  43. Distinctive:

    No changes after implementation: do not create an empty PR.

    line 331

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

PR

Use this skill to turn the user's change context into a GitHub pull request using their fork as the head repository.

Operating Model

  • Treat the text after /pr as the context for the change to implement.
  • Prefer doing the work end to end. Ask a question only when the requested change or target repository is genuinely ambiguous.
  • Use the GitHub CLI (gh) and Git. Avoid browser-only PR creation unless the CLI is blocked.
  • Keep the user's uncommitted work safe. Inspect it, preserve it, and never reset, discard, or silently stash changes.
  • Use the repository's actual default branch. Do not assume main.
  • Use a fork remote owned by the authenticated GitHub user. If the current remote already points to that fork, reuse it instead of adding a duplicate.

Required Tools

  • git
  • Authenticated gh CLI with access to the target repository
  • Network access to GitHub

Workflow

1. Understand The Request

Identify:

  • The requested code or documentation change.
  • The target repository.
  • Any branch name, PR title, issue number, reviewers, labels, or draft/ready preference the user supplied.

If the user did not provide a branch name, create one from the context using <type>/<ticket>-<short-kebab-slug>, or <type>/<short-kebab-slug> when there is no ticket, for example feat/PROJ-361-session-threading or docs/demo-runbook. Infer the same type vocabulary used for Conventional Commit titles. The slash after the type is required; do not create flat names such as feat-PROJ-361-session-threading or generic agent-prefixed names such as codex/... or claude/.... Preserve an exact branch name when the user explicitly supplies one, and follow a stricter local repository convention when one exists.

2. Inspect Repository State

Run these checks before changing branches or remotes:

git rev-parse --show-toplevel
git status --short
git branch --show-current
git remote -v
gh auth status
gh repo view --json name,nameWithOwner,defaultBranchRef,parent,isFork,owner,url

If the worktree is dirty:

  • Decide whether the changes are part of the user's requested PR.
  • If they are relevant, carry them forward carefully onto the PR branch.
  • If they are unrelated or hard to classify, pause and ask which changes belong in the PR.

3. Identify Upstream And Fork

Determine the upstream repository that should receive the PR:

  • If the current GitHub repo is a fork, use its parent.nameWithOwner as the upstream target.
  • Otherwise, use the current repo's nameWithOwner as the upstream target.

Determine the authenticated GitHub user and desired fork repo:

GH_USER=$(gh api user --jq .login)
UPSTREAM_REPO=<owner/repo>
REPO_NAME=$(gh repo view "$UPSTREAM_REPO" --json name --jq .name)
DEFAULT_BRANCH=$(gh repo view "$UPSTREAM_REPO" --json defaultBranchRef --jq .defaultBranchRef.name)
FORK_REPO="$GH_USER/$REPO_NAME"

If the upstream repository is already owned by GH_USER, a separate fork is not needed. In that case, use the existing write remote as the head remote and still create a feature branch.

4. Create Or Reuse The Fork Remote

First check whether the fork exists:

gh repo view "$FORK_REPO" --json nameWithOwner,url

If it does not exist, create it:

gh repo fork "$UPSTREAM_REPO" --clone=false --default-branch-only

Find an existing local remote whose URL points at FORK_REPO. If one exists, use that as FORK_REMOTE. Common cases are origin, fork, or the user's login.

If no local remote points at the fork, add one. Prefer the name fork; if that name is already used for a different repository, use the GitHub login or a similarly clear name.

git remote add fork "https://github.com/$FORK_REPO.git"
FORK_REMOTE=fork

Avoid running gh repo fork --remote without --remote-name in an existing clone because it can rename the current origin remote. If you use --remote, pass an explicit remote name.

5. Sync The Fork Default Branch

Bring the fork's default branch up to date from upstream before branching:

gh repo sync "$FORK_REPO" --source "$UPSTREAM_REPO" --branch "$DEFAULT_BRANCH"
git fetch "$FORK_REMOTE" "$DEFAULT_BRANCH"

If gh repo sync reports that the fork default branch cannot be fast-forwarded, stop and explain the situation. Only use --force after explicit user approval, because it hard-resets the fork's default branch to upstream.

6. Create The PR Branch

Create the feature branch from the synced fork default branch:

git switch -c "$BRANCH_NAME" "$FORK_REMOTE/$DEFAULT_BRANCH"
git config "branch.$BRANCH_NAME.gh-merge-base" "$DEFAULT_BRANCH"

Before creation, verify an inferred name contains the required slash-delimited type prefix. Examples: fix/PROJ-410-finalization, chore/ci-cleanup.

If the requested branch already exists:

  • Reuse it if it clearly belongs to this task.
  • Otherwise create a unique suffix or ask before overwriting anything.

If relevant dirty work was present before the branch switch, verify it carried over cleanly with git status --short and git diff.

7. Make And Verify The Changes

Implement the requested change on the PR branch. Follow the repository's local instructions, style, and test conventions.

Before committing:

git diff
git status --short

Run the narrowest meaningful verification first, then broader checks if the change touches shared behavior. If tests cannot be run, record why for the PR body and final response.

Commit only the intended files:

git add <intended-files>
git commit -m "<concise commit message>"

If the user already had relevant commits, do not rewrite them unless needed.

7.5 PR Readiness Gate

Before pushing or opening a non-draft PR, run a reviewer-minded readiness pass over the final diff. Use deep-code-review as the shared home for this pass rather than duplicating a separate checklist here.

Marking an existing draft PR ready for review counts as opening a non-draft PR: run this gate then too, against the PR's current head at that moment, not the diff as it existed when the draft was opened.

Apply extra scrutiny to changes that touch manifest or config schemas, remote provisioning scripts, public/private repository filtering, sidecar or cross-service integration, or the repository's own high-risk areas named in its local instructions.

The gate should answer:

  • Can a reviewer reproduce the promised behavior from this branch, or are any stacked PRs, branch images, CI artifacts, secrets, hardware, or internal tools still required and documented?
  • If the repository publishes a filtered or sanitized public tree, do public-tree files, Make targets, scenarios, and docs still work after filtering, without leaking internal-only pipeline details?
  • Do scripts fail fast for invalid flags, missing files/images/tools, contradictory options, unsupported platforms, and warm retries?
  • Do config/schema changes keep parsers, shell helpers, Terraform/cloud-init, docs, and tests aligned, including defaulted and legacy syntax cases?

If the pass finds material issues, fix them before creating or marking the PR ready. If a live infra or hardware check is impossible, state the skipped check and residual risk in the PR body.

8. Push To The Fork Branch

Push the branch to the fork remote:

git push -u "$FORK_REMOTE" "$BRANCH_NAME"

Confirm the local branch is tracking the fork branch, not the upstream repo's protected branch:

git status --branch --short

9. Create The Pull Request

Prepare a PR title and body from the context, commits, and verification results. The PR title must use the Conventional Commits pattern: <type>[optional scope]: <description>, for example fix: handle empty repository names or chore(terraform): update branch protection. Prefer feat, fix, docs, chore, refactor, test, build, ci, perf, style, or revert as the type. When the user supplies a non-conventional title, convert it while preserving intent unless they explicitly ask for exact title wording. Look for repository PR templates:

if test -d .github; then
  find .github -maxdepth 3 \( -iname '*pull_request_template*' -o -path '.github/PULL_REQUEST_TEMPLATE/*' \)
fi

Use a template when one clearly applies. Either way, keep the body short; aim for under 40 lines including the template's checklists:

  • Summary: one to three sentences on what the PR does. Lead with the change, not the backstory. One clause of "why" at most.
  • Details: one bullet per change a reviewer must know about, a line or two each. Name the identifiers; skip what the diff already shows. Put a stack or dependency on one line (Stack: #A → **this PR**).
  • Testing: what passes at the current head, and what was not run and why. No per-commit or per-review-round history; replace the section on each push instead of appending to it.
  • Leave out: rationale essays, alternatives the reviewer did not ask about, review-tool round logs, and @-mentions (ping reviewers in Slack or a comment). Drop template subsections that do not apply instead of leaving empty headings.

Draft the body in a subagent on the sonnet tier (the mid-tier model of whatever runtime you are in), not in the main session. Give it the commits, the diff stat, the verification results, the template, and the rules above, and ask it to trim to the rules. Check its draft against the rules and the diff (every claim true at the current head) before showing it or using it. Use the same pass when rewriting a body after a push.

Without a template, use:

## Summary
- <what changed>

## Verification
- <commands run, or "Not run: <reason>">

## Notes
- <risks, rollout notes, or follow-ups if relevant>

Create the PR from the fork branch to upstream default:

gh pr create \
  --repo "$UPSTREAM_REPO" \
  --base "$DEFAULT_BRANCH" \
  --head "$GH_USER:$BRANCH_NAME" \
  --title "$PR_TITLE" \
  --body-file "$PR_BODY_FILE"

Add --draft only when the user asked for a draft or the work is intentionally not ready for review. If --head "$GH_USER:$BRANCH_NAME" is not accepted, fall back to the pushed remote branch that gh pr create can see and explain the adjustment.

10. Final Response

Report the outcome with:

  • PR URL
  • Upstream base: <UPSTREAM_REPO>:<DEFAULT_BRANCH>
  • Fork branch: <FORK_REPO>:<BRANCH_NAME>
  • Commit hash or short commit summary
  • Verification commands and results
  • Any skipped checks or follow-ups

If the PR could not be created, leave the branch and commits intact, explain the blocker, and give the exact next command or decision needed.

Common Edge Cases

  • Origin is already the user's fork: use origin as FORK_REMOTE; ensure an upstream remote exists or use --repo "$UPSTREAM_REPO" explicitly for PR creation.
  • Current repo is the fork: target the parent repo for the PR, sync this fork from the parent, and push the branch to this fork.
  • User wants a PR for existing local commits: do not recreate the branch just for ceremony. Ensure the fork remote exists, sync the fork default branch, rebase or merge only when appropriate, push the current branch to the fork, and create the PR.
  • Protected upstream branch: never push the feature branch to upstream unless the user explicitly asks and has permission. The default path is always the fork branch.
  • Sync requires force: ask before gh repo sync --force; it rewrites the fork's default branch.
  • No changes after implementation: do not create an empty PR. Explain that the repository already has the requested behavior or that the requested change could not be reproduced.

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.