com um clique
trim-pr
Trim a PR before merging - remove complexity that accumulated during development. Use when preparing to merge, cleaning up code, trimming unnecessary complexity, or asked to simplify a PR.
Menu
Trim a PR before merging - remove complexity that accumulated during development. Use when preparing to merge, cleaning up code, trimming unnecessary complexity, or asked to simplify a PR.
Creates expert consultation documents with code extraction, git diffs, and size tracking (125KB limit). Use when user asks to "create an expert consultation document", "prepare code for expert review", "gather architecture context", or needs comprehensive technical documentation for external analysis. Requires Node.js 18+.
Analyze dependency updates and generate a changelog report with breaking changes, new features, and actionable recommendations. Use after updating packages, before planned upgrades (preflight), or to research what changed between specific versions. Triggers on "analyze deps", "analyze dependencies", "dependency update report", "breaking changes in update", "what changed in dependency update".
Capture session learnings and update project docs. Use when ending a session, after completing a feature, or when asked to "debrief", "capture learnings", "update project knowledge", or "what did we learn".
Start a structured interview to gather requirements for complex features. Use when tackling multi-layer features, validating PRDs, or defining scope for implementation.
Extract and synthesize learnings from past Claude Code session transcripts into project documentation. Use when asked to "mine history", "extract learnings from past sessions", "what patterns keep recurring", or "improve docs from history".
Creates comprehensive PR descriptions by systematically reviewing ALL changes - features, bug fixes, tests, docs, and infrastructure. Use when user asks to "update the PR", "prepare PR for review", "write PR description", or "document branch changes". Requires gh CLI.
| name | trim-pr |
| description | Trim a PR before merging - remove complexity that accumulated during development. Use when preparing to merge, cleaning up code, trimming unnecessary complexity, or asked to simplify a PR. |
| user-invocable | true |
| context | fork |
| allowed-tools | ["Bash(git:*)","Bash(gh:*)","Bash(npm run:*)","Bash(npx:*)","Bash(ruff:*)","Bash(pylint:*)","Bash(go build:*)","Bash(go vet:*)","Bash(go test:*)","Bash(cargo check:*)","Bash(cargo test:*)","Bash(dotnet build:*)","Bash(dotnet test:*)","Bash(dotnet format:*)","Read","Edit","Glob","Grep"] |
Trim complexity that accumulated during development. This is NOT a code review — focus on removing cruft, not evaluating design decisions.
Determine the PR's base branch and review the full diff and changed files to understand what was built.
During development, code often accumulates:
| Cruft | Fix |
|---|---|
| Repeated code blocks | Extract helper function |
| Debug logging left behind | Remove or convert to proper logging |
| Commented-out code | Delete it (git has history) |
| TODO comments for things already done | Remove them |
| Unused imports/variables | Delete them |
| Overly defensive null checks | Remove if caller guarantees non-null |
| Type casts that worked around WIP types | Fix upstream types now |
| Console.log / print statements | Remove or use proper logger |
| Temporary variable names (temp, foo, xxx) | Use descriptive names |
| Comments referencing PR/PRD/review context | Rewrite for future maintainers |
Look for complexity added "just in case" that isn't actually needed:
Ask: "Is this complexity earning its keep, or was it added speculatively?"
If you're not shipping a public API, remove:
_vars kept for "compatibility"// removed comments marking deleted codeRemove defensive code that can't actually help:
Look for:
Comments written during development often reference context that won't exist for future maintainers:
| Development Comment | Better For Maintainers |
|---|---|
// P2 finding: add null check | // Guard against null from legacy API |
// Per review feedback | // Explicit type conversion for clarity |
// Addressing P3 concern about perf | // Cached to avoid repeated DB calls |
// Fixed in response to CI failure | // Handle edge case where X is empty |
| Development Comment | Better For Maintainers |
|---|---|
// PRD Phase 2 scope | // Extended validation for enterprise users |
// Part of #531 quick win | // Simplified flow for common case |
// Out of scope for this PR | (delete — git history has this) |
// MVP implementation, see PRD for full spec | // Basic implementation — see [doc] for extension points |
| Development Comment | Better For Maintainers |
|---|---|
// TODO: revisit after merge | (either do it now or delete) |
// Temporary workaround until X ships | // Workaround for [issue] in [dependency] |
// New approach as of this PR | (delete — all code was "new" once) |
// Changed from previous implementation | (delete — git diff shows this) |
Rule of thumb: If a comment only makes sense to someone who read the PR, rewrite it or delete it.
If there are review comments from GitHub Actions, reviewers, or automated tools — address substantive findings, verify they're still valid (reviewers see old commits), and explain trade-offs if not implementing a suggestion.
Run the project's linter, build, and tests to verify nothing broke. Check project docs (README, CONTRIBUTING, CLAUDE.md) for project-specific commands.
Summary table of changes made:
| Issue | Fix | Risk |
|---|---|---|
Duplicate null check in handleSubmit | Removed redundant check | Low |
Debug console.log in api.ts | Removed | Low |
Unused IFutureFeature interface | Deleted | Low |
Risk levels:
If no changes needed, state that the code is already clean and why.
isStarting are often MORE readable than inlining conditions. Prefer clarity over minimal code.$(), &&, and variable assignments in Bash calls can trigger permission prompts. Prefer simple, single-command calls when possible.$ARGUMENTS