code/chunk-pr/SKILL.md
--- name: chunk-pr description: >- Analyzes a large pull request (or branch, or commit range) and proposes a sequence of smaller, logically-grouped, merge-safe PRs following review best practices — dependency first, one concern per PR, mergeable in order. Suggests a plan; the user approves. On approval, creates chunk branches, cherry-picks commits, pushes, opens draft PRs, and links them to the parent Linear issue. Use when a PR is too big to review, when a branch has accumulated unr
npx skillsauth add mostafa-drz/claude-skills code/chunk-prInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
help → display help then stopconfig → interactive setup then stopreset → delete ~/.claude/skills/chunk-pr/preferences.md, confirm, stop$ARGUMENTS)--base <branch> — override target base (default: auto-detect or preference)--max-lines <N> — target max lines per chunk (default: 400 or preference)--strategy <kind> — conservative (more/smaller), balanced (default), aggressive (fewer/larger)--dry-run / --plan-only — stop after presenting the plan; don't create branches or PRs--draft — open chunks as draft PRs (default)--ready — open chunks as ready-for-review (overrides --draft)--no-push — create local branches only, skip push/PR creation--no-linear — skip Linear linking234), 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:
$1 looks like a PR URL (https://github.com/*/pull/N) → use gh pr view <url> --json ... or WebFetch for external repos.$1 is a number → gh pr view <N> on current repo.$1 is a commit range (contains ..) → use it directly with git log/git diff.$1 is a branch name → treat as {base}..{$1}.$1 → use current branch vs. its upstream/default-base.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.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.development
--- name: triage-board description: >- Generates a structured triage artifact from the current conversation's findings — a self-contained Desktop folder with a JSON Schema, schema-conformant report.json, prose markdown, and a single-file HTML viewer. Viewer ships with MD / CSV / JSON download buttons in the header and a per-finding "Copy as Markdown" action that produces a GitHub/Linear/Notion-ready ticket block. Stateless — triage state lives in the user's ticket system, not in the
development
Runs a beginner-mind end-to-end UI audit of any running app — local dev server, staging, production, or a specific URL. Drives Chrome through every interactive element on the target surface, collects structured findings (severity, category, where, symptom, impact, repro, triage), and hands the result off to `/triage-board` which produces the Desktop folder (schema + JSON + Markdown + single-file HTML viewer with MD/CSV/JSON exports and a per-finding Copy as Markdown button). Use when you want fresh-eyes verification of a feature, page, modal, flow, branch, or whole app — before shipping, before review, before a demo, or any time the UI deserves a careful poke.
development
Reviews the user's past Claude Code conversations from a wellbeing perspective — sentiment, tone, emotional arc, recurring patterns — and generates a supportive, science-grounded report in both Markdown and HTML. Default lookback is 48 hours across all projects. Uses recognised emotion frameworks (Plutchik, Ekman, Russell's circumplex, Pennebaker linguistic markers) and cites the science behind every observation. Learns the user's baseline tone over time so future reports flag genuine shifts, not noise. Use when the user asks for an emotional/wellbeing recap, mood check, sentiment review, or wants to understand their own ups and downs across recent work sessions.
development
--- name: workflow-advisor description: >- Analyzes recent Claude Code conversations and local Claude state (skills, settings, memory files, CLAUDE.md), researches the latest Claude Code features and best practices online, and suggests one workflow improvement at a time with reasoning and a concrete action item. Can save accepted suggestions to memory for tracking. Use when you want to discover underused Claude Code features, improve your development workflow, stay current with the lat