| name | clean |
| description | 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. |
| encoding | UTF-8 |
| agents | ["devops-engineer"] |
| related-skills | ["status","enhance"] |
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:
- Is the project under version control? (safety check)
- Are there uncommitted changes that could be lost?
- Any specific directories/patterns to preserve?
If uncertain, ASK before proceeding.
Workflow
- Read Memory — Load
.ai-memory.md for project context and past cleanup history.
- Scan the project for common junk file patterns.
- Identify AI-generated files that may be redundant or outdated.
- Present a clear list of files to be removed with sizes and reasons.
- Ask for confirmation before deletion.
- Remove approved files and report space saved.
- Suggest .gitignore updates if needed.
- 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
Quality Gate
After completing, read .kiro/skills/_scripts/checklist.md for cross-cutting quality checks.
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