chunk-pr — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited chunk-pr (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Break one big PR into a sequence of small, logical, merge-safe PRs. Suggest, don't decide — the user approves every chunk and every destructive action.
_Read ~/.claude/skills/chunk-pr/preferences.md using the Read tool. If not found, no preferences are set._
_On startup, use Bash to detect: current branch (git branch --show-current), base upstream, commits ahead, total lines changed (git diff {base}...HEAD --shortstat), and repo (gh repo view --json nameWithOwner -q .nameWithOwner). Skip any that fail. Do NOT run destructive commands at this stage._
Check $ARGUMENTS:
~/.claude/skills/chunk-pr/preferences.md, confirm, stop$ARGUMENTS)conservative (more/smaller), balanced (default), aggressive (fewer/larger)--draft)234), PR URL, branch name, or commit range (main..HEAD). If omitted, use current branch.Chunk PR — Split a big PR into a sequence of smaller, merge-safe ones
Usage:
/chunk-pr Analyze current branch
/chunk-pr <pr-number> Analyze a specific PR
/chunk-pr <pr-url> Analyze a PR by URL (same or other repo)
/chunk-pr <branch> Analyze a local branch
/chunk-pr main..HEAD Analyze a commit range
/chunk-pr --max-lines 300 Prefer chunks under 300 lines
/chunk-pr --strategy conservative More, smaller chunks
/chunk-pr --dry-run Plan only — don't touch git
/chunk-pr config Set preferences
/chunk-pr reset Clear preferences
/chunk-pr help This help
What it does:
1. Identify the subject PR / branch / range
2. Classify commits and files into logical groups
3. Propose an ordered, dependency-aware split plan
4. Let you approve, reorder, merge, or re-split chunks
5. On approval, create branches + draft PRs + Linear links
6. Leave the parent branch untouched
Current preferences:
(shown above under Preferences)Use `AskUserQuestion`:
Q1 — "Target max lines per chunk?" (200, 400 (default), 600, 1000, no limit)
Q2 — "Default split strategy?" (conservative, balanced (default), aggressive)
Q3 — "Default action after plan approval?" (per-chunk confirm (default), execute all, branches only no PRs, plan only)
Q4 — "Branch naming convention for chunks?"
{parent}/chunk-{N}-{slug} (default — e.g. user/ais-810-refactor/chunk-1-schema){parent}-{N} (short — e.g. user/ais-810-refactor-1)chunk/{slug} (flat — e.g. chunk/schema){parent}, {N}, {slug} placeholders)Q5 — "Link chunks to parent Linear issue?" (Yes as sub-items (default), Yes as relates-to, No, Ask each time)
Q6 — "Default PR type for chunks?" (draft (default), ready for review)
Q7 — "Classification weighting?" (by file type (default), by commit topic, hybrid)
Save to ~/.claude/skills/chunk-pr/preferences.md.
Delete ~/.claude/skills/chunk-pr/preferences.md and confirm: "Preferences cleared. Using defaults."
If no preferences file exists, show: "First time using /chunk-pr? Run /chunk-pr config to set defaults, or just continue — I'll pick sensible defaults."
Then proceed.
Resolve in order:
https://github.com/*/pull/N) → use gh pr view <url> --json ... or WebFetch for external repos.gh pr view <N> on current repo...) → use it directly with git log/git diff.{base}..{$1}.Early bail-outs:
From git / gh:
git log {base}..{head} --pretty=format:"%H|%s|%an|%ai" --numstatgit diff {base}...{head} --numstat and --statgit diff {base}...{head} — read in chunks if hugegh api repos/{owner}/{repo}/pulls/{N}/commentsFrom Linear (unless --no-linear):
get_issue for title, description, project, sub-issues, related issuesBase branch detection (same as /create-pr):
--base flag → preference → upstream tracking → repo default branchFile-based classification (default weighting):
| Group | Patterns (examples) |
|---|---|
schema | **/migrations/**, **/schemas/**, drizzle/**, prisma/**, *.sql |
api | src/router/**, src/api/**, src/handlers/**, src/server/** |
ui | src/components/**, src/app/**, **/*.tsx, **/*.css |
tests | **/__tests__/**, **/*.test.*, **/*.spec.*, e2e/** |
docs | **/*.md, docs/**, README*, CHANGELOG* |
config | package.json, tsconfig*.json, .env.example, vite.config.*, next.config.*, CI workflows |
deps | pnpm-lock.yaml, package-lock.json, yarn.lock — bundle with config |
refactor | commits whose message starts with refactor:/chore: AND whose diff is behavior-preserving (renames, moves, type-only) |
other | anything unmatched |
Commit-based signals (boost classification):
feat:/fix:/refactor:/chore:/test:/docs:)feat(meetings): ...) — use scope as a chunk hintCross-cutting flag — if a single file appears in multiple groups' commits, flag it. These are the hardest to split cleanly and usually belong in the earliest chunk.
Classification presets:
by file type (default) — group by the table aboveby commit topic — group by conventional scope (meetings, knowledge, auth)hybrid — topic first, then file-type within a topicRead the diff itself (via Read/Grep where needed) when the filename isn't enough to classify — e.g. a .ts file could be API or UI.
Build an ordered list. Ordering rules:
config/deps first if they unblock later chunksschema before api before uirefactor before feature commits that depend on the refactortests bundle with the behavior they cover (don't create a tests-only chunk unless the tests pre-existed and were just moved)docs lastFor each chunk, produce:
Chunk {N}: {title with conventional prefix}
Scope: {1-2 sentences}
Commits: {N} ({oldest-SHA}..{newest-SHA})
Files: {N} files, +{added}/-{removed} lines
Depends on: Chunk {N-1} or "none"
Safe to ship: yes / yes-behind-flag / only-after-{N}
Rationale: {why this grouping}
Risks: {conflicts, cross-cutting files, behavior change}Size policing — if a chunk exceeds max-lines:
Conflict forecasting — if two chunks both touch the same file at overlapping lines, call it out; the later chunk will need a rebase after the earlier one lands.
Present the full plan as a compact, numbered list the user can react to.
Use `AskUserQuestion` to get the call. Options:
aggressive / conservativeLoop until the user approves or cancels. Keep iterations cheap — don't re-fetch git/Linear state between iterations unless the user changes scope.
Optional: if Chrome MCP is set up and the user asks, open the original PR in a tab via tabs_create_mcp for visual cross-reference while reviewing the plan. Do not open Chrome by default — it's noisy.
Pre-flight (non-negotiable):
git status must be clean — else stop and ask (per global rule)Per chunk, with per-chunk confirmation (unless preference says "execute all"):
git checkout {base} && git pull --ff-only origin {base}git checkout -b {chunk-branch-name} (using preferred naming convention)git cherry-pick {sha1} {sha2} ... Resolve conflicts if they appear — ask the user, never force.
For each file: git checkout {head} -- {path} (or for partial-file: git checkout -p {head} -- {path}) Then a single git commit -m "{chunk-title}" with an accurate, non-generic message.
git diff {base}...HEAD --shortstat, git log {base}..HEAD --oneline. Never run pnpm build or pnpm dev (global rule).--no-push): git push -u origin {chunk-branch}--no-push or --no-pr):gh pr create --draft --base {base} --title "{title}" --body "{body}" PR body includes:
Part {N}/{total} of splitting #{original-pr} (or the parent branch)Depends on: #{previous-chunk-pr-number} if applicableupdate_issue (links array)create_comment on the parent issue listing all chunk PRs once execution finishesBetween chunks, return to the base branch before creating the next chunk's branch. Never branch off a previous chunk unless the plan explicitly says so ("depends on chunk N").
Chunked {source} into {count} PRs:
1. [#{N}]({url}) — {title} ({lines} lines, depends on: none)
2. [#{N}]({url}) — {title} ({lines} lines, depends on: #{N-1})
...
Parent branch: {branch} (untouched)
Parent PR: {original, if any}
Linear: {issue-id} — {count} PR(s) linked
Original HEAD: {sha} ← rollback anchor
Recommended merge order: top to bottom. Rebase each after the previous lands.Save preferences silently when the user:
--max-lines or --strategy twice in a row → update defaultsdry-runMention: "Noted: you prefer {X}. Saved for next time."
Depends on.git checkout {ref} -- {path}. Don't reconstruct diffs by hand — it loses authorship, dates, and commit messages.pnpm build/pnpm dev. No git add -A. No generic commit messages. No regex for IDs. If a test or typecheck fails, fix it — don't skip.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.