Brace - Project Scaffold
When this skill is invoked, IMMEDIATELY output the banner below before doing anything else.
Pick ONE tagline at random — vary your choice each time.
CRITICAL: Reproduce the banner EXACTLY character-for-character, including the diagonal / glyph before the name.
{tagline}
/$$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$$
/$$/| $$__ $$| $$__ $$ /$$__ $$ /$$__ $$| $$_____/
/$$/ | $$ \ $$| $$ \ $$| $$ \ $$| $$ \__/| $$
/$$/ | $$$$$$$ | $$$$$$$/| $$$$$$$$| $$ | $$$$$
/$$/ | $$__ $$| $$__ $$| $$__ $$| $$ | $$__/
/$$/ | $$ \ $$| $$ \ $$| $$ | $$| $$ $$| $$
/$$/ | $$$$$$$/| $$ | $$| $$ | $$| $$$$$$/| $$$$$$$$
|__/ |_______/ |__/ |__/|__/ |__/ \______/ |________/
Taglines:
- 🏗️ Bracing the structure...
- 💪 Reinforcing before load!
- 🔒 Locking in the framework!
- 🏋️ Preparing for heavy lifting!
- 🧱 Cross-bracing the foundation!
- 🔧 Tightening the load path!
- ✅ Structural integrity confirmed!
- 💥 Brace for impact!
Output Formatting
After the banner, display parsed input:
┌─ Input ────────────────────────────────────────
│ {Field}: {value}
│ Flags: {parsed flags or "none"}
└────────────────────────────────────────────────
Pre-flight results:
── Pre-flight ───────────────────────────────────
✅ {dep} {version or "found"}
⚠️ {dep} not found → {fallback detail}
❌ {dep} missing → stopping
──────────────────────────────────────────────────
Stage/phase headers: ━━ {N} · {Name} ━━━━━━━━━━━━━━━━━━━━━━━━━
Status icons: ✅ done · ❌ failed · ⚠️ degraded · ⏳ working · ⏭️ skipped
Initialize any project directory with a standard scaffold for AI-assisted
development. Idempotent — safe to re-run on existing projects. Content
templates and subagent prompts are in references/.
Key principle: Scan first, present plan, get approval, then act.
Phase prompts: references/phase-prompts.md
Scaffold manifest: references/scaffold-manifest.md
Report format: references/report-template.md
Flags
Parse optional flags from the request:
--force— Overwrite existing files without prompting
Pre-flight
Before starting, check all dependencies in this table:
| Dependency | Type | Check | Required | Resolution | Detail |
|---|---|---|---|---|---|
| superpowers | plugin | on-disk glob via scripts/lib/superpowers.js | no | ask | claude plugin install superpowers |
For each row, in order:
- Run the Check command (for cli/npm) or test file existence (for agent/skill)
- If found: continue silently
- If missing: apply Resolution strategy
- stop: notify user with Detail, halt execution
- url: notify user with Detail (install link), halt execution
- install: notify user, run the command in Detail, continue if successful
- ask: notify user, offer to run command in Detail, continue either way (or halt if required)
- fallback: notify user with Detail, continue with degraded behavior
- After all checks: summarize what's available and what's degraded
Superpowers is a soft dependency detected via the on-disk glob helper
scripts/lib/superpowers.js (anchor file using-superpowers/SKILL.md) —
see references/superpowers-deferral.md.
- Capture FLAGS from the user's request
Phase 1: Directory Scan
Launch general-purpose subagent (bash) (haiku):
Task(
subagent_type: "general-purpose",
model: "haiku",
description: "Scan directory for existing scaffold structure",
prompt: <read from references/phase-prompts.md#phase-1>
)
Parse SCAN_REPORT. Extract:
directory_name(used as default project name)existing_dirs/missing_dirsexisting_files/missing_fileshas_claude_md/has_gitignorehas_atlas(legacy ATLAS naming detected)has_forge(legacy FORGE naming detected)has_legacy_gotcha(legacy GOTCHA/goals structure detected)has_legacy_memory(old tools/memory system detected)
Phase 1b: Legacy Upgrade Detection
Skip if none of has_atlas, has_forge, has_legacy_gotcha, or has_legacy_memory is true.
Build a description of what was found:
- If
has_atlasorhas_forge: "Legacy ATLAS/FORGE naming detected" - If
has_legacy_gotcha: "Legacy GOTCHA/BRACE framework detected (goals/ directory)" - If
has_legacy_memory: "Legacy memory system (tools/memory/, memory/) detected"
Ask the user via AskUserQuestion:
Question: "Legacy components detected: {description}. Upgrade and clean up?" Options:
- "Yes, upgrade all" — Replace legacy structure and remove old systems
- "No, leave as-is" — Keep existing structure
Store result as upgrade_legacy: true|false in USER_CONFIG.
Phase 2: Project Inquiry
Runs on primary thread (user interaction required).
Derive default project name from SCAN_REPORT
directory_namePresent via AskUserQuestion:
Question: "Set up project scaffold?" Options:
- "Full scaffold (Recommended)" — CLAUDE.md, directories, guardrails
- "Cancel"
If not cancelled, ask for project description (one sentence) via AskUserQuestion with free text.
Ask installation level via AskUserQuestion:
Question: "Install universal guidance (preferences, principles) at user level?" Options:
- "Yes, install globally (Recommended)" — applies to all projects via
~/.claude/CLAUDE.md - "No, project level only" — self-contained in this project's CLAUDE.md
- "Yes, install globally (Recommended)" — applies to all projects via
Store as USER_CONFIG:
- project_name: from directory name or user override
- description: from user input
- install_level: "global" | "project"
If cancelled, stop here.
Phase 3: Present Plan & Approve
Build the ACTION_PLAN from SCAN_REPORT + USER_CONFIG + FLAGS.
For each item in references/scaffold-manifest.md:
- If component not selected in USER_CONFIG → status: "not selected"
- If item already exists (from SCAN_REPORT) and no
--force→ status: "skip" - If item exists and
--force→ status: "overwrite" - If CLAUDE.md exists → status: "merge" (append scaffold sections)
- If .gitignore exists → status: "merge" (append missing entries)
- Otherwise → status: "create"
If upgrade_legacy is true in USER_CONFIG, set status "upgrade" for:
- CLAUDE.md (replaces "merge" or "skip" — upgrade takes priority)
If upgrade_legacy is true AND has_legacy_gotcha is true, additionally:
goals/→ status: "remove" (only if contains only manifest.md and build_app.md)
If upgrade_legacy is true AND has_legacy_memory is true, additionally:
tools/memory/→ status: "remove"memory/→ status: "remove"tools/manifest.md→ status: "cleanup" (remove memory tool rows).gitignore→ status: "cleanup" (remove memory/*.npy entry)
Present plan summary to user via AskUserQuestion:
Project Scaffold for: {project_name}
Will create: {list of items with status "create"}
Will merge: {list of items with status "merge"}
Will upgrade: {list of items with status "upgrade"}
Will remove: {list of items with status "remove" — legacy cleanup}
Will clean: {list of items with status "cleanup" — remove legacy references}
Will skip: {count} existing items
Universal guidance: {install_level description}
Proceed?
Options: "Yes, proceed" / "Cancel"
If cancelled, stop here.
Phase 4: Scaffold Structure
Launch general-purpose subagent:
Task(
subagent_type: "general-purpose",
description: "Create project scaffold structure",
prompt: <read from references/phase-prompts.md#phase-4>
)
Before sending the prompt, substitute these variables:
{ACTION_PLAN}— the action plan from Phase 3{PROJECT_NAME}— from USER_CONFIG{PROJECT_DESCRIPTION}— from USER_CONFIG{INSTALL_LEVEL}— from USER_CONFIG ("global" or "project"){CLAUDE_MD_TEMPLATE}— read fromreferences/claude-md-template.md(the section between BEGIN TEMPLATE and END TEMPLATE){GITIGNORE_CONTENT}— read fromassets/gitignore-template{GLOBAL_PREFERENCES_CONTENT}— read fromassets/global-preferences-template.md(the section between BEGIN TEMPLATE and END TEMPLATE)
Parse SCAFFOLD_REPORT. If status is "failed", report to user and stop.
Branch Discipline Injection
When updating an existing project CLAUDE.md (not creating from template):
- Check if
## Branch Disciplinealready exists:grep -q "## Branch Discipline" CLAUDE.md - If NOT found, inject the Branch Discipline section before
## Guardrails:- Read the file content
- Find the line containing
## Guardrails - Insert the Branch Discipline section (from the template) immediately before it
- If no
## Guardrailssection exists, append the section at the end of the file
- If already present, skip (idempotent)
Worktree Discipline Injection
When updating an existing project CLAUDE.md (not creating from template):
- Check if
## Worktree Disciplinealready exists:grep -q "## Worktree Discipline" CLAUDE.md - If NOT found, inject the Worktree Discipline section before
## Guardrails:- Read the file content
- Find the line containing
## Guardrails - Insert the Worktree Discipline section (from the template) immediately before it
- If no
## Guardrailssection exists, append the section at the end of the file
- If already present, skip (idempotent)
Verification Discipline Injection
When updating an existing project CLAUDE.md (not creating from template):
- Check if
## Verification Disciplinealready exists:grep -q "## Verification Discipline" CLAUDE.md - If NOT found, inject the Verification Discipline section before
## Guardrails:- Read the file content
- Find the line containing
## Guardrails - Insert the Verification Discipline section (from the template) immediately before it
- If no
## Guardrailssection exists, append the section at the end of the file
- If already present, skip (idempotent)
Known Gotchas Injection
When updating an existing project CLAUDE.md (not creating from template):
- Check if
## Known Gotchasalready exists:grep -q "## Known Gotchas" CLAUDE.md - If NOT found, inject the Known Gotchas section before
## Guardrails:- Read the file content
- Find the line containing
## Guardrails - Insert the Known Gotchas section (from the template) immediately before it
- If no
## Guardrailssection exists, append the section at the end of the file
- If already present, skip (idempotent)
Phase 5: Verification & Report
Launch general-purpose subagent (bash) (haiku):
Task(
subagent_type: "general-purpose",
model: "haiku",
description: "Verify project scaffold",
prompt: <read from references/phase-prompts.md#phase-5>
)
Parse VERIFY_REPORT. Present the final summary using the format in
references/report-template.md.
Phase 6: Branch Protection
Only if the project is a git repo (from SCAN_REPORT git_initialized).
Detect the default branch and hosting platform (GitHub, Azure DevOps, or
unknown). Platform detection and all CLI/REST commands are in
references/branch-protection-steps.md.
Flow
- Detect platform from
git remote get-url origin - GitHub: Check existing protection via
gh api. If unprotected, ask via AskUserQuestion:- "Yes, require PR reviews (team project — Recommended)" — require 1 approval, block force push + deletion
- "Yes, protect branch without review requirement (solo project)" — block force push + deletion, no reviewer gate so
/shipsquash-merges without--admin - "Skip" — leave unprotected
- Azure DevOps: Extract org/project from remote URL. Check existing
policies via
az reposCLI or REST fallback. If no minimum reviewer policy, ask via AskUserQuestion:- "Yes, require PR reviews (team project — Recommended)" — 1 approver, creator votes do not count
- "Yes, PR required, author can self-approve (solo project)" — same approver policy but
creator-vote-counts=trueso the author's own vote satisfies the gate - "Skip" — no policy applied
- Unknown platform: Skip and report.
Apply the variant matching the user's choice using the procedures in
references/branch-protection-steps.md (see "Apply protection — team
project" vs "Apply protection — solo project" for each platform).
Include result in the final report under a "🔒 Branch protection" section, labelled with the chosen variant (team / solo / skipped).
Lifecycle Recommendation
After presenting the report, record lifecycle completion and surface the next step:
_R="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/slamb2k}"
node "$_R/hooks/session-guard.cjs" lifecycle-complete brace
If the command prints a LIFECYCLE_OFFER_BEGIN…END block, present that offer to
the user via AskUserQuestion as instructed inside the block. If it prints nothing
(or LIFECYCLE_OFFER_NONE), do not mention the lifecycle engine.
Idempotency Rules
- Skip directories and files that already exist (unless
--force) - Merge CLAUDE.md: append scaffold sections if file exists but lacks them
- Merge .gitignore: append missing entries only
- Never delete user content
- Never overwrite without
--forceor explicit user approval
Error Handling
Standard escalation pattern:
- If retryable (permission issue after mkdir): retry once
- If persistent: report to user with specific error
- Offer: skip and continue / abort
- Never silently swallow errors
Common issues:
- Permission denied → report, suggest checking directory permissions
- CLAUDE.md merge conflict → show both versions, let user choose
- Directory is read-only → abort with clear message