agentleFS
VoTruongDanhVoTruongDanh/Skills-Agent/.claude/skills/clean/SKILL.md

clean

Skill4 starsChanged 33 days agoMITView on GitHub

Clean up junk files, temporary files, AI-generated artifacts, and caches. Use when the user wants to remove unused files, reduce repo clutter, or update .gitignore. Triggers: clean, remove junk, dọn dẹp, xoá file rác, cache.

  • Reads credentials

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

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

    START: Read .ai-memory.md from project root.

    line 10
  2. Very specific:

    END: Update .ai-memory.md using Memory Compaction Rules with: what was cleaned, space recovered, ignore rules added, and recurring patterns.

    line 11
  3. Very specific:

    If cleanup involves build artifacts/CI → read .kiro/skills/agents/agents/devops-engineer.md and apply its knowledge

    line 17
  4. Very specific:

    If cleanup involves security-sensitive files → read .kiro/skills/agents/agents/security-auditor.md and apply its knowledge

    line 18
  5. Distinctive:

    If uncertain, ASK before proceeding.

    line 25
  6. Distinctive:

    Ask for confirmation before deletion.

    line 32
  7. Distinctive:

    Remove approved files and report space saved.

    line 33
  8. Distinctive:

    Never delete files in version control (check git status first).

    line 48
  9. Very specific:

    Never delete configuration files (.env, config.json, etc.) unless explicitly requested.

    line 49
  10. Distinctive:

    Never delete source code without explicit confirmation.

    line 50
  11. Distinctive:

    Always show what will be deleted before proceeding.

    line 51
  12. Distinctive:

    Ask before removing entire directories.

    line 53
  13. Very specific:

    NEVER delete .ai-memory.md — it is a persistent project memory file.

    line 54
  14. Very specific:

    After completing, read .kiro/skills/_scripts/checklist.md for cross-cutting quality checks.

    line 81
  15. Very specific:

    All code snippets and example files referenced or produced by this skill must be UTF-8 encoded.

    line 84
  16. Distinctive:

    Update .gitignore to prevent future junk accumulation

    line 87

“Common” is measured: kept by at least 6 in 10 of the 15 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

Memory Protocol

START: Read .ai-memory.md from project root. Check for known junk patterns, previous cleanup history, and project-specific ignore rules. END: Update .ai-memory.md using Memory Compaction Rules with: what was cleaned, space recovered, ignore rules added, and recurring patterns.

Goal

Identify and remove unnecessary files generated by AI, build processes, or development tools without affecting the working codebase.

Agent Routing

  • If cleanup involves build artifacts/CI → read .kiro/skills/agents/agents/devops-engineer.md and apply its knowledge
  • If cleanup involves security-sensitive files → read .kiro/skills/agents/agents/security-auditor.md and apply its knowledge

Socratic Gate

Before cleaning, verify:

  1. Is the project under version control? (safety check)
  2. Are there uncommitted changes that could be lost?
  3. Any specific directories/patterns to preserve? If uncertain, ASK before proceeding.

Workflow

  1. Read Memory — Load .ai-memory.md for project context and past cleanup history.
  2. Scan the project for common junk file patterns.
  3. Identify AI-generated files that may be redundant or outdated.
  4. Present a clear list of files to be removed with sizes and reasons.
  5. Ask for confirmation before deletion.
  6. Remove approved files and report space saved.
  7. Suggest .gitignore updates if needed.
  8. Update Memory — Save cleanup results and new patterns to .ai-memory.md.

Common Junk Patterns

  • Temporary files: *.tmp, *.temp, *.bak, *.swp, *~
  • Log files: *.log, *.log.*, debug.log, error.log
  • Cache directories: .cache/, __pycache__/, .pytest_cache/, .mypy_cache/
  • Build artifacts: dist/, build/, *.pyc, *.pyo, *.class, *.o
  • Node modules: node_modules/ (if not needed)
  • IDE files: .vscode/, .idea/ (if not in .gitignore)
  • OS files: .DS_Store, Thumbs.db, desktop.ini
  • AI artifacts: Duplicate markdown files, unused generated code, test outputs

Safety Rules

  • Never delete files in version control (check git status first).
  • Never delete configuration files (.env, config.json, etc.) unless explicitly requested.
  • Never delete source code without explicit confirmation.
  • Always show what will be deleted before proceeding.
  • Preserve .gitignore and other dot files unless they're clearly junk.
  • Ask before removing entire directories.
  • NEVER delete .ai-memory.md — it is a persistent project memory file.

Output Format

Files to clean:
1. [Category] path/to/file (size) - Reason
2. [Category] path/to/file (size) - Reason
...

Total space to recover: XX MB

Proceed with deletion? (y/n)

Checklist

  • Git status checked for uncommitted changes
  • Junk patterns scanned
  • File list presented with reasons
  • User confirmation received
  • Files removed safely
  • .gitignore updated if needed
  • Memory file updated
  • Clean code chuẩn (Standard clean code applied)
  • Cập nhật đầy đủ tất cả các file liên quan (All related files fully updated)

Quality Gate

After completing, read .kiro/skills/_scripts/checklist.md for cross-cutting quality checks.

Encoding

All code snippets and example files referenced or produced by this skill must be UTF-8 encoded. When applicable, include encoding: "UTF-8" in SKILL.md front-matter and ensure saved files use UTF-8 (no BOM).

Follow-up Actions

  • Update .gitignore to prevent future junk accumulation
  • Suggest cleanup scripts for recurring patterns
  • Recommend build tool configurations to reduce artifacts

Related Skills

  • /status → read .kiro/skills/status/SKILL.md — Check project health after cleanup
  • /enhance → read .kiro/skills/enhance/SKILL.md — Improve remaining code quality

Related Skills

  • /status — Check project state after cleanup
  • /enhance — Improve project structure

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.

Reviews can't be read right now.

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.