Fara beint í efni
MiðlungsForritun

Repository Deep Clean

Forensic-level repository audit: find dead files, update stale docs, archive orphaned artifacts, and standardize to industry best practices with community standard files.

Fyrirmæli

You are performing a forensic-level repository deep clean. Investigate every file, directory, and configuration — then clean, reorganize, archive, and standardize everything to industry best practices.

PHASE 1 — FORENSIC FILE AUDIT
Catalog the repository:
- Run `du -sh .git` to measure git directory size
- Count files by type: source, test, config, docs, media, scripts, generated
- Flag every file > 1MB with its path and size
- List all binary files tracked in git (images, PDFs, archives, compiled artifacts)
- Audit hidden files/dirs: .git/ health, .github/ completeness, .env* gitignore status, editor configs
- Check .gitignore comprehensiveness: are node_modules, __pycache__, .next, dist, .DS_Store, *.pyc all covered?
- Git archaeology: count stale/merged branches, check for large files in history

PHASE 2 — DEAD FILE IDENTIFICATION
For EVERY potentially dead file, apply ALL THREE verification methods (do not skip any):
1. Import/reference tracing: grep the entire codebase for the filename, its exports, and any dynamic import patterns
2. Configuration reference check: search webpack/vite/tsconfig/docker-compose/CI/CD/package.json scripts
3. Git activity analysis: when was it last meaningfully modified? Was it part of a reverted feature?

Classify each as:
- Dead-Archive: confirmed unused, move to archive/
- Dead-Delete: build artifact or OS cruft, delete and gitignore
- Stale-Update: referenced but content is outdated
- Uncertain-Flag: could not confirm after all 3 methods — flag for human review
- Active-Keep: verified in use

Show your work: for each dead/uncertain file, show which methods you applied and what you found.

PHASE 3 — DOCUMENTATION DEEP CLEAN
For every documentation file, verify against actual code:
- README: do setup commands match package.json scripts? Are listed features implemented? Are env vars complete?
- All markdown: check for stale links, outdated paths, references to deleted files
- TODO/FIXME/HACK audit: catalog every instance, note which are still relevant
- .env.example: grep for all env var reads in code, compare against example file

PHASE 4 — RECOMMENDATIONS
Produce three tables:
1. Files to archive (original path, reason, last modified, evidence of being dead)
2. Files to delete (path, type, size recovered, gitignore pattern to add)
3. Missing standard files (LICENSE, CHANGELOG, CONTRIBUTING, SECURITY, .editorconfig, .gitattributes, issue/PR templates, CODEOWNERS, dependabot.yml)

PHASE 5 — METRICS SUMMARY
Produce a before/after projection table:
| Metric | Current | After Cleanup |
- Total tracked files, total size, .git directory size, dead files, missing standards, gitignore patterns

Assign a repository hygiene score (1-10) with justification.

Produce "Top 5 Quick Wins":
| # | Action | Impact | Effort |

CONSTRAINTS:
- Never delete files that are imported or referenced by any code path
- Never modify application logic — only files, docs, config, and structure
- Archive, don't destroy: dead files move to archive/ before removal
- Three-strike rule: if unsure after three methods, flag for human review — never guess

PROJECT TO CLEAN:
{{Paste the project path or describe the repository to clean}}

Leiðbeiningar

How to Use

Run in an AI coding assistant inside the repository. The AI will audit every file, archive dead code, update stale documentation, and add missing community standard files. All work happens on a cleanup branch.

Ábendingar

Tips

The archive directory lets you review deleted files before permanently removing them. Think of it as a recycling bin for code.

Run this after the Self-Optimize prompt but before the Project Modernization prompt. A clean repository is easier to modernize.

devopscleanuprepositorystandardizationdocumentation