agentleFS
peopleforresterpeopleforrester/claude-dotfiles/skills/maintenance/cleanup/SKILL.md

cleanup

Skill3 starsChanged 8 months agoMITView on GitHub

Clean up project files, remove cruft, and organize codebase

  • Reads credentials

29 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use next, worktree and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • VercelSkill

    next

    Next.js adapter for embedding emulators directly in a Next.js app via @emulators/adapter-next. Use when the user needs to embed emulators in Next.js, set up same-origin OAuth for Vercel preview deployments, create an emulate catch-all route handler, configure Auth.js/NextAuth with embedded emulators, add persistence to embedded emulators, or wrap next.config with withEmulate. Triggers include "Next.js emulator", "adapter-next", "embedded emulator", "same-origin OAuth", "Vercel preview", "createEmulateHandler", "withEmulate", or any task requiring emulators inside a Next.js app.

    Also in 4 projects that use this

  • MicrosoftSkill

    worktree

    Create, reuse or clean up a dedicated git worktree for working on a pull request or a private branch. Use from any PR-scoped workflow that needs an isolated checkout to keep current code and build output untouched.

    Also in 3 projects that use this

  • DockerSkill

    research

    Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".

    Also in 7 projects that use this

  • AWSSkill

    writing-for-agents

    Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 4 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Action: Remove from package.json/requirements.txt

    line 36
  2. Distinctive:

    Action: Remove or document why it's kept

    line 52
  3. Distinctive:

    If needed: move to proper TODO with issue number

    line 123
  4. Distinctive:

    If obsolete: delete completely

    line 124
  5. Distinctive:

    If for reference: add to documentation

    line 125
  6. Distinctive:

    Add cleanup checks to CI

    line 226
  7. Distinctive:

    Document why code is kept if it looks unused

    line 227
  8. Distinctive:

    Use .gitignore properly to prevent cruft

    line 228

“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “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

/cleanup - Project Cleanup

Clean up project files, remove cruft, and organize codebase.

Usage

/cleanup                     # Full cleanup scan
/cleanup --dead-code         # Find unused code
/cleanup --deps              # Find unused dependencies
/cleanup --files             # Find unnecessary files

Cleanup Checklist

1. Unused Dependencies

# Node.js - find unused packages
npx depcheck

# Python - find unused imports
autoflake --check .
# or
ruff check . --select F401

# List explicitly:
npx depcheck --json | jq '.dependencies'

Action: Remove from package.json/requirements.txt

2. Dead Code

# JavaScript/TypeScript
npx ts-prune          # Find unused exports
npx unimported        # Find unused files

# Python
vulture .             # Find unused code

# General
grep -r "TODO\|FIXME\|HACK" src/

Action: Remove or document why it's kept

3. Temporary/Generated Files

Find and remove:

## Files to Clean

### Build Artifacts
- [ ] dist/
- [ ] build/
- [ ] .next/
- [ ] __pycache__/
- [ ] *.pyc

### Logs
- [ ] *.log
- [ ] npm-debug.log
- [ ] yarn-error.log

### Editor/IDE
- [ ] .DS_Store
- [ ] Thumbs.db
- [ ] .idea/ (if not shared)
- [ ] .vscode/ (if not shared)

### Test Artifacts
- [ ] coverage/
- [ ] .nyc_output/
- [ ] .pytest_cache/

### Misc
- [ ] *.bak
- [ ] *.tmp
- [ ] *~

4. Git Cleanup

# Remove merged branches
git branch --merged main | grep -v main | xargs git branch -d

# Remove stale remote branches
git remote prune origin

# Find large files in history
git rev-list --objects --all | \
  git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | \
  awk '/^blob/ {print $3, $4}' | \
  sort -rn | head -20

# Clean up reflog
git reflog expire --expire=now --all
git gc --prune=now

5. Commented-Out Code

Find and evaluate:

# Find commented code blocks
grep -rn "// TODO\|# TODO\|/\*\|'''" src/

# Find disabled tests
grep -rn "\.skip\|@pytest.mark.skip\|xfail" tests/

Decision criteria:

  • If needed: move to proper TODO with issue number
  • If obsolete: delete completely
  • If for reference: add to documentation

6. Duplicate Code

# JavaScript/TypeScript
npx jscpd src/

# Python
pylint --disable=all --enable=duplicate-code src/

# General
# Review similar file names
find . -name "*.ts" | xargs basename -a | sort | uniq -d

7. Configuration Cleanup

Review and clean:

## Config Files to Review

### Package Configs
- [ ] package.json - remove unused scripts
- [ ] tsconfig.json - remove unused options
- [ ] .eslintrc - remove unused rules

### Environment
- [ ] .env.example - keep in sync with actual vars
- [ ] docker-compose.yml - remove unused services

### CI/CD
- [ ] .github/workflows/ - remove unused workflows
- [ ] .gitlab-ci.yml - clean up stages

Cleanup Report Template

## Project Cleanup Report

**Date**: [Date]
**Cleaned By**: [Name]

### Summary
| Category | Items Found | Items Removed | Size Freed |
|----------|-------------|---------------|------------|
| Dependencies | 5 | 3 | - |
| Dead code | 12 files | 10 files | 2.3 KB |
| Build artifacts | 1 dir | 1 dir | 45 MB |
| Git branches | 8 | 6 | - |

### Removed Dependencies
- lodash (unused)
- moment (replaced with date-fns)
- left-pad (unused)

### Removed Files
- src/components/OldButton.tsx (replaced by Button.tsx)
- src/utils/deprecated.ts (unused)
- tests/old-tests/ (obsolete tests)

### Kept (With Justification)
- src/legacy/adapter.ts - Still used by integration X

### Recommendations
- [ ] Consider replacing moment.js with lighter alternative
- [ ] Review src/utils for more cleanup opportunities
- [ ] Set up automated dead code detection

Automation

Add to CI:

# .github/workflows/cleanup-check.yml
name: Cleanup Check
on: [pull_request]
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npx depcheck
      - run: npx ts-prune | grep -v "used in module"

Maintenance Schedule

TaskFrequencyAutomated?
Dependency auditWeeklyYes (Dependabot)
Dead code scanMonthlyPartial
Branch cleanupMonthlyManual
Full cleanupQuarterlyManual

Tips

  • Clean up as you go, not in big batches
  • Add cleanup checks to CI
  • Document why code is kept if it looks unused
  • Use .gitignore properly to prevent cruft
  • Review before deleting - some "dead" code is intentional

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.