Skip to content

Customizing Spawn Prompts

The template system lets you customize the prompts generated by wu:brief for your project’s specific needs. You can add new templates, override existing ones, and create client-specific variations for different AI tools.

Most consumers should start with the built-in wu:brief defaults and add project-local templates only when they need different wording or extra domain-specific instructions.

  • New installs get the current prompt composition automatically.
  • Existing installs get the runtime defaults after pnpm lumenflow:upgrade --latest.
  • lumenflow:upgrade automatically syncs onboarding docs and vendor assets (no separate docs:sync step needed).
  • Create .lumenflow/templates/ only when you want to override or extend the shipped defaults.

Project Standards

Embed your team’s coding standards, architecture patterns, and best practices.

Tool-Specific

Provide different instructions for Claude Code vs Cursor vs Windsurf.

Domain Knowledge

Include domain-specific terminology, APIs, and business logic context.

Workflow Tweaks

Adjust verification profiles, lane-specific guidance, or client-specific wording.

  1. Create the template file

    mkdir -p .lumenflow/templates/spawn-prompt
    cat > .lumenflow/templates/spawn-prompt/api-standards.md << 'EOF'
    ---
    id: api-standards
    name: API Standards
    required: false
    order: 150
    condition: "lane === 'Framework: Core'"
    ---
    
    ## API Design Standards
    
    When working on API endpoints:
    
    - Use RESTful conventions
    - Return consistent error formats
    - Include OpenAPI annotations
    - Write integration tests for all endpoints
    EOF
  2. Add to manifest

    Edit .lumenflow/templates/manifest.yaml:

    templates:
      # ... existing templates ...
    
      - id: api-standards
        path: spawn-prompt/api-standards.md
        required: false
        order: 150
        condition: "lane === 'Framework: Core'"
  3. Test the template

    pnpm wu:brief --id WU-XXX --client <client>

Different AI tools have different capabilities. Override templates to provide tool-specific instructions.

.lumenflow/
  templates/
    spawn-prompt/
      code-craft.md              # Base template
  templates.claude/
    spawn-prompt/
      code-craft.md              # Claude Code override
  templates.cursor/
    spawn-prompt/
      code-craft.md              # Cursor override
  1. Load base template from templates/spawn-prompt/
  2. Normalize client name to an alias (for example claude-code -> claude)
  3. Check for client override in templates.{alias}/spawn-prompt/
  4. If override exists with matching id, use it instead of base
  5. If no override, use base template
Client Flag (--client)AliasOverride Directory
claude-codeclaudetemplates.claude/
codex-clicodextemplates.codex/
gemini-cligeminitemplates.gemini/
cursorcursortemplates.cursor/
windsurfwindsurftemplates.windsurf/
---
id: skills-selection
name: Skills Selection (Claude)
required: true
order: 50
---

## Skills Selection (Claude Code)

**IMPORTANT**: Before starting work, load relevant skills.

### Loading Skills

Use the `/skill` command:

/skill wu-lifecycle # WU claim/block/done /skill tdd-workflow # RED-GREEN-REFACTOR /skill worktree-discipline # Path safety


### Skills Catalog

View available skills: `ls .claude/skills/`

These template IDs ship with the default wu:brief composition and can be overridden per client or per project:

Generator / SectionTemplate IDPathDefault OrderDefault Tokens
Methodology guidancemethodology-tddspawn-prompt/methodology/tdd-directive.md5-
Methodology guidancemethodology-test-afterspawn-prompt/methodology/test-after-directive.md5-
Methodology guidancemethodology-nonespawn-prompt/methodology/none-directive.md5-
Architecture guidancearchitecture-hexagonalspawn-prompt/architecture/hexagonal-directive.md6-
Architecture guidancearchitecture-layeredspawn-prompt/architecture/layered-directive.md6-
Architecture guidancearchitecture-nonespawn-prompt/architecture/none-directive.md6-
Fallback testing guidancetdd-directivespawn-prompt/tdd-directive.md10-
Docs/config guidancedocumentation-directivespawn-prompt/documentation-directive.md10-
Verification strategyvisual-directivespawn-prompt/visual-directive.md15-
Verification strategyrefactor-directivespawn-prompt/refactor-directive.md15-
Verification strategystructured-content-directivespawn-prompt/structured-content-directive.md15-
Required verification renderingverification-requirementsspawn-prompt/verification-requirements.md18REQUIRED_VERIFICATION
generateProjectSpecificCoChangeGuidanceproject-specific-co-change-guidancespawn-prompt/project-specific-co-change-guidance.md19CO_CHANGE_GUIDANCE_SECTION
Skills selectionskills-selectionspawn-prompt/skills-selection.md50-
Skills guidancecode-craftspawn-prompt/code-craft.md55-
Edit disciplineread-before-writespawn-prompt/read-before-write.md60-
UI design contextdesign-context-uispawn-prompt/design-context-ui.md65-
generateMandatoryAgentSectionmandatory-agentsspawn-prompt/mandatory-agents.md66MANDATORY_AGENTS
generateInvariantsPriorArtSectioninvariants-prior-artspawn-prompt/invariants-prior-art.md67INVARIANTS_PRIOR_ART_SECTION
generateImplementationContextimplementation-contextspawn-prompt/implementation-context.md68IMPLEMENTATION_CONTEXT_SECTION
generateEffortScalingRuleseffort-scalingspawn-prompt/effort-scaling.md100-
generateParallelToolCallGuidanceparallel-tool-callsspawn-prompt/parallel-tool-calls.md110-
generateIterativeSearchHeuristicssearch-heuristicsspawn-prompt/search-heuristics.md120-
generateTokenBudgetAwarenesstoken-budgetspawn-prompt/token-budget.md130WU_ID
generateCompletionFormatcompletion-formatspawn-prompt/completion-format.md135-
generateCompletionWorkflowSectioncompletion-workflowspawn-prompt/completion-workflow.md136WU_ID
generateAgentCoordinationSectionagent-coordinationspawn-prompt/agent-coordination.md137AGENT_COORDINATION_SECTION
generateBugDiscoverySectionbug-discoveryspawn-prompt/bug-discovery.md200WU_ID
generateQuickFixCommandsquick-fix-commandsspawn-prompt/quick-fix-commands.md210-
generateLaneSelectionSectionlane-selectionspawn-prompt/lane-selection.md220-
Recovery guidanceworktree-recoveryspawn-prompt/worktree-recovery.md300WORKTREE_PATH
generateWorktreePathGuidanceworktree-path-guidancespawn-prompt/worktree-path-guidance.md301WORKTREE_PATH
Lane-specific guidancelane-guidance-operationsspawn-prompt/lane-guidance/operations.md400-
Lane-specific guidancelane-guidance-frameworkspawn-prompt/lane-guidance/framework.md400-
Lane-specific guidancelane-guidance-contentspawn-prompt/lane-guidance/content.md400-
generateActionSection (claimed path)action-claimedspawn-prompt/action-claimed.md820WORKTREE_PATH
generateActionSection (unclaimed path)action-unclaimedspawn-prompt/action-unclaimed.md820WU_ID, LANE, WORKTREE_PATH_HINT, WU_EVENTS_PATH
generateDbRiskVerificationGuidancedb-risk-verificationspawn-prompt/db-risk-verification.md845-
Pre-completion checklistself-reviewspawn-prompt/self-review.md850WU_ID
Full prompt constraintsconstraintsspawn-prompt/constraints.md1000WU_ID
generateCodexConstraintscodex-constraintsspawn-prompt/codex-constraints.md1005WU_ID plus numbering and TDD-block tokens

Example: Claude-Specific Code Craft Override

Section titled “Example: Claude-Specific Code Craft Override”
---
id: code-craft
name: Code Craft (Claude)
required: true
order: 55
---

## Code Craft (Claude)

Before writing custom code, run a focused library/context search for existing patterns.

<example>
// Before
die('failed');

// After
die('Failed to parse workspace.yaml: missing lane field. Run pnpm lane:setup to regenerate.');
</example>

Create a markdown file with YAML frontmatter:

---
id: my-custom-template
name: My Custom Template
required: false
order: 250
tokens: [WU_ID, LANE]
condition: "type === 'feature'"
---

## Custom Guidance for {WU_ID}

Working in lane: {LANE}

Your custom instructions here...

Edit .lumenflow/templates/manifest.yaml:

templates:
  # ... existing templates ...

  - id: my-custom-template
    path: spawn-prompt/my-custom-template.md
    required: false
    order: 250
    condition: "type === 'feature'"
# Check manifest is valid
pnpm validate

# Test with a feature WU
pnpm wu:brief --id WU-XXX --client <client> | grep "Custom Guidance"

Add guidance about your project’s architecture patterns:

---
id: architecture-patterns
name: Architecture Patterns
required: true
order: 100
---

## Project Architecture

This project uses:

- **Hexagonal Architecture**: Ports in `src/ports/`, adapters in `src/infrastructure/`
- **CQRS**: Commands in `src/commands/`, queries in `src/queries/`
- **Event Sourcing**: Events in `src/events/`, aggregates in `src/domain/`

### Import Rules

- `application/` NEVER imports from `infrastructure/`
- Use dependency injection for all adapters
- Ports are interfaces only, no implementation

Customize testing guidance beyond default TDD:

---
id: testing-requirements
name: Testing Requirements
required: true
order: 20
condition: "type !== 'documentation'"
---

## Testing Requirements

### Coverage Thresholds

- Application layer: 95% coverage required
- Infrastructure: 80% coverage required
- E2E critical paths: 100% coverage

### Test Patterns

- Use `describe`/`it` blocks, not `test()`
- Mock external services with `vi.mock()`
- Use factories for test data (see `tests/factories/`)

### Required Tests for Features

- [ ] Unit tests for business logic
- [ ] Integration tests for API endpoints
- [ ] E2E test for happy path

Scenario 2b: Structured Content Profiles (YAML/JSON/Markdown)

Section titled “Scenario 2b: Structured Content Profiles (YAML/JSON/Markdown)”

For prompt/config/content work, override the built-in structured-content-directive instead of forcing backend-style TDD steps:

---
id: structured-content-directive
name: Structured Content Directive
required: false
order: 15
condition: "work.testMethodologyHint === 'structured-content' && type !== 'documentation' && type !== 'docs' && type !== 'config'"
---

## Structured Content Verification

- Run the project-specific prompt/classification evaluation command configured by your team
- Validate YAML/JSON schema compatibility for changed content files
- Record evaluator outputs in notes or evidence artifacts

Create guidance for specific lanes:

---
id: lane-guidance-platform
name: Platform Lane Guidance
required: false
order: 400
condition: "laneParent === 'Platform'"
---

## Platform Lane Guidelines

When working on Platform infrastructure:

### Deployment Considerations

- All changes require staging deployment first
- Use feature flags for risky changes
- Update runbooks for operational changes

### Monitoring Requirements

- Add metrics for new services
- Create alerts for error conditions
- Update dashboards for visibility

### Change Management

- Notify #platform-changes channel before deployment
- Schedule changes during low-traffic windows
- Have rollback plan documented

Lane guidance templates are selected by laneParent conditions and automatically included when the template id starts with lane-guidance-.

Add security requirements:

---
id: security-requirements
name: Security Requirements
required: true
order: 180
---

## Security Requirements

### Input Validation

- Validate all user input at boundaries
- Use allowlists, not blocklists
- Sanitize before storing or displaying

### Authentication

- Never store plaintext passwords
- Use secure session tokens
- Implement rate limiting on auth endpoints

### Data Handling

- Encrypt PII at rest and in transit
- Audit log access to sensitive data
- Apply principle of least privilege

### Secrets

- Never commit secrets to git
- Use environment variables or secret managers
- Rotate credentials regularly

Customize documentation-specific guidance:

---
id: docs-standards
name: Documentation Standards
required: false
order: 15
condition: "type === 'documentation' || type === 'docs'"
---

## Documentation Standards

### Format Requirements

- Use sentence case for headings
- Include code examples for all features
- Add links to related documentation
- Use admonitions for warnings/tips

### Content Structure

1. Start with "What" (definition/purpose)
2. Then "Why" (benefits/use cases)
3. Then "How" (step-by-step instructions)
4. End with "Next Steps" (related topics)

### Review Checklist

- [ ] Spelling and grammar checked
- [ ] Code examples tested
- [ ] Links verified
- [ ] Screenshots current

Use tokens to include WU-specific information:

TokenUsage
{WU_ID}Reference the current WU
{LANE}Show lane context
{TYPE}Conditional text based on type
{WORKTREE_PATH}Include worktree navigation
{TITLE}Show WU title in headings
{DESCRIPTION}Include full WU description
{WORK_DOMAIN}Render the classified work domain
{WORK_TEST_METHODOLOGY_HINT}Render the classifier-driven methodology hint
{REQUIRED_VERIFICATION}Render required verification from the WU spec

These context variables are especially useful for lane-aware and domain-aware composition:

VariableMeaning
work.domainClassified domain such as ui, backend, or docs
work.testMethodologyHintClassifier hint such as smoke-test or structured-content
hasRequiredVerificationTruthy when the WU spec declares any required verification
tests.hasUnitTruthy when the WU spec declares unit test paths
tests.hasE2ETruthy when the WU spec declares E2E test paths
tests.hasManualTruthy when the WU spec declares manual verification items

Base variables such as type, lane, laneParent, policy.testing, and policy.architecture remain available as well.

Example with tokens:

---
id: wu-context
name: WU Context
required: true
order: 5
tokens: [WU_ID, LANE, TITLE]
---

# {TITLE}

**WU:** {WU_ID}
**Lane:** {LANE}

Follow the acceptance criteria defined in the WU specification.
pnpm validate
# Full output
pnpm wu:brief --id WU-XXX --client <client>

# Check specific section
pnpm wu:brief --id WU-XXX --client <client> | grep -A 10 "My Custom"
# Show which templates were included
pnpm wu:brief --id WU-XXX --client <client>

Template not appearing:

  1. Check id matches in both template and manifest
  2. Verify condition evaluates to true for this WU
  3. Check path is correct (relative to templates/)
  4. Ensure file has valid frontmatter

Client override not applied:

  1. Verify directory name: templates.{alias}/ (see Client Alias Mapping)
  2. Check override has same id as base template
  3. Confirm using correct --client flag

Token not replaced:

  1. Use uppercase: {WU_ID} not {wu_id}
  2. Check token is available in context
  3. Verify template is loaded (check --verbose)
  • Focus each template - One concept per template
  • Use conditions - Don’t include irrelevant content
  • Document intent - Add comments in markdown
  • Test thoroughly - Verify with --dry-run
  • Override sparingly - Most templates work across clients
  • Match IDs exactly - Override uses same id as base
  • Keep in sync - Update both when content changes
  • Version templates - Commit template changes with WUs
  • Review regularly - Update templates as practices evolve
  • Track effectiveness - Remove templates agents ignore