trim-comments

Removes low-value comments introduced by a branch's diff while preserving durable rationale and tool directives.

1|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/pnewsam/skills --skill trim-comments-pnewsam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: trim-comments
Source: https://github.com/pnewsam/skills/tree/main/archive/registry-rebuild/trim-comments
Command: npx skills add https://github.com/pnewsam/skills --skill trim-comments-pnewsam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Branches and pull requests often accumulate noisy comments — process narration, ticket references, restatements of the obvious, review chatter, and commented-out code — that clutter the codebase and add no value to future readers. Manually auditing every comment in a diff is tedious and error-prone. ## Core Features & Use Cases - Diff-scoped cleanup: Resolves the branch's change set against its base and trims only comments on lines the change added or modified, leaving pre-existing comments untouched. - Keep/trim rules: Removes chat-history narration, external ticket pointers, obvious restatements, review chatter, and dead commented-out code, while preserving rationale, API docs, real TODOs, license headers, and tool directives like # noqa or // eslint-disable. - Safe, reversible edits: Edits only comment text in the working tree, never stages or commits, and keeps files syntactically valid. - Use Case: Before requesting review on a PR, run this Skill to strip AI-generated narration and ticket references from the diff so reviewers see only comments with durable value. ## Quick Start Use trim-comments to clean up the low-value comments this branch's changes introduced before I open the PR.

Frequently Asked Questions about trim-comments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up noisy comments in a pull request before review?▼

Run the trim-comments skill against your branch. It diffs your branch against its base, identifies comments on added or modified lines, and removes narration, ticket references, and obvious restatements while keeping rationale and tool directives.

How to remove AI-generated comments from a code diff?▼

The skill targets exactly this case: it strips chat-history narration, 'AI-generated, please verify' notes, and process commentary from the lines your branch touched, leaving the edits uncommitted in the working tree for your review.

Does comment trimming remove linter directives like noqa or eslint-disable?▼

No. Tool directives such as `# noqa`, `# type: ignore`, `// eslint-disable`, `// @ts-expect-error`, coverage pragmas, and shebangs are never removed because they change behavior, not just documentation.

Will trimming comments affect code outside my branch's changes?▼

No. The skill is strictly scoped to comments on lines your branch added or modified, resolved via git diff against the upstream merge base or default branch. Pre-existing comments elsewhere are left untouched.

When should I not use automated comment trimming?▼

Avoid it for repo-wide comment sweeps unrelated to a specific change, for editing PR titles or descriptions (use publish-pr), and for finding code defects (use review-pr). It only trims comments within one branch's diff.