# LLM Design Command Instructions

## Goal
Produce a unique Design.md for each site using provided site metadata and portfolio-wide uniqueness checks.

## Inputs
- Site record: domain, title, description, theme, prior design summaries
- Similarity findings: overused/underused aesthetics, max similarity scores
- Seed/style summaries: `${TMP}/DESIGNED.md` (TMP from `.wdmaker/config.toml`)

**Note:** The version suffix (`-vX`) in site directory paths (e.g., `sites/example.com-v1/`) is determined during PREPARE phase by `tools/prepare/batch.sh --version <vX>`. Design and Implement phases use the existing versioned directories.

---

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ CRITICAL: READ ALL RULES BEFORE ANY ACTION ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

## General Rules (Main Agent AND Subagents)

These rules apply to **BOTH the main agent AND all subagents**. Include these in every subagent prompt.

### G1. Script Execution
**Run shell scripts directly (all Python scripts have .sh wrappers):**
- All shell scripts have shebangs (`#!/bin/bash`).
- Execute them directly: `tools/script.sh`
- **Do NOT** add `sh` or `bash` prefix (e.g., `bash tools/script.sh` is WRONG).

**NEVER run Python directly or create Python scripts:**
- Do NOT use `python3`, `python3.12`, `uv run python`, or any Python interpreter
- Do NOT create `.py` files for debugging, inspection, or any purpose
- ALL functionality is accessible via `.sh` wrappers — use those instead

```bash
# CORRECT
tools/design/check-design.sh sites/example.com-v1/DESIGN.md
tools/design/list-designed.sh --root .
tools/design/analyze-seeds.sh --batch-id 001
tools/design/start.sh example.com --root .

# WRONG — DO NOT call Python directly
python3 tools/design/check-design.py ...      # WRONG
python3.12 tools/design/check-design.py ...   # WRONG
uv run python3.12 tools/xxx.py ...            # WRONG — use .sh wrapper
./tools/design/check-design.py ...            # WRONG
```

**AVOID — Absolute paths add unnecessary directory prefix:**

```bash
# WRONG — Uses absolute path to script (symlink source)
/Volumes/Common/QJoon/llm/wdmaker/tools/design/start.sh domain.com --root /Volumes/Ephemeral/CMassM1

# WRONG — Uses absolute path to script AND arguments (repo path)
/Volumes/Ephemeral/CMassK1/tools/design/check-design.sh /Volumes/Ephemeral/CMassK1/sites/example.com-v1/DESIGN.md

# CORRECT — Uses relative paths for both script and arguments
tools/design/start.sh domain.com --root .
tools/design/check-design.sh sites/example.com-v1/DESIGN.md
```

Scripts are symlinked into the repo; always use relative `tools/...` and `sites/...` paths.

### G2. No Invented Commands
- **DO NOT create new bash commands or scripts**
- **DO NOT use ad-hoc shell commands** (cat/ls/find/grep/wc/for-loops)
- Use ONLY the provided assist scripts listed below

**AVOID — Ad-hoc inline Python:**

```bash
# WRONG — Inline Python to parse DESIGN.md
python3.12 -c "
import re
text = open('sites/example.com-v1/DESIGN.md').read()
pattern = re.compile(r'## Aesthetics.*?(?=^##|\Z)', re.DOTALL | re.MULTILINE)
match = pattern.search(text)
print(match.group(0) if match else 'Not found')
"

# CORRECT — Use provided script with --section flag
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --section "Aesthetics"
```

**AVOID — Creating ad-hoc debug scripts in TMP:**

```bash
# WRONG — Creating and running debug scripts
python3.12 /Volumes/Temp/WDMaker/CMassK1/debug_headings.py
python3.12 /Volumes/Temp/WDMaker/CMassK1/debug_regex.py

# CORRECT — Use provided scripts for inspection
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --summary
tools/design/check-design.sh sites/example.com-v1/DESIGN.md --verbose
```

**AVOID — Using non-existent or invented scripts:**

```bash
# WRONG — tools/status.sh does not exist
tools/status.sh --root . | grep DDAZZL

# CORRECT — Use provided status scripts
tools/check/status-report.sh
tools/design/list-designed.sh --root .
```

**AVOID — Piping to grep:**

```bash
# WRONG — Piping output to grep
tools/design/list-designed.sh --root . | grep example.com

# CORRECT — Use script options for filtering, or read full output
tools/design/list-designed.sh --root .
```

### G3. No HEREDOC Pattern
- **NEVER use HEREDOC** (`<<EOF`, `<<'EOF'`, etc.) for ad-hoc file writing
- Use **Write tool** or **Filesystem MCP server** when writing new files
- **Note:** HEREDOC in provided scripts (e.g., `tools/*.sh`) is fine — this rule prohibits ad-hoc LLM usage only

```bash
# WRONG — DO NOT USE HEREDOC for ad-hoc file creation
cat <<EOF > DESIGN.md
# Design Language
...
EOF

# CORRECT — Use Write tool or MCP
# (Use the Write tool in Claude Code to create files)
```

### G4. Temp Directory
- Use `${TMP}` from `.wdmaker/config.toml` for temporary files
- **NEVER use `/tmp`** — always use the configured temp directory

### G5. Directory Creation
- **Use provided scripts** for creating/preparing directories (e.g., `tools/prepare/batch.sh`)
- **NEVER use `mkdir`** directly — directories are scaffolded by workflow scripts
- **DO NOT create `.gitkeep`**, `.keep`, or similar placeholder files

### G6. Preserve Reports
- **DO NOT delete** generated reports (design reports, batch reports, logs)
- **DO NOT make per-site reports** (design start/finish report, implement start/finish report)
- Reports in `.smbatcher/batches/`, `.smbatcher/runs/`, `${TMP}/` are historical records

### G7. Ignore Accessibility and Performance
- **DO NOT design for accessibility** — skip ARIA, screen reader, keyboard navigation, focus management
- **DO NOT design for performance** — skip lazy loading, code splitting, caching, optimization concerns
- Focus purely on **visual aesthetics, creativity, and uniqueness**

---

## Claude Code Specific Rules

These rules are specific to Claude Code orchestration.

### C1. Model Restriction
- **DO NOT use Sonnet model** for design tasks
- Use Opus for design work (higher quality, better creativity)

### C2. Maximum Effort — Ignore Token Budget
- **ALWAYS ignore token budget constraints** — prioritize quality over efficiency
- Put **maximum creative effort** into every design
- Write detailed, rich descriptions in every section
- Never truncate or abbreviate to save tokens
- The goal is the **best possible design**, not the shortest response

### C3. Subagent Assignment — ONE SITE PER SUBAGENT
- Each subagent designs **EXACTLY ONE site**, then terminates
- **NEVER assign 2+ sites** to a single subagent
- Context exhaustion is UNRECOVERABLE — this is not optional.
```
CORRECT:   10 subagents × 1 site each = 10 sites
INCORRECT: 10 subagents × 8 sites each = 80 sites ← WILL FAIL
```

### C4. Subagent Execution Mode — Foreground, Not Background
- **ALWAYS launch subagents in foreground mode** (synchronous), NOT background mode
- This means: Do NOT use `run_in_background: true` for design subagents
- **This does NOT mean sequential** — you CAN and SHOULD launch multiple subagents in parallel within a single message
- Wait for all subagents in the current wave to complete before launching the next wave

### C5. Status Code Updates only via provided Scripts
**NEVER modify REGISTRY.md or batch files directly. Use provided scripts for all status transitions.**

| Role | Status | Script | When |
|------|--------|--------|------|
| Main | B | `tools/prepare/batch.sh` | After batching sites |
| Subagent | d | `tools/design/start.sh <domain>` | Before starting design work |
| Subagent | D | `tools/design/complete.sh <domain>` | After design validated |

**Flow:**
```
Main agent: B (batch created)
     ↓
Subagent: d (design started) → [write DESIGN.md] → D (design complete)
```

---

## Assist Scripts Reference

### `tools/design/start.sh`
**Purpose:** Mark a single site as design-in-progress (d) in REGISTRY. Called by subagent at START of design.

```bash
tools/design/start.sh example.com --root .
```

**Actions:**
- Acquires REGISTRY.lock
- Updates domain status: → d
- Records timestamp

**Options:**
- `<domain>` — Domain to mark (required)
- `--root <path>` — Repository root (default: .)

---

### `tools/design/complete.sh`
**Purpose:** Mark a single site as design-complete (D) in REGISTRY. Called by subagent at END of design.

```bash
tools/design/complete.sh example.com --root .
```

**Actions:**
- Validates DESIGN.md has required headings (unless --skip-validation)
- Acquires REGISTRY.lock
- Updates domain status: d → D
- Records timestamp

**Options:**
- `<domain>` — Domain to mark (required)
- `--root <path>` — Repository root (default: .)
- `--skip-validation` — Skip DESIGN.md validation

---

### `tools/design/frequency.sh`
**Purpose:** Analyze design vocabulary frequency across all DESIGN.md files with TF-IDF scoring.

```bash
tools/design/frequency.sh --root .
tools/design/frequency.sh --root . --top 20 --category patterns
tools/design/frequency.sh --root . --tfidf
```

**Output:**
- Overused terms (avoid these)
- Underused terms (prioritize these)
- Category breakdown (colors, typography, layout, patterns, interactions, effects)
- TF-IDF scores for distinctive terms (with `--tfidf`)

**Options:**
- `--root <path>` — Repository root (default: .)
- `--overused <float>` — Overused threshold (default: 0.4)
- `--underused <float>` — Underused threshold (default: 0.15)
- `--top <N>` — Show top N terms (default: 15)
- `--tfidf` — Show TF-IDF scores for distinctive terms

---

### `tools/design/list-designed.sh`
**Purpose:** List all designed sites and generate `${TMP}/DESIGNED.md` summary.

```bash
tools/design/list-designed.sh --root .
```

**Output:**
- Writes `${TMP}/DESIGNED.md` with all sites, seeds, and completion status
- Console summary of site count and completion rate

**Options:**
- `--root <path>` — Repository root (default: .)
- `--format table|json|simple` — Output format (default: table)
- `--no-fix` — Don't auto-fix missing headings

**Generated DESIGNED.md contains:**
- Domain and directory name
- Seed/style extracted from stamp or content
- Aesthetic summary
- Colors and fonts used
- Completion status
- Content hash

---

### `tools/design/analyze-seeds.sh`
**Purpose:** Suggest unused seed/style combinations for a batch.

```bash
tools/design/analyze-seeds.sh --batch-id 001
```

**Output:**
- Annotates batch file with suggested seed/style combos
- Avoids already-used combinations from DESIGNED.md

**Options:**
- `--root <path>` — Repository root (default: .)
- `--batch-id <ID>` — Batch ID to annotate (default: latest)
- `--count <N>` — Number of combos to propose (default: 5)

**Seed/styles loaded from `tools/design/seeds.json`:**
- Contains 30+ pre-defined seed/style combinations
- Also includes design vocabulary (aesthetic, layout, typography, palette, patterns, imagery, motifs, tone)
- Edit seeds.json to add new combinations or vocabulary options

---

### `tools/design/check-design.sh`
**Purpose:** Validate DESIGN.md structure, content quality, and completeness.

```bash
# Single file
tools/design/check-design.sh sites/example.com-v1/DESIGN.md

# All files in batch
tools/design/check-design.sh --batch-id 001

# Verbose output
tools/design/check-design.sh --batch-id 001 --verbose
```

**Checks performed:**
- Required headings present
- No placeholder content (TODO, FIXME, lorem ipsum)
- Minimum content length per section (50+ chars)
- Color palette (3+ hex colors)
- Typography mentions (font names)
- Uniqueness notes quality (3+ differentiators, seed/style mentioned)
- Design stamp presence

**Options:**
- `--root <path>` — Repository root (default: .)
- `--batch-id <ID>` — Validate all designs in batch
- `--verbose, -v` — Show detailed issues
- `--strict` — Fail on any issue (including warnings)

**Exit codes:**
- 0 = All passed
- 1 = Failures found

---

### `tools/design/write-design.sh`
**Purpose:** Stamp DESIGN.md with uniqueness metadata.

```bash
# Manual seed
tools/design/write-design.sh sites/example.com-v1/DESIGN.md --seed "glassmorphism-minimal"

# Auto-extract seed from content
tools/design/write-design.sh sites/example.com-v1/DESIGN.md --auto

# Validate only (no write)
tools/design/write-design.sh sites/example.com-v1/DESIGN.md --validate
```

**Stamp format:**
```html
<!-- DESIGN STAMP
  timestamp: 2025-12-17T10:30:00
  domain: example.com
  seed: glassmorphism-minimal
  aesthetic: Translucent panels with backdrop blur...
  content_hash: a1b2c3d4e5f6
-->
```

**Options:**
- `--seed <string>` — Uniqueness seed (style identifier)
- `--auto` — Auto-extract seed from Uniqueness Notes section
- `--validate` — Check without writing
- `--force` — Force update even if already stamped with same hash

---

### `tools/design/read-design.sh`
**Purpose:** Read and display DESIGN.md with structured output.

```bash
# Full output
tools/design/read-design.sh sites/example.com-v1/DESIGN.md

# Summary only
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --summary

# Specific section
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --section "Aesthetics"

# Implementation prompts only
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --prompts

# Extract colors
tools/design/read-design.sh sites/example.com-v1/DESIGN.md --colors
```

**Options:**
- `--section, -s <name>` — Show specific section (partial match)
- `--summary` — Show metadata summary only
- `--prompts` — Show implementation prompts only
- `--colors` — Show colors only
- `--fonts` — Show fonts only
- `--raw` — Show raw content without formatting

---

### `tools/design/check-dirs.sh`
**Purpose:** Verify batch site directories exist.

```bash
tools/design/check-dirs.sh --batch-id 001 --root .

# Also check DESIGN.md exists
tools/design/check-dirs.sh --batch-id 001 --root . --require-design
```

**Options:**
- `--batch-id <ID>` — Batch ID to check
- `--root <path>` — Repository root (default: .)
- `--require-design` — Also verify DESIGN.md files exist

**Important:** Do NOT create directories manually. If missing, rerun prepare/batch step.

---

### `tools/design/run.sh`
**Purpose:** Design workflow runner for batch processing with auto-detection.

```bash
# AUTO-DETECTION (default) — finds and claims sites automatically
tools/design/run.sh

# MANUAL OVERRIDE — specify sites explicitly
tools/design/run.sh --sites "domain:title:desc:theme" --batch-size 20
tools/design/run.sh --sites "example.com:Example:Description:tech" --dry-run
```

**Auto-Detection Behavior (no arguments):**
- Uses `find-next.sh --claim` for atomic find + claim (prevents race conditions)
- Priority: sites with `d` (continue) → `B` (start) → `-` (need batching)
- Multiple subagents can run simultaneously without collision

**Actions:**
- Calls `register.sh` to register sites
- Calls `batch.sh` to create batch
- Transitions status: B → d → D
- Writes DesignPackage.json manifest for each site
- Runs similarity guard to check for overused patterns
- Generates frequency report (advisory)
- Logs to `.smbatcher/runs/design-<timestamp>.log`

**Options:**
- `--sites <string>` — Comma-separated site list: domain:title:desc[:theme] (optional, auto-detects if omitted)
- `--batch-size <N>` — Batch size for design (default: 20)
- `--dry-run` — Simulate without writing assets
- `--root <path>` — Override repository root

**Important:** This script orchestrates the design workflow but does NOT generate the actual DESIGN.md content. The LLM must write the design language using the Write tool.

---

### `tools/shared/similarity.sh`
**Purpose:** Compute TF-IDF similarity scores between design documents.

```bash
tools/shared/similarity.sh sites/*/DESIGN.md
```

**Features:**
- Uses scikit-learn TF-IDF if available, fallback to pure Python
- Computes pairwise cosine similarity
- Returns maximum similarity score

**Output:**
```
max_similarity=0.4523
```

**Usage in Design:**
- Called by `run.sh` to check for overused patterns
- Similarity above 0.5 triggers advisory warning
- Use to ensure unique design vocabulary across sites

---

### `tools/design/verify-post-design.sh`
**Purpose:** Mark batch and REGISTRY as designed after validation.

```bash
tools/design/verify-post-design.sh --batch-id 001
```

**Options:**
- `--batch-id <ID>` — Batch ID to verify and mark complete
- `--root <path>` — Repository root (default: .)

---

### `tools/design/register.sh`
**Purpose:** Register/update sites in REGISTRY.

```bash
tools/design/register.sh --sites "example.com:Example Site:A description"
```

---

## Prohibited vs Alternatives

| ❌ Prohibited | ✅ Use Instead |
|--------------|----------------|
| `cat/less/head/tail` file inspection | `tools/design/read-design.sh <path> --summary` |
| `ls/find/wc/globs` directory listing | `tools/design/check-dirs.sh --batch-id <ID> --root .` |
| `grep "pattern"` searching | `tools/design/list-designed.sh --root .` or `tools/design/frequency.sh --root .` |
| `for f in *.md; do` loops | `tools/design/check-design.sh --batch-id <ID>` |
| `mkdir -p` directory creation | `tools/prepare/batch.sh --version v1 --batch-size 20` |
| `python3 script.py` | `tools/.../<script>.sh` (shell wrappers) |
| `uv run python3.12 ...` | `tools/.../<script>.sh` (shell wrappers) |
| `cat <<EOF` HEREDOC | Write tool or Filesystem MCP |
| Creating new scripts | Use existing assist scripts only |

---

## Required Sections in Design.md

```markdown
# Design Language for <domain>

## Aesthetics and Tone
(Visual direction, mood, inspiration)

## Layout Motifs and Structure
(Grid system, composition, spatial relationships)

## Typography and Palette
(Font choices, color values with hex codes)

## Imagery and Motifs
(Visual elements, icons, decorative patterns)

## Prompts for Implementation
(Specific guidance for HTML/CSS/JS implementation)

## Uniqueness Notes
(3+ differentiators, chosen seed/style, avoided patterns)
```

---

## Steps for LLM

> **Note:** General Rules (G1-G7) and Claude Code Rules (C1-C5) apply to ALL steps below.

### Quick Start: Auto-Detection Mode

For automated batch processing with atomic claiming (prevents race conditions):

```bash
# Auto-detects sites with d/B/- status and claims them atomically
tools/design/run.sh
```

This uses `find-next.sh --claim` internally. Multiple agents can run simultaneously without collision.

For manual orchestration with subagents, follow the steps below.

---

## Step 0: Read instructions about Prohibited
Execute:
  Tool: Read
  Path: tools/design/CDESIGN.md

### Step 1: Load Config (Main Agent)

Execute: Read .wdmaker/config.toml to get TMP directory
  Tool: Bash
  Command: `tools/prepare/info.sh --root .`
  Background:
  - ${TMP} is typically /Volumes/Temp/WDMaker/<repo>/
  - NEVER ACCESS `/tmp/*`

### Step 2: Get Uniqueness Signals (Main Agent)

Execute #1: Check overused/underused terms
  Tool: Bash
  Command: `tools/design/frequency.sh --root .`

Execute #2: Build DESIGNED.md with existing seeds
  Tool: Bash
  Command: `tools/design/list-designed.sh --root .`

Execute #3: Get suggested seed/style combos
  Tool: Bash
  Command: `tools/design/analyze-seeds.sh --batch-id <ID>`
  Background:
  - `<ID>` comes from: user input, conversation context, or `tools/shared/find-next.sh --registry .smbatcher/REGISTRY.md --phase design`
  - find-next.sh returns the batch with B or d status (unfinished design work)
  - You can also list all sites in a batch: `tools/shared/list-sites.sh --batch <ID> --status "B,d"`

### Step 3: Verify Directories existance (Main Agent)

Execute: Verify Directory for sites are already exist.
  Tool: Bash
  Command: `tools/design/check-dirs.sh --batch-id <ID> --root .`
  Background:
  - `<ID>` comes from: user input, conversation context, or find-next.sh output from Step 2
  - NEVER check/create directory by other way. Check only via this execution.
  - If missing, STOP and return PREPARE instruction.

### Step 4: Launch Subagents (Main Agent)

Launch Opus subagents to design sites in parallel. Assign only ONE site to each subagent.
When launch a subagent, provide Subagent Launch Template to the subagent

**CRITICAL — PARALLEL LAUNCH WITH CONCURRENCY LIMIT:**
To execute subagents in parallel, you MUST send a **SINGLE message** containing **MULTIPLE Task tool calls**.

**IMPORTANT: Limit concurrent subagents to 10 maximum (total, not per batch).**
- If batch has > 10 sites, launch 10 subagents, wait for completion, then launch the next wave
- If processing multiple batches, the 10 limit applies across ALL batches combined
- This prevents context exhaustion and ensures stable parallel execution
- Reset the concurrent counter after all subagents in the wave complete before launching the next wave

Example for 10 sites in batch:
```
ONE message with 10 Task tool calls (MAXIMUM):
  Task #1: prompt="Design ONLY site1.com... You are at repo root...", subagent_type="general-purpose"
  Task #2: prompt="Design ONLY site2.com... You are at repo root...", subagent_type="general-purpose"
  Task #3: prompt="Design ONLY site3.com... You are at repo root...", subagent_type="general-purpose"
  ...
  Task #10: prompt="Design ONLY site10.com... You are at repo root...", subagent_type="general-purpose"
```

If batch has 25 sites:
```
WAVE 1 (10 subagents):
  Task #1-10: sites 1-10

WAIT FOR COMPLETION ← Reset counter here

WAVE 2 (10 subagents):
  Task #1-10: sites 11-20

WAIT FOR COMPLETION ← Reset counter here

WAVE 3 (5 subagents):
  Task #1-5: sites 21-25
```

**DO NOT** launch only one subagent at total, wait for it, then launch the next. Launch only one subagent is sequential, not parallel.
**DO** include all Task tool calls in the same response message.
**DO NOT** exceed 10 concurrent subagents — this causes context exhaustion and failures.

### Step 5: Design Site (Subagent — Per Site LLM Work)

- NEVER TRY to check/create directory or placeholder.
- NEVER TRY to create file(ex: DESIGN.md) via cat/HEREDOC pattern. Use Only Write tool or Filesystem MCP.

Execute #1: Mark design start
  Tool: Bash
  Command: `tools/design/start.sh <domain> --root .`

Execute #2: Read existing designs for reference
  Tool: Bash
  Command: `tools/design/read-design.sh sites/<completed-domain-vX>/DESIGN.md`
  Background:
  - Pick a domain from REGISTRY.md with status D, i, I, or Q (completed designs)
  - Read 1-2 existing designs to understand portfolio style and avoid duplication
  - Also read batch file `.smbatcher/batches/Batch_<ID>.md` for current site info

Execute #3: Plan unique seed/style
  Tool: bash
  Command: `tools/design/frequency.sh --root .`
  Background:
  - Check frequency of used patterns

Execute #4: Read seeds.json
Execute:
  Tool: Read
  Path: tools/design/seeds.json

After execute #1~#4, start design
  - Reference `tools/design/seeds.json` for available combinations
  - Choose combination not already used (Use result from #3. Do not try to get info from other way)
  - Prefer underused patterns from frequency analysis
  - Explore bold ideas to enhance creativity in Aesthetics, Layout, and Prompts sections.

Write DESIGN.md
  - Write `sites/<domain-vX>/DESIGN.md` with all required sections. Never make placeholder.

**Content requirements:**
  - `## Aesthetics and Tone`: Visual direction, mood, inspiration
  - `## Layout Motifs and Structure`: Grid system, composition
  - `## Typography and Palette`: Font choices, hex color values
  - `## Imagery and Motifs`: Visual elements, icons, patterns
  - `## Prompts for Implementation`:
    - Emphasize storytelling
    - Bias toward full-screen narrative/animation experiences
    - Avoid CTA-heavy layouts, pricing blocks, stat-grids
  - `## Uniqueness Notes`:
    - List 3+ differentiators
    - Document chosen seed/style
    - Reference avoided patterns

Execute #5: Validate
  Tool: Bash
  Command: `tools/design/check-design.sh sites/<domain-vX>/DESIGN.md`
  Background:
  - Must return OK before proceeding.

Execute #6: Stamp
  Tool: Bash
  Command: `tools/design/write-design.sh sites/<domain-vX>/DESIGN.md --auto`

Execute #7: Mark design complete
  Tool: Bash
  Command: `tools/design/complete.sh <domain> --root .`

---

## Subagent Launch Template

When launching subagents for parallel design.
**IMPORTANT:**
- Launch in **foreground mode** (C3), assign **ONE site only** (C2)
- **Subagents MUST use Opus model** — set `model: "opus"` parameter when launching. NEVER use Sonnet.
- Do NOT use `run_in_background: true` — all subagents must run in foreground

```
Design ONLY the site <domain>. Do NOT design any other sites.

- NEVER TRY to check/create directory or placeholder.
- NEVER TRY to create file(ex: DESIGN.md) via cat/HEREDOC pattern. Use Only Write tool or Filesystem MCP.
- NEVER DELETE file which you created.
- DO NOT report result

You are at the repository root. Do NOT change directory. Use `sites/<domain-vX>/...` paths.

## Step 0: Read instructions
Execute:
  Tool: Read
  Path: tools/design/CDESIGN.md

## Step 1: Mark design start
Execute:
  Tool: Bash
  Command: tools/design/start.sh <domain> --root .
  Background:
  - Marks domain status as 'd' (design-in-progress) in REGISTRY
  - Acquires lock to prevent race conditions

## Step 2: Read existing designs for reference
Execute:
  Tool: Bash
  Command: tools/design/read-design.sh sites/<completed-domain-vX>/DESIGN.md
  Background:
  - Pick a domain from REGISTRY.md with status D, i, I, or Q (completed designs)
  - Read 1-2 existing designs to understand portfolio style and avoid duplication
  - Also read batch file `.smbatcher/batches/Batch_<ID>.md` for current site info

## Step 3: Check design frequency
Execute:
  Tool: Bash
  Command: tools/design/frequency.sh --root .
  Background:
  - Check frequency of used patterns

## Step 4: Read seeds.json
Execute:
  Tool: Read
  Path: tools/design/seeds.json

## Design unique site (LLM work - no script)
- Prefer underused patterns from frequency analysis
- Explore bold ideas, Enhance creativity in Aesthetics, Layout, and Prompts sections.

**Content requirements:**
  - `## Aesthetics and Tone`: Visual direction, mood, inspiration
  - `## Layout Motifs and Structure`: Grid system, composition
  - `## Typography and Palette`: Font choices, hex color values
  - `## Imagery and Motifs`: Visual elements, icons, patterns
  - `## Prompts for Implementation`:
    - Emphasize storytelling
    - Bias toward full-screen narrative/animation experiences
    - Avoid CTA-heavy layouts, pricing blocks, stat-grids
  - `## Uniqueness Notes`:
    - List 3+ differentiators
    - Document chosen seed/style
    - Reference avoided patterns

## Write DESIGN.md (LLM work - no script)
Execute:
  Tool: Write
  Path: sites/<domain-vX>/DESIGN.md
  Background:
  - Write `DESIGN.md` with all required sections

## Step 5: Validate design
Execute:
  Tool: Bash
  Command: tools/design/check-design.sh sites/<domain-vX>/DESIGN.md
  Background:
  - Must return OK before proceeding.

## Step 6: Stamp design
Execute:
  Tool: Bash
  Command: tools/design/write-design.sh sites/<domain-vX>/DESIGN.md --auto

## Step 7: Mark design complete
Execute:
  Tool: Bash
  Command: tools/design/complete.sh <domain> --root .
```

---

## Output Format
- Markdown saved as `sites/<domain-vX>/DESIGN.md`
- All required headings in order
- No placeholders — complete design direction
- Consumed by implementation phase to produce HTML/CSS/JS
