This skill should be used to remove AI-generated artifacts and unnecessary code before committing. It scans changed files for redundant comments, AI TODOs, excessive docstrings, and unnecessary markdown files. Git-only, no GitHub required.
/plugin marketplace add iamladi/cautious-computing-machine--primitives-plugin/plugin install primitives@cautious-computing-machineThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Remove AI-generated artifacts before committing or creating PRs. Always dry-run first with numbered selection.
This skill should be invoked when the user:
Ask user what to compare against (or use sensible default):
# Get default branch
git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs
# Get changed files
git diff --name-only {BASE}...HEAD
# Get change summary
git diff --stat {BASE}...HEAD
If no remote, fall back to:
git diff --name-only main...HEAD
# or
git diff --name-only master...HEAD
Scan all changed files for these patterns. DO NOT modify anything yet.
Flag for deletion:
NOTES.md, PLAN.md, ARCHITECTURE.md, THOUGHTS.md, IDEAS.md, SCRATCH.md, TEMP.md, TODO.mdNever touch:
README.md, CONTRIBUTING.md, CHANGELOG.mddocs/** directoryComments that just restate what the next line obviously does:
Python example:
# Create user ← Redundant
user = User()
# Save to database ← Redundant
db.save(user)
TypeScript example:
// Initialize the counter ← Redundant
const counter = 0;
// Return the result ← Redundant
return result;
Detection:
Pattern: # TODO: (Add|Consider|Might|Should|Could|May|Probably)
Examples to flag:
# TODO: Add error handling
# TODO: Consider edge cases
# TODO: Might need optimization
# TODO: Should validate input
Keep these (specific/actionable):
# TODO: Handle timezone conversion for EU users (ticket #123)
# TODO: Replace with new API endpoint after v2 launch
Flag docstrings that are excessively long for trivial functions.
Check for:
Bad example:
def get_name(self) -> str:
"""Get the name property.
This method returns the name property of the object.
It retrieves the stored name value and returns it to the caller.
The name is a string representing the object's name.
Returns:
str: The name of the object
"""
return self.name
Good docstring (keep):
def parse_date(s: str, tz: str = "UTC") -> datetime:
"""Parse date string with timezone handling.
Supports ISO 8601 and common formats. Falls back to UTC
if timezone parsing fails.
"""
Flag tests with excessive mocking that test nothing real.
Pattern:
@patch decorators per test functionExample to flag:
@patch('module.thing1')
@patch('module.thing2')
@patch('module.thing3')
@patch('module.thing4') # 4 patches = flag
def test_something(m1, m2, m3, m4):
# Tests nothing real
assert True
Flag suspiciously specific claims without citation:
Patterns:
Examples:
# This improves performance by 47% ← Flag (no source)
# According to research, users prefer this ← Flag (no citation)
Display all findings with clear numbering and actions:
🔍 Scanned X files, found Y slop patterns
[1] NOTES.md (45 lines)
→ DELETE: Unnecessary markdown file
[2] src/user.py:23-28 (6 lines)
→ REMOVE redundant comments:
22: def create_user(name: str):
23: # Create user
24: user = User(name)
25: # Save to database
26: db.save(user)
27: # Return user
28: return user
[3] src/api.py:15-25 (11 lines)
→ SIMPLIFY excessive docstring on get_name()
Current: 8 lines for 1-line getter
Suggest: """Return the object's name."""
[4] src/utils.py:42
→ REMOVE AI TODO:
# TODO: Add error handling
[5] tests/test_user.py:50-70 (test_create_with_mocks)
→ ⚠️ FLAG: Mock-heavy (5 @patch decorators)
Review manually - may not test real behavior
[6] docs/performance.md:12
→ ⚠️ FLAG: "improves performance by 47%" (no source)
Review manually - add citation or remove claim
---
Select items to clean:
• Enter numbers: 1 2 4
• Range: 1-4
• 'all' - clean items 1-4 (skips flags)
• 'none' - cancel
Selection: _
Important:
Parse user input (numbers, ranges, 'all', 'none').
git rm {FILE}
If file has unstaged changes, show error and skip.
Use Edit tool to:
Show before/after for each edit:
Editing src/user.py...
Before (lines 23-28):
# Create user
user = User(name)
# Save to database
db.save(user)
After:
user = User(name)
db.save(user)
✓ Removed 2 redundant comments
Do NOT auto-fix. Instead:
✅ Cleaned:
• 2 files deleted
- NOTES.md
- TODO.md
• 12 redundant comments removed
• 3 docstrings simplified
• 8 AI TODOs removed
• 67 total lines removed
⚠️ Flagged for manual review:
• tests/test_user.py:50-70 (mock-heavy, 5 patches)
• docs/performance.md:12 (uncited metric)
Next steps:
1. Review flagged items (if any)
2. Run tests: bun test
3. Verify changes: git diff
4. Commit: /commit
Always follow these:
A comment is redundant if:
Use Read tool to scan files line by line, looking for:
{comment line}
{code line}
Compare comment text to code - if essentially the same meaning, flag it.
Calculate ratio: docstring_lines / function_code_lines
Flag if:
Use Grep tool with pattern:
grep -n "TODO:.*\(Add\|Consider\|Might\|Should\|Could\|May\|Probably\)" {files}
Only flag generic TODOs, keep specific ones with tickets/dates/details.
User: "de-slop before committing"
Workflow:
No changes found:
✓ No slop detected in changed files!
Code looks clean.
Git errors:
git remote show origin fails (no remote), fall back to main/mastergit rm fails, show error and skip that fileFile read errors:
User enters invalid selection:
# Use exponential backoff to avoid rate limiting
retry_with_backoff(api_call)
# HACK: API returns null for empty arrays, normalize to []
data = response.data or []
# Retry the API call
retry_with_backoff(api_call)
# Set data to response data
data = response.data
/**
* Debounce function calls to prevent excessive API requests.
* Uses leading edge trigger for immediate first call.
*/
function debounce(fn: Function, ms: number) { ... }
/**
* Get the user's name.
*
* This function returns the name property from the user object.
* It accesses the name field and returns its value to the caller.
*
* @returns The user's name as a string
*/
function getName(): string {
return this.name;
}
→ Simplify to: /** Return the user's name. */
This skill is conservative by design:
The goal is to remove obvious AI artifacts while preserving intentional code, docs, and tests.