sanitize-project
Skill18 starsChanged 4 months agoMITView on GitHub
Sanitize and clean a project directory for public sharing. Use this skill whenever the user gives a file path and wants to package, share, or zip a project — even if they just say 'clean this up', 'prep this for sharing', 'sanitize this folder', 'remove my API keys', or 'package this project'. Also trigger when the user says /sanitize-project followed by a path. Handles removing build artifacts, credentials, secrets, caches, and anything that shouldn't be shared publicly.
- Reads credentials
- Deletes or force-pushes
- Installs packages
In this repository52 other files it gives its agents.
- ad-studioSkill
- brainstormingSkill
- build-siteSkill
- carousel-creatorSkill
- cold-outreachSkill
- content-engineSkill
- content-promptSkill
- daily-digestSkill
- daily-post-ideasSkill
- defuddleSkill
- digital-guide-builderSkill
- dissectSkill
- dm-writerSkill
- edu-siteSkill
- faceless-videoSkill
- first-customer-closerSkill
- frontend-designSkill
- higgsfield-generateSkill
- hooksSkill
- ig-channel-remixSkill
- infographicSkill
- launch-planSkill
- lead-magnetSkill
- linkedin-post-batchSkill
- linkedin-postSkill
- meeting-notesSkill
- money-model-auditSkill
- objection-handlerSkill
- offer-builderSkill
- one-lead-magnetSkill
- outlinesSkill
- personalizeSkill
- positioning-filterSkill
- pricing-calculatorSkill
- productize-serviceSkill
- proposal-generatorSkill
- saas-ad-studioSkill
- shortifySkill
- substackSkill
- ui-ux-pro-maxSkill
- viral-format-minerSkill
- viral-remixSkill
- warm-outreachSkill
- web-design-guidelinesSkill
- yapSkill
- youtube-clipping-agentSkill
- yt-descriptionSkill
- yt-introSkill
- yt-searchSkill
- yt-thumbnailSkill
- yt-titlesSkill
- skill-nameSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Check that the directory exists before proceeding.
- Very specific: line 34
All subsequent steps operate on $COPY_DIR, not the original.
- Very specific: line 74
Use find + rm -rf to handle nested occurrences (e.g.
- Distinctive: line 111
Search ALL remaining files for patterns that suggest credentials.
- Distinctive: line 125
Use grep to scan:
- Distinctive: line 136
Only warn/redact actual values, not placeholders
- Very specific: line 145
Check if it contains real values (not just placeholders like your-key-here, xxxxx, <your-api-key>)
- Distinctive: line 146
If it has real values:
- Very specific: line 147
Create a .env.example that strips the values but keeps the key names:
- Very specific: line 152
Delete the original .env file with real values
- Very specific: line 153
If .env.example already exists and the .env only has real values, just delete .env
- Distinctive: line 193
If any files were flagged as potentially containing credentials but NOT auto-redacted (because they're code files, not env files), call …
- Distinctive: line 199
Never delete files outside the target directory
- Very specific: line 201
If the project has a .gitignore, use it as a hint — anything in .gitignore is often a good candidate for removal
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sanitize Project for Public Sharing
Clean up a project directory so it's safe and lightweight to share publicly. The goal: remove everything that's either private (credentials, keys) or regenerable (build output, dependencies).
STEP 1: Parse the Path
Get the target directory from the user's argument. If no path was given, ask for one.
Check that the directory exists before proceeding.
STEP 2: Copy First, Sanitize the Copy
Always sanitize a copy — never the original. The original stays untouched with its original name.
# The copy gets a "- Community" suffix (or similar distribution label)
COPY_DIR="${ORIGINAL_DIR} - Community"
cp -r "$ORIGINAL_DIR" "$COPY_DIR"All subsequent steps operate on $COPY_DIR, not the original. Tell the user:
- Original preserved at:
<original path> - Sanitizing copy at:
<copy path>
STEP 3: Measure Before Size
du -sh "$COPY_DIR"Save this number — you'll report it at the end.
STEP 4: Remove Build Artifacts & Caches
These are all regenerated automatically when the project is run — safe to delete:
# Remove each if it exists
node_modules/
.next/
.nuxt/
dist/
build/
.turbo/
.cache/
.parcel-cache/
__pycache__/
*.pyc
.pytest_cache/
.venv/
venv/
tsconfig.tsbuildinfo
*.tsbuildinfo
.DS_Store (all, recursively)Use find + rm -rf to handle nested occurrences (e.g. nested node_modules).
Example:
find "/path/to/project" -name "node_modules" -type d -prune -exec rm -rf {} +
find "/path/to/project" -name ".DS_Store" -deleteSTEP 5: Remove Lock Files
These are regenerated by npm install / pip install etc:
package-lock.jsonyarn.lockpnpm-lock.yamlPipfile.lockpoetry.lockGemfile.lock
STEP 6: Remove Version Control
.git/
.svn/
.hg/The recipient doesn't need the git history.
STEP 7: Scan for Secrets & Credentials
Search ALL remaining files for patterns that suggest credentials. This is the most important step — missing a real API key in a public share is a serious problem.
Patterns to search for (case-insensitive):
API_KEY,APIKEYSECRET,SECRET_KEYTOKEN,ACCESS_TOKEN,AUTH_TOKENPASSWORD,PASSWD,PWDPRIVATE_KEY,PRIVATE KEY-----BEGIN RSA PRIVATE KEY-----sk-(OpenAI key prefix)sk-ant-(Anthropic key prefix)Bearer- Common cloud prefixes:
AKIA(AWS),AIza(Google)
Use grep to scan:
grep -rli "API_KEY\|SECRET\|TOKEN\|PASSWORD\|sk-\|AKIA\|AIza\|Bearer" /path/to/project \
--include="*.env*" --include="*.json" --include="*.ts" --include="*.js" \
--include="*.py" --include="*.yaml" --include="*.yml" --include="*.toml" \
--include="*.sh" --include="*.conf" --include="*.config"For each file flagged:
- Read the file
- Determine if the match is an actual credential value (e.g.
OPENAI_API_KEY=sk-abc123) or just a variable reference/placeholder (e.g.OPENAI_API_KEY=your-key-here) - Only warn/redact actual values, not placeholders
STEP 8: Handle .env Files
For any .env, .env.local, .env.production, .env.development files found:
- Read the file
- Check if it contains real values (not just placeholders like
your-key-here,xxxxx,<your-api-key>) - If it has real values:
- Create a
.env.examplethat strips the values but keeps the key names:OPENAI_API_KEY= NEXT_PUBLIC_SUPABASE_URL= - Delete the original
.envfile with real values
- Create a
- If
.env.examplealready exists and the.envonly has real values, just delete.env - Tell the user which files were redacted
STEP 9: Measure After Size
du -sh "$COPY_DIR"STEP 10: Report
Print a clean summary:
✅ Sanitization complete
📁 Original (untouched): /path/to/project
📦 Community copy: /path/to/project - Community
📦 Before: 458 MB → After: 268 KB
Removed:
✓ node_modules/ (458 MB)
✓ .next/ (309 MB)
✓ .git/ (648 KB)
✓ package-lock.json
✓ tsconfig.tsbuildinfo
✓ 3x .DS_Store files
Credentials:
✓ .env.local → replaced with .env.example (stripped real values)
⚠️ Possible credential pattern found in: src/config.ts — review manually
Ready to zip:
zip -r MyProject.zip /path/to/projectIf any files were flagged as potentially containing credentials but NOT auto-redacted (because they're code files, not env files), call them out explicitly so the user can review manually.
Notes
- Never delete files outside the target directory
- Be conservative: if unsure whether something is a real credential vs a placeholder, flag it for the user rather than silently redacting
- If the project has a
.gitignore, use it as a hint — anything in.gitignoreis often a good candidate for removal
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
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.

