
Brewcode:Teardown
- 17 installs
- 29 repo stars
- Updated August 2, 2026
- kochetkov-ma/claude-brewcode
Clean up and finalize Brewcode task execution, releasing resources and logging outcomes
About
Brewcode skill for tearing down completed tasks and cleaning up resources in Brewcode-managed sessions. Solo developers use this as part of the Brewcode lifecycle to ensure proper resource release and outcome logging.
- Resource cleanup
- Task finalization
- State logging
Brewcode:Teardown by the numbers
- 17 all-time installs (skills.sh)
- Ranked #1,379 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill brewcodeteardownAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 17 |
|---|---|
| repo stars | ★ 29 |
| Last updated | August 2, 2026 |
| Repository | kochetkov-ma/claude-brewcode ↗ |
What it does
Clean up and finalize Brewcode task execution, releasing resources and logging outcomes
Who is it for?
Developers managing Brewcode lifecycle
When should I use this skill?
Completing Brewcode task execution
Files
<instructions>
Execution
Skill arguments received: $ARGUMENTS
Argument Parsing
Detect flags in $ARGUMENTS:
--dry-runpresent -> dry-run mode (no deletion)--fullpresent -> FULL PURGE mode (see below)- Neither -> default teardown
If --full is NOT present, behavior is identical to previous versions. Skip to "Default Teardown".Full Purge Mode (--full)
WARNING: DESTRUCTIVE (PARTIALLY recoverable).claude project purge(Claude Code 2.1.115+) wipes ALL per-project state including.claude/, project memory, and session data. The automatic backup captures ONLY the project.claude/directory — Claude Code session history and auto-memory under~/.claude/projects/<projectHash>/are NOT backed up and CANNOT be recovered after purge. You must restore the.claude/backup MANUALLY.
Step 1 — Typed confirmation (INLINE PROMPT, NOT AskUserQuestion).
Output literally this prompt to the user as plain text in the conversation:
⚠️ DESTRUCTIVE —claude project purgewill wipe ALL per-project state including.claude/, project memory, and session data. A backup will be created at.claude.backup.<timestamp>/BUT it captures ONLY the project.claude/directory. Claude Code session history and auto-memory under~/.claude/projects/<projectHash>/are NOT in the backup and are NOT recoverable. You must restore the.claude/backup MANUALLY.
>
Reply with the exact word PURGE (uppercase, no surrounding text) to proceed. Anything else aborts.
Then STOP and wait for the user's next message. Inspect that message:
- If the trimmed message equals exactly
PURGE(case-sensitive) -> proceed to Step 2. - Otherwise -> output "Aborted — confirmation token mismatch. No changes made." and STOP.
Do NOT use AskUserQuestion (option-button form does not accept free-text typing).
Step 2 — Version probe. Verify claude project purge is supported on this Claude Code version BEFORE creating any backup.
EXECUTE using Bash tool:
claude project --help 2>&1 | grep -q '\bpurge\b' && echo "OK purge supported" || { echo "FAILED: claude project purge unsupported on this CC version. Aborting --full."; exit 1; }STOP if FAILED — --full mode requires Claude Code 2.1.115+. Use default teardown instead.Step 3 — Backup `.claude/` BEFORE purge.
EXECUTE using Bash tool:
TS=$(date +%s); BACKUP=".claude.backup.${TS}"; cp -r .claude "${BACKUP}" && echo "OK backup created: ${BACKUP}" || echo "FAILED backup — aborting, no purge run"STOP if FAILED — do NOT run purge. Likely disk space or permission issue. Investigate and retry.
Step 4 — Run `claude project purge`.
EXECUTE using Bash tool:
claude project purge 2>&1 && echo "OK purge complete" || echo "FAILED purge command"Step 5 — Report backup path and recovery scope to user so manual restore is possible:
Backup location: .claude.backup.<TS>/ (project .claude/ ONLY)
Restore manually with: rm -rf .claude && mv .claude.backup.<TS> .claude
NOT in backup, NOT recoverable: ~/.claude/projects/<projectHash>/
(Claude Code session JSONL + auto-memory — wiped by `claude project purge`)Default Teardown
If NOT `--dry-run` and NOT `--full`: Use AskUserQuestion to confirm before executing:
"This will delete brewcode project files (templates, configs, logs, plans). Task directories are preserved. Proceed?"
EXECUTE using Bash tool — run teardown script:
bash "${CLAUDE_SKILL_DIR}/scripts/teardown.sh" ARGS_HERE && echo "✅ done" || echo "❌ FAILED"IMPORTANT: Replace ARGS_HERE with the actual value from "Skill arguments received" above. If empty, omit the argument. Strip --full from args before passing to teardown.sh (script does not know about it).
STOP if ❌ — check script path exists and teardown.sh has execute permissions.
Options
| Option | Behavior |
|---|---|
--dry-run | List files to delete without removing them |
--full | DESTRUCTIVE (PARTIALLY recoverable — backup covers .claude/ only, NOT ~/.claude/projects/<hash>/ session+memory): backup .claude/ then run claude project purge after typed PURGE confirmation |
| (none) | Full removal after user confirmation |
Preserved
Task directories (.claude/tasks/*_task/) and user rules (.claude/rules/) are always preserved in default mode. --full mode preserves NOTHING (except the backup directory).
Warning — --full mode
DESTRUCTIVE (PARTIALLY recoverable). Backup at.claude.backup.<timestamp>/captures ONLY the project.claude/directory. Claude Code session history and auto-memory under~/.claude/projects/<projectHash>/are ALSO wiped byclaude project purgebut are NOT in the backup and are NOT recoverable. Use only when you intend to fully reset the project.
</instructions>
Output
# Brewcode Teardown
## Detection
| Field | Value |
|-------|-------|
| Arguments | `{received args or empty}` |
| Mode | `{full or dry-run}` |
## Result
Removed:
✅ .claude/tasks/templates/
✅ .claude/tasks/cfg/
✅ .claude/logs/
✅ .claude/plans/
✅ .grepai/
✅ .claude/skills/brewcode-review/
Preserved:
⏭️ .claude/tasks/*_task/ (task directories)
⏭️ .claude/rules/ (user rules)MIT License
Copyright (c) 2025-2026 Maxim Kochetkov (kochetkov-ma)
https://github.com/kochetkov-ma/claude-brewcode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Teardown
Removes all brewcode project files created by /brewcode:setup -- templates, configs, logs, plans, sessions, and grepai index. All task directories, their artifacts, KNOWLEDGE files, and user rules are preserved intact.
Quick Start
/brewcode:teardownYou will be prompted to confirm before anything is deleted.
Modes
| Mode | How to trigger | What it does |
|---|---|---|
| Full cleanup | /brewcode:teardown | Asks for confirmation, then removes all setup-generated files |
| Dry run | /brewcode:teardown --dry-run | Lists every file and directory that would be deleted -- no changes made, no confirmation needed |
What Gets Removed vs Preserved
| Removed | Preserved |
|---|---|
.claude/tasks/templates/ -- setup templates | .claude/tasks/*_task/ -- all task directories |
.claude/tasks/cfg/ -- config files (brewcode.config.json, etc.) | .claude/tasks/*_task/KNOWLEDGE.jsonl -- knowledge files |
.claude/logs/ -- session logs | .claude/tasks/*_task/artifacts/ -- task artifacts and FINAL.md |
.claude/tasks/sessions/ -- session metadata | .claude/rules/ -- user rules |
.claude/plans/ -- plan files | |
.grepai/ -- semantic search index | |
.claude/skills/brewcode-review/ -- generated review skill |
Examples
Good Usage
- Starting fresh after finishing a project. All tasks are done, you want a clean slate for the next project in the same repo. Run
/brewcode:teardown, then/brewcode:setupagain.
- Previewing before cleanup. Not sure what will be deleted? Run
/brewcode:teardown --dry-runfirst to see the full list without touching anything.
- Reconfiguring brewcode. Your project structure changed and you need to regenerate templates and config. Teardown removes the old setup so
/brewcode:setupcan create fresh files.
- Cleaning up a demo or test project. You used brewcode to try things out and want to remove all traces of the setup while keeping any task work you did.
- Freeing disk space from grepai index. The
.grepai/directory can grow large. Teardown removes it cleanly; run/brewcode:grepailater to rebuild if needed.
Common Mistakes
- Running teardown while a task is in progress. Teardown removes configs and templates that active tasks depend on. Finish or cancel all running tasks first.
- Expecting teardown to delete task directories. Task directories (
.claude/tasks/*_task/) are explicitly preserved. To remove them, delete manually.
- Running teardown and forgetting to re-run setup. After teardown, brewcode skills that depend on config or templates will not work until you run
/brewcode:setupagain.
Tips
- Always run
--dry-runfirst if you are unsure what will be removed. - Teardown is safe to run multiple times -- it skips files that do not exist.
- Your task history, artifacts, and KNOWLEDGE files survive teardown. Think of it as resetting the scaffolding, not the work.
- After teardown, you need
/brewcode:setupbefore using most other brewcode skills again.
Documentation
Full docs: teardown
#!/bin/bash
# Brewcode Teardown Script
# Removes all files created by /brewcode:setup
set -euo pipefail
DRY_RUN=false
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true
echo "Brewcode Teardown"
echo "==================="
$DRY_RUN && echo "[DRY-RUN MODE]"
echo ""
remove_item() {
local path="$1"
local type="$2" # file, dir, symlink
if [ ! -e "$path" ] && [ ! -L "$path" ]; then
return 0
fi
if $DRY_RUN; then
echo " [would remove] $path"
else
if [ "$type" == "dir" ]; then
rm -rf "$path" && echo " ✅ $path"
else
rm -f "$path" && echo " ✅ $path"
fi
fi
}
echo "Project files:"
# Templates directory
remove_item ".claude/tasks/templates" "dir"
# Config directory (includes brewcode.config.json)
remove_item ".claude/tasks/cfg" "dir"
# Logs directory (unified across all brewcode plugins)
remove_item ".claude/logs" "dir"
# Plans directory
remove_item ".claude/plans" "dir"
# grepai index directory
remove_item ".grepai" "dir"
# Project review skill
remove_item ".claude/skills/brewcode-review" "dir"
# Sessions
remove_item ".claude/tasks/sessions" "dir"
echo ""
echo "Preserved (not deleted):"
echo " ⏭️ .claude/tasks/*_task/ (task directories)"
echo " ⏭️ .claude/tasks/*_task/KNOWLEDGE.jsonl (knowledge files)"
echo " ⏭️ .claude/tasks/*_task/artifacts/ (artifacts)"
echo " ⏭️ .claude/rules/ (user rules)"
echo ""
$DRY_RUN && echo "Run without --dry-run to execute cleanup." || echo "Cleanup complete."