skills/setup-ai/SKILL.md
One-command AI onboarding for any codebase. Generates AGENTS.md (project context) with CLAUDE.md symlink, STYLE_GUIDE.md (coding conventions), and Beads task tracking. Also configures machine-level settings (hooks, plugins). Skips files that already exist.
npx skillsauth add skinnyandbald/fish-skills setup-aiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
One-command setup for AI-assisted development. Generates the context files AI tools need, configures your environment, and detects what's already configured — only adds what's missing.
Arguments: $ARGUMENTS
--project: Set up the current codebase — generate AGENTS.md, CLAUDE.md symlink, STYLE_GUIDE.md, initialize Beads, create directories (default behavior)--global: Configure machine-level settings (~/.claude/settings.json) — notification hooks, plugin checklist--check: Read-only — verify your environment is fully configured. Reports what's present, what's missing, what needs attention. Does not write anything.If no mode is specified, default to --project (setup the current project).
--project Mode (default)Check and install required tooling:
# Beads -- AI-native task/issue tracker
# Check if bd is installed (cross-platform)
npx --yes @beads/bd --version || npm install -g @beads/bd
If bd is already installed, skip. If not, install it globally. This gives the project bd for issue tracking, dependency-aware task management, and git-synced work coordination between human and AI agents.
Note:
npxworks on both macOS and Windows. Do NOT usewhich(Unix-only) orwhere(Windows-only) to check for binaries.
Before ANY write to CLAUDE.md, AGENTS.md, or STYLE_GUIDE.md, you MUST run this check. This is not optional.
# Deterministic pre-flight check — run BEFORE any file generation
CLAUDE_EXISTS=false; AGENTS_EXISTS=false; STYLE_EXISTS=false
CLAUDE_IS_SYMLINK=false
[ -f "CLAUDE.md" ] && CLAUDE_EXISTS=true
[ -L "CLAUDE.md" ] && CLAUDE_IS_SYMLINK=true
[ -f "AGENTS.md" ] && AGENTS_EXISTS=true
[ -f "STYLE_GUIDE.md" ] && STYLE_EXISTS=true
[ -f ".cursorrules" ] && echo ".cursorrules found"
[ -d ".beads" ] && echo ".beads/ found"
[ -d ".claude/learnings" ] && echo ".claude/learnings/ found"
[ -d "docs/solutions" ] && echo "docs/solutions/ found"
[ -d "docs/claude" ] && echo "docs/claude/ found"
echo "CLAUDE.md exists: $CLAUDE_EXISTS (symlink: $CLAUDE_IS_SYMLINK)"
echo "AGENTS.md exists: $AGENTS_EXISTS"
echo "STYLE_GUIDE.md exists: $STYLE_EXISTS"
If AGENTS.md exists ($AGENTS_EXISTS = true):
cp AGENTS.md AGENTS.md.bakIf CLAUDE.md exists and is NOT a symlink ($CLAUDE_EXISTS = true, $CLAUDE_IS_SYMLINK = false):
If CLAUDE.md exists and IS a symlink ($CLAUDE_IS_SYMLINK = true):
If STYLE_GUIDE.md exists ($STYLE_EXISTS = true):
cp STYLE_GUIDE.md STYLE_GUIDE.md.bakIf no AGENTS.md exists (or user approved regeneration):
Analyze the codebase and generate AGENTS.md. This is the primary context file — tool-agnostic, works with Claude Code, Copilot, Cursor, Codex, etc.
<!-- GUIDELINE: Only document what agents CANNOT discover from your codebase. --> <!-- Agents read package.json, README, tsconfig, etc. automatically. --> <!-- Focus on: non-standard tools, behavioral constraints, project-specific footguns. -->AGENTS.md should contain:
<avoid_over_engineering>
Only make changes that are directly requested or clearly necessary.
</avoid_over_engineering>
<run_tests_in_background>
Run long commands (tests, typechecks, builds) with `run_in_background=true`.
Check results with `TaskOutput` -- don't block on slow operations.
</run_tests_in_background>
<tdd_required>
TDD is mandatory for ALL code changes -- features and bug fixes alike.
**Bug Fix Process:**
1. **Write a failing test FIRST** -- reproduce the bug
2. **Verify test fails** -- confirm it catches the bug
3. **Fix the implementation** -- minimal change
4. **Verify test passes** -- confirm the fix works
**Feature Process:**
1. **Write a failing test** -- define expected behavior
2. **Implement minimal code** to make it pass
3. **Refactor** if needed, keeping tests green
**DO NOT fix first then write a test.** The test must fail before the fix. This is non-negotiable -- subagents must follow TDD too.
</tdd_required>
<use_beads_for_task_management>
ALWAYS use `bd` (beads) for task management -- never use TodoWrite or internal task tools. Break work into beads issues, update status as you go, and close when done.
Key commands: `bd create`, `bd list`, `bd show <id>`, `bd update <id> --status <status>`, `bd close <id>`.
**Sync protocol:** Beads data lives in `.beads/issues.jsonl` (git-tracked). The Dolt DB is local-only.
- **Session start:** Run `bd list` -- this auto-imports from JSONL if it's newer than local Dolt DB.
- **Before committing:** Run `bd backup` to flush Dolt -> JSONL, then include the `.beads/` changes in your commit.
- **After pulling:** Any `bd` command auto-detects stale DB and re-imports.
</use_beads_for_task_management>
## Quality Gates
### Canonical Workflow (Do NOT skip or reorder)
1. Draft plan (if non-trivial) → `/critic-review` → address feedback → finalize
2. Implement → run tests
3. `superpowers:code-reviewer` — review against plan and standards
4. `/simplify` — review for reuse/quality/efficiency. Re-run until clean
5. Commit → create PR → push
**Pre-PR:** `/simplify` is mandatory before every PR. No exceptions. If suggestions conflict with `<avoid_over_engineering>`, the directive wins.
docs/claude/ for topic-specific deep divesDo NOT generate:
Keep it under 200 lines total. If .cursorrules exists, incorporate its content.
After AGENTS.md is written, detect the platform and create the appropriate link:
macOS/Linux:
ln -sf AGENTS.md CLAUDE.md
Windows (PowerShell or cmd):
# Copy instead of symlink -- Windows symlinks require Developer Mode or admin
copy AGENTS.md CLAUDE.md
Platform detection: Check
os.platform()orunameto determine which approach to use. On Windows, prefer copying AGENTS.md to CLAUDE.md since symlinks require Developer Mode enabled or admin privileges. The tradeoff: Windows users must re-copy after editing AGENTS.md (or just edit CLAUDE.md directly). On macOS/Linux, always use a symlink.
This ensures Claude Code reads the project context natively while AGENTS.md remains the primary, tool-agnostic file.
If AGENTS.md was skipped but CLAUDE.md doesn't exist either, generate a standalone CLAUDE.md scaffold with just the behavior directives and quality gates sections (no project context — that's AGENTS.md's job).
If both AGENTS.md and CLAUDE.md already exist: When scaffolding is not needed, add this awareness comment if creating any new file alongside them:
<!-- This project has both AGENTS.md and CLAUDE.md.
AGENTS.md is for project context; CLAUDE.md is for behavioral directives.
Keep them separate — don't duplicate content between files. -->
If no STYLE_GUIDE.md exists (or user approved regeneration):
Follow the full style guide generation process:
Generate STYLE_GUIDE.md with evidence-backed conventions for:
Rules for style guide generation:
src/services/UserService.ts, src/services/OrderService.ts..."For deeper standalone style analysis (17-section output, full evidence citations), use
/generate-comprehensive-style-guide. For pre-commit/pre-PR style enforcement against the generated guide, use/review-style-guide.
If no .beads/ directory exists:
bd init
This creates the .beads/ directory with config, issue tracking, and git hooks. After init, add the Beads integration to .claudeignore:
# Beads internals
.beads/dolt/
(Keep .beads/issues.jsonl and .beads/config.yaml tracked in git — only exclude the Dolt database files.)
If .beads/ already exists, skip initialization.
Create if missing:
docs/solutions/ — institutional learnings for AI retrieval (Compound Engineering pattern: markdown with YAML frontmatter, grouped by category subdirs such as best-practices/, runtime-errors/). Agents and hooks search here alongside AGENTS.md / CLAUDE.md when the project documents that path. Add docs/solutions/.gitkeep if the tree is empty so git tracks the directory.docs/claude/ — for dynamic imports from AGENTS.md / CLAUDE.md.claude/learnings/ — optional; freeform notes if you use session hooks that read this path (not the same layout as docs/solutions/)If both AGENTS.md and STYLE_GUIDE.md were generated:
## Style Guide\nSee [STYLE_GUIDE.md](STYLE_GUIDE.md) for detailed coding conventions.Present a deterministic report card. Track each file's outcome through the run and display the final state:
## Setup Complete
| File | Status |
|------|--------|
| AGENTS.md | ✅ Created (N lines) | ⏭️ Skipped (already existed, N lines) |
| CLAUDE.md | ✅ Created (symlink → AGENTS.md) | ⏭️ Skipped (symlink intact) | ⏭️ Skipped (standalone file, N lines) |
| STYLE_GUIDE.md | ✅ Created (N lines) | ⏭️ Skipped (already existed, N lines) |
| .beads/ | ✅ Initialized | ⏭️ Skipped (already existed) |
| docs/solutions/ | ✅ Created | ⏭️ Already existed |
| docs/claude/ | ✅ Created | ⏭️ Already existed |
| .claude/learnings/ | ✅ Created | ⏭️ Already existed |
Then add:
/audit-claude-md to score your setup and see where to improve."/generate-comprehensive-style-guide for a deeper 17-section style analysis."/review-style-guide before PRs to enforce style conventions."--global ModePlays the macOS "Funk" sound when Claude Code needs your attention. Essential when running multiple parallel sessions.
Check: Read ~/.claude/settings.json, inspect hooks.Notification array.
If empty or missing, add:
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "afplay \"/System/Library/Sounds/Funk.aiff\""
}
]
}
]
}
}
Important: Merge into existing settings — do NOT overwrite other hook categories (SessionStart, Stop, etc.). Use jq or read-modify-write to safely merge.
Platform note: This uses macOS afplay. On Linux, suggest paplay or aplay as alternatives. On Windows/WSL, suggest powershell.exe -c "(New-Object Media.SoundPlayer 'C:\Windows\Media\chord.wav').PlaySync()".
Report which recommended plugins are installed vs missing:
| Plugin | Purpose | Install |
|--------|---------|---------|
| superpowers | Structured workflows (TDD, debugging, planning) | claude plugins:add obra/superpowers |
| episodic-memory | Persistent memory across sessions | claude plugins:add obra/episodic-memory |
| code-simplifier | Code simplification agent | Via plugins marketplace |
| context7 | Library documentation lookup | Via plugins marketplace |
Don't auto-install plugins — just report what's missing and provide install commands.
1. Read ~/.claude/settings.json
2. For each missing global config:
a. Show what will be added
b. Ask for confirmation
c. Apply the change
3. Report final state
--check ModeRead-only audit of your setup. Does not write anything.
1. Read ~/.claude/settings.json
2. Report:
✅ Notification hook: configured (Funk.aiff)
❌ Notification hook: not configured
✅ Plugin: superpowers (installed)
❌ Plugin: episodic-memory (not installed)
...
3. If in a project, also check:
✅ AGENTS.md exists (142 lines) — run /audit-claude-md to score it
✅ CLAUDE.md exists (symlink → AGENTS.md)
⚠️ CLAUDE.md over 200 lines (287 lines) — may increase inference cost 14-22%
❌ CLAUDE.md missing — run /setup-ai to scaffold
✅ STYLE_GUIDE.md exists (87 lines)
❌ STYLE_GUIDE.md missing — run /setup-ai or /generate-comprehensive-style-guide
✅ .beads/ initialized
❌ .beads/ missing — run /setup-ai or bd init
✅ docs/solutions/ exists (structured learnings / Compound pattern)
❌ docs/solutions/ missing — run /setup-ai or mkdir -p docs/solutions && touch docs/solutions/.gitkeep
✅ docs/claude/ exists
❌ docs/claude/ missing
✅ .claude/learnings/ exists (optional hook notes)
✅ Background processes directive found
✅ TDD directive found (tdd_required section detected)
❌ TDD directive missing — add <tdd_required> block to Behavior Directives
✅ Quality Gates workflow found
❌ Quality Gates missing — add Canonical Workflow section
✅ Non-standard tools documented (3 found: uv, custom-cli, deploy.sh)
⚠️ Tech stack section may duplicate package.json — consider trimming
✅ Behavior directives present (XML-style sections detected)
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
tools
Verify worktree plugin patches are intact after plugin updates. Checks compound-engineering and superpowers skills for Claude Code launch instructions.
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
development
Reviews the feature you just built and adds missing test coverage. Focuses on behavior that matters — not coverage metrics. Use after completing a feature to identify untested code paths, edge cases, and risk areas.