agentleFS
propstreetpropstreet/claude-powerpack/skills/trim-pr/SKILL.md

trim-pr

Skill2 starsChanged 9 months agoMITView on GitHub

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.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look for complexity added "just in case" that isn't actually needed:

    line 54
  2. Distinctive:

    Ask: "Is this complexity earning its keep, or was it added speculatively?"

    line 62
  3. Distinctive:

    If you're not shipping a public API, remove:

    line 68
  4. Distinctive:

    Remove defensive code that can't actually help:

    line 76
  5. Distinctive:

    Rule of thumb: If a comment only makes sense to someone who read the PR, rewrite it or delete it.

    line 120
  6. Distinctive:

    If there are review comments from GitHub Actions, reviewers, or automated tools — address substantive findings, verify they're still valid …

    line 124
  7. Distinctive:

    Run the project's linter, build, and tests to verify nothing broke.

    line 128
  8. Distinctive:

    If no changes needed, state that the code is already clean and why.

    line 145

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

Trim complexity that accumulated during development. This is NOT a code review — focus on removing cruft, not evaluating design decisions.

1. Understand the Changes

Determine the PR's base branch and review the full diff and changed files to understand what was built.

2. Look for Accumulated Cruft

During development, code often accumulates:

CruftFix
Repeated code blocksExtract helper function
Debug logging left behindRemove or convert to proper logging
Commented-out codeDelete it (git has history)
TODO comments for things already doneRemove them
Unused imports/variablesDelete them
Overly defensive null checksRemove if caller guarantees non-null
Type casts that worked around WIP typesFix upstream types now
Console.log / print statementsRemove or use proper logger
Temporary variable names (temp, foo, xxx)Use descriptive names
Comments referencing PR/PRD/review contextRewrite for future maintainers

3. Check for Over-Engineering

Look for complexity added "just in case" that isn't actually needed:

  • Unused flexibility: Config options, parameters, or generics that only have one value/type
  • Premature abstraction: Interfaces/base classes with single implementation
  • Dead code paths: Branches that can never execute given current callers
  • Wrapper functions: Functions that just call another function (inline them)
  • Speculative generality: "We might need this later" code with no current use

Ask: "Is this complexity earning its keep, or was it added speculatively?"

4. Check for Common Anti-Patterns

Backwards Compatibility Hacks

If you're not shipping a public API, remove:

  • Renamed unused _vars kept for "compatibility"
  • Re-exported types that nothing imports
  • // removed comments marking deleted code
  • Deprecated function wrappers

Error Handling Theater

Remove defensive code that can't actually help:

  • Try/catch that just re-throws
  • Null checks after operations that guarantee non-null
  • Type assertions immediately after type guards
  • Validation of values from trusted internal sources

Copy-Paste Artifacts

Look for:

  • Duplicate logic that should be a shared function
  • Similar but slightly different implementations
  • Code comments that describe a different function

5. Clean Up Development-Context Comments

Comments written during development often reference context that won't exist for future maintainers:

Reference PR/Review Context

Development CommentBetter 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

Reference PRD/Issue Context

Development CommentBetter 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

Temporal References

Development CommentBetter 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.

6. Address PR Review Comments

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.

7. Verify

Run the project's linter, build, and tests to verify nothing broke. Check project docs (README, CONTRIBUTING, CLAUDE.md) for project-specific commands.

Output

Summary table of changes made:

IssueFixRisk
Duplicate null check in handleSubmitRemoved redundant checkLow
Debug console.log in api.tsRemovedLow
Unused IFutureFeature interfaceDeletedLow

Risk levels:

  • Low: Removed dead code, comments, or unused imports
  • Medium: Simplified logic, removed defensive code
  • High: Changed behavior, removed "defensive" error handling

If no changes needed, state that the code is already clean and why.

Gotchas

  • Named booleans like isStarting are often MORE readable than inlining conditions. Prefer clarity over minimal code.
  • Shell constructs like $(), &&, and variable assignments in Bash calls can trigger permission prompts. Prefer simple, single-command calls when possible.

Quick Checklist

  • No commented-out code remaining
  • No TODO comments for completed work
  • No debug logging/print statements
  • No unused imports or variables
  • No single-use abstractions
  • No duplicate code blocks
  • No PR/PRD/review-context comments (rewritten for maintainers)
  • All tests pass
  • Linting passes

$ARGUMENTS

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.