---
name: warden-setup
description: Initialize Claude Warden in a project — creates governance files, seeds deny entries, and migrates from curl-install
user-invokable: true
---

# Warden Project Setup

Run this skill when setting up Warden in a new project or migrating from the old curl-installer.

## What It Does

- **Fresh projects:** Creates `.claude/CLAUDE.md`, `.claude/rules/`, `docs/SESSION-LOG.md`, and seeds deny entries in `.claude/settings.json`
- **Migration:** Detects old curl-install artifacts (`.claude/hooks/`, `.claude/VERSION`, `.claude/config/`), removes them, cleans stale hook/deny entries from `settings.json`, and preserves user files

## Instructions for Claude

When the user invokes `/warden-setup` or asks to set up Warden in their project:

### Step 1: Run the setup script

Find and run the setup script. Try these in order:

```bash
# Option 1: Plugin env var (set during hook execution)
bash "$CLAUDE_PLUGIN_ROOT/scripts/warden-setup.sh"

# Option 2: Find in plugin cache (always works)
bash "$(find ~/.claude/plugins/cache -path '*/claude-warden/*/scripts/warden-setup.sh' 2>/dev/null | head -1)"
```

This runs against `$CLAUDE_PROJECT_DIR` by default. The script is idempotent — safe to run multiple times.

**Available flags:**
- `--force` — Overwrite existing governance files (default: skip existing)
- `--skip-deny` — Don't add deny entries to settings.json

### Step 2: Report results

Tell the user what was created, skipped, or migrated. The script outputs this information.

### Step 3: Guide next steps

After setup completes, tell the user:

1. **Edit `.claude/CLAUDE.md`** — This is a human-only file (protected by hooks and deny entries). Fill in project name, stack, current phase, and constraints. The template has placeholder sections to complete.

2. **Customize config (optional)** — Create `.claude/warden.config.sh` to override defaults:
   ```bash
   # Example: customize protected files and directory rules
   PROTECTED_FILES=(".claude/CLAUDE.md" ".claude/rules/*.md" ".claude/settings.json")
   FORBIDDEN_DIRS=("temp" "tmp" "misc" "stuff" "old" "backup")
   MAX_DIRECTORY_DEPTH=5
   ```

3. **Restart Claude Code** — New deny entries and governance files take effect on next session.

### If migration was detected

Additionally inform the user:
- Old hook scripts and config files were removed
- Their `.claude/CLAUDE.md`, `.claude/rules/`, and `.claude/warden.config.sh` were preserved
- Old hook entries were cleaned from `settings.json`
- They should verify `settings.json` looks correct: `cat .claude/settings.json`
