A mandatory cleanup utility that removes common AI-generated coding artifacts like redundant comments and filler phrases.
Install
mkdir -p .claude/skills/scrub && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19305" && unzip -o skill.zip -d .claude/skills/scrub && rm skill.zipInstalls to .claude/skills/scrub
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Scan recent changes for AI-generated slop -- redundant comments, over-abstraction, generic UI defaults, and design tells -- and optionally apply safe automated fixes. Use after a code-generation or refactor pass to remove the visible signs of machine authorship before review.Key capabilities
- →Scan code for AI-generated comment rot
- →Detect over-abstracted code structures
- →Identify generic UI defaults
- →Apply automated safe fixes for machine-generated artifacts
How it works
The scanner parses code files to detect patterns like redundant comments or filler phrasing, then optionally applies safe automated fixes to remove them.
Inputs & outputs
When to use scrub
- →Remove redundant AI comments after generation
- →Clean up code before submitting a PR
- →Standardize formatting for human readability
About this skill
Scrub
Core Rules
Presentation only, never behavior: comment rot, over-abstraction, generic design defaults, AI filler, and duplicate logic (single-file and cross-file) are in scope; anything that changes runtime semantics is not. MANDATORY on every AgentX run that changes files (... -> implement -> scrub -> test -> review -> ship); ship.ps1 always runs it and ignores -SkipScrub. See .github/instructions/project-conventions.instructions.md.
When to Use / Not Use
Use after generation, refactor, or a large patch; before a PR or review handoff; after approval but before merge; periodically on machine-heavy directories. No prerequisites -- it runs standalone through the AgentX CLI. Skip during active debugging, on intentionally machine-owned output (build artifacts, OpenAPI clients), on vendored files, or as a substitute for behavioral review.
What Counts As Slop
| Category | Example | Action |
|---|---|---|
| Comment rot | // This function handles X, naked // TODO | Delete |
| Obvious restatement | // Increment counter above counter++ | Delete |
| Dead code | 4+ commented-out code lines | Delete |
| AI filler | Empty "Note that"/"To"/"Next" phrasing | Rewrite/delete |
| Duplicate logic | Repeated normalized blocks, in-file or cross-file | Flag only |
| Over-abstraction | Single-use interface/factory/getter-only class | Flag only |
| Generic UI | Purple/blue gradient defaults, lorem ipsum | Flag only |
| Stale boilerplate | Created by ... on ... | Delete |
| Empty try/catch | catch (e) { } with no logging | Flag |
Presentation only; runtime changes go to the reviewer, not scrub.
Cross-File Duplicate Logic
Directory scans compare normalized 5-line windows across every file, not just within one. Each duplicate-logic finding carries both file/line (the duplicate) and originalFile/originalLine (the earliest occurrence); other categories emit these two fields as null. Traversal is deterministic -- skip-dirs pruned before descending, entries sorted ordinally, reparse points never followed -- so results repeat exactly every run. Adjacent overlapping windows collapse into one finding spanning the full range. Matches only occur within the same language group (ts/tsx/js/jsx together, never vs. py/cs).
Ignored as false positives: structural-only/short blocks (<4 distinct non-keyword tokens), declarative key: value/string-list data, vendor/generated dirs (node_modules, dist, build, .git, coverage; see $SkipDirs), and anything behind a symlink or junction.
Not implied by a match: authorship -- can't be inferred from repeated text; a defect -- shared logic can be intentional; or correctness -- zero findings means none was found, not that code is safe. Never auto-rewritten -- flag-only always; -Production only changes whether it blocks the gate.
Failure Modes: Scan Failures Are Explicit
A missing or unreadable target or nested file fails (exit 2, stderr), never a partial clean result. -Json stays an array for zero, one, or many findings on successful scans. Incomplete scans emit no success-shaped findings array.
Decision Tree
No qualifying change -> skip. Otherwise scan: flag-only findings need human triage; safe-fix findings can run with -Fix and be reviewed before commit.
Workflow
- Scan via the CLI so it resolves in zero-copy workspaces:
pwsh .agentx/agentx.ps1 scrub -Path src/components. Production gate (blocks release):pwsh .agentx/agentx.ps1 deslop -Path src/components -Production(antislopis the same alias). - Triage: each finding has file/line, category, severity (HIGH auto-fixable, MEDIUM opinionated fix, LOW manual review), snippet, safe-fix flag, and for
duplicate-logicthe original location.-Productionalso blocks onempty-catch,generic-gradient, andai-filler. - Fix safe categories:
pwsh .agentx/agentx.ps1 scrub -Path src/components -Fixapplies comment rot, obvious restatement, stale headers, and dead code. Everything else stays flag-only, requiring manual judgment. - Verify: run tests (behavior must not change); re-scan (remaining findings are the manual-triage list); re-run
-Productionfor release candidates; commit aschore: scrub <area>.
Done Criteria
Complete scan, zero HIGH findings and zero required production blockers; tests still pass; the -Fix diff is small and mechanical; no behavior change. False positives need documented review, not a silent waiver.
Anti-Patterns
- Running
-Fixbefore reading the report - Suppressing findings instead of fixing them
- Using scrub to refactor logic -- it is a presentation pass only
- Treating LOW findings as mandatory
- Treating
duplicate-logicas proof of AI authorship or a defect, or auto-extracting/rewriting the flagged code
Rationalization Table
| Rationalization | Reality |
|---|---|
| "The scanner flagged it twice, so it must be AI-written." | A match is evidence for review, not proof of authorship or a defect; duplicate-logic stays flag-only -- never auto-rewrite. |
Related Skills
- Code Hygiene -- cleanup discipline
- Code Review -- behavioral review
- Karpathy Guidelines -- prevents slop
When not to use it
- →During active debugging
- →On machine-owned build output
- →On vendored third-party files
Limitations
- →Safe-fix categories are limited to specific patterns like comment rot
- →Unsafe categories require manual triage
How it compares
It specifically targets machine-authorship indicators to improve readability before human review rather than performing functional refactoring.
Compared to similar skills
scrub side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| scrub (this skill) | 0 | 1mo | No flags | Beginner |
| effective-go | 323 | 10mo | No flags | Beginner |
| solid-principles | 57 | 10mo | No flags | Intermediate |
| typescript-review | 39 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jnPiyush
View all by jnPiyush →You might also like
effective-go
openshift
Apply Go best practices, idioms, and conventions from golang.org/doc/effective_go. Use when writing, reviewing, or refactoring Go code to ensure idiomatic, clean, and efficient implementations.
solid-principles
SmidigStorm
Enforce SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) in object-oriented design. Use when writing or reviewing classes and modules.
typescript-review
metabase
Review TypeScript and JavaScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing TypeScript/JavaScript code.
ast-grep
ast-grep
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.
serena
massgen
This skill provides symbol-level code understanding and navigation using Language Server Protocol (LSP). Enables IDE-like capabilities for finding symbols, tracking references, and making precise code edits at the symbol level.
typescript
lobehub
TypeScript code style and optimization guidelines. Use when writing TypeScript code (.ts, .tsx, .mts files), reviewing code quality, or implementing type-safe patterns. Triggers on TypeScript development, type safety questions, or code style discussions.