---
description: Create custom steering documents for specialized project contexts
allowed-tools: Bash, Read, Write, Edit, MultiEdit, Glob, Grep, LS
---

# SDD Custom Steering Creation

<background_information>
**Role**: Extend the core steering set with domain-specific memory files that address specialized project concerns not covered by `product.md`, `tech.md`, or `structure.md`.

**Mission**: Help the user create a focused, high-value steering document for a specific domain area.

**Success Criteria**:
- The custom file captures specialized patterns in the same granular, principle-oriented style as core steering
- Content is grounded in actual codebase evidence (for project patterns) or written verbatim from the template (for integrations)
- The resulting file provides immediate, durable value to every future SDD command that reads steering
</background_information>

<instructions>
## Workflow

1. **Present all available templates in a single question** — ask the user which custom steering document to create. Show both groups (Project Patterns and Integrations) together. Do not split this into multiple prompts or ask for a domain/topic separately.

2. **Locate the template**:
   - Look for `{{SDD_DIR}}/settings/templates/steering-custom/{name}.md`
   - If found, load it as the starting point for the new steering file
   - **Integration templates** (e.g., `jira.md`, `azure-devops.md`): extract and display the embedded setup guide from the HTML comment block in chat, then write the file content verbatim — no codebase analysis is needed for these

3. **Analyze the codebase** (skip for integration templates):
   - **Glob** for files related to the domain
   - **Read** key implementations to understand actual patterns in use
   - **Grep** for specific conventions, error patterns, naming styles

4. **Author the custom steering file**:
   - Follow the template structure where one exists; otherwise write from domain knowledge
   - Apply all principles from `{{SDD_DIR}}/settings/rules/steering-principles.md`
   - Document patterns, not exhaustive lists
   - Target 100–200 lines (a 2–3 minute read)

5. **Write the file** to `{{SDD_DIR}}/steering/{name}.md`

## Available Templates

Templates are located in `{{SDD_DIR}}/settings/templates/steering-custom/`:

**Project Patterns** — customized from live codebase analysis:
1. **api-standards.md** — REST/GraphQL endpoint conventions, request/response formats, error shapes
2. **testing.md** — Test organization, fixture strategies, mocking approaches, coverage targets
3. **security.md** — Authentication/authorization patterns, input validation, secrets management
4. **database.md** — Schema design conventions, migration approach, query patterns, indexing strategy
5. **error-handling.md** — Error taxonomy, logging format, retry and circuit-breaker patterns
6. **authentication.md** — Auth flows, session management, permission models, token lifecycle
7. **deployment.md** — CI/CD pipeline structure, environment configuration, rollback procedures
8. **cross-repo.md** — Contract ownership, inter-repo communication protocols, dependency boundaries *(multi-repo products only — discovers and writes to all relevant platform repos; produces persistent AI context, not specs)*

**Integrations** — written verbatim after displaying the embedded setup guide in chat:
9. **jira.md** — Jira Cloud sync: auto-creates Epics, Stories, and Subtasks at each SDD phase transition
10. **azure-devops.md** — Azure DevOps Boards sync: auto-creates Epics, User Stories, and Tasks at each SDD phase transition

Load each template only when the user selects that type; customize for project context (or write verbatim for integrations).

## Steering Principles

Sourced from `{{SDD_DIR}}/settings/rules/steering-principles.md`:

- **Patterns over inventories**: Describe how the codebase is organized, not what every file contains
- **One domain per file**: Keep each steering document tightly scoped to a single topic
- **Concrete examples**: Illustrate patterns with representative code snippets
- **Appropriate size**: 100–200 lines is the target; beyond 300 lines usually signals scope creep
- **Security always**: Never include credentials, tokens, database URLs, or internal network addresses
</instructions>

## Tool Guidance

- **Read**: Load the template; read representative implementations to extract real patterns
- **Glob**: Find all files relevant to the domain before analysis
- **Grep**: Surface naming conventions, error patterns, import styles
- **LS**: Understand directory structure without reading every file upfront

**Just-In-Time Strategy**: Load only what you need to characterize the domain accurately.

## Output Description

Chat summary with the file path (file is written directly):

```
Custom Steering Created

File:
- {{SDD_DIR}}/steering/api-standards.md

Based On:
- Template: api-standards.md
- Analyzed: src/api/ and src/routes/ directories
- Extracted: REST naming conventions, error envelope format, pagination pattern

Content Covers:
- Endpoint naming and versioning rules
- Request/response structure and validation
- Standard error response format
- Authentication header expectations

Review the file and adjust any patterns that don't match your project conventions.
```

## Examples

### API Standards
**Input**: User selects "api-standards.md"
**Action**: Load template → Grep and Read src/api/ → Extract REST patterns
**Output**: `api-standards.md` with project-specific endpoint naming, error format, and auth conventions

### Azure DevOps Integration
**Input**: User selects "azure-devops.md"
**Action**: Display embedded setup guide in chat → Write template file verbatim
**Output**: `azure-devops.md` ready for configuration with user's PAT and org details

## Safety & Fallback

- **No matching template**: Generate the file from scratch using domain knowledge and steering principles
- **Security**: Run through the security checklist from `steering-principles.md` before writing — never commit secrets
- **Overlap with core steering**: Ensure the custom file does not duplicate content already in `product.md`, `tech.md`, or `structure.md`

## Notes

- Custom steering files carry equal weight as core files — every SDD command loads all `{{SDD_DIR}}/steering/*.md`
- Templates are starting points; always adapt content to match actual project patterns
- Follow the same granularity standards as core steering throughout
- Do not document agent-specific tooling directories (e.g., `.cursor/`, `.gemini/`, `.claude/`)
- Light references to `{{SDD_DIR}}/specs/` and `{{SDD_DIR}}/steering/` are acceptable; avoid other `.sdd/` paths
