# Playbooks / recipes (`shrk playbooks ...`) A **playbook** is a structured, reusable runbook — a named recipe that combines a preset, a pipeline, recommended templates, and a step-by-step list of commands / MCP tools / verification gates. Playbooks are **never** executed automatically; they are documents the agent or human reads before acting. ## Defining playbooks In `sharkcraft/playbooks.ts`: ```ts import { definePlaybook } from '@shrkcrft/plugin-api'; export default [ definePlaybook({ id: 'add-service', title: 'Add a new HTTP service', description: 'Generate a service skeleton, route, validation, tests.', tags: ['service', 'http', 'scaffold'], taskKinds: ['generate', 'feature'], recommendedTemplateIds: ['typescript.service', 'typescript.test'], recommendedPipelineIds: ['gen-feature-flow'], steps: [ { id: 'context', title: 'Load context', commands: ['shrk context --task ""'], }, { id: 'plan', title: 'Dry-run generate', commands: [ 'shrk gen typescript.service --dry-run --save-plan /tmp/plan.json', ], }, { id: 'apply', title: 'Apply (human approval)', humanReview: true, commands: ['shrk apply /tmp/plan.json --verify-signature'], verificationCommands: ['bun test', 'shrk check boundaries'], }, ], }), ]; ``` Packs contribute via `contributions.playbookFiles`. ## CLI ``` shrk playbooks list shrk playbooks get shrk playbooks recommend "" shrk playbooks runbook shrk playbooks brief shrk playbooks script # R12 shrk playbooks preview # R12 shrk playbooks validate # R12 ``` ## Script / preview / validate (R12) ```bash shrk playbooks script [--task ""] [--output ] [--json] shrk playbooks preview [--json] shrk playbooks validate [--json] ``` `script` renders a bash-like preview file (annotated, never executed). Human-review markers and verification commands stay as comments. `preview` returns the structured plan (steps, mcpTools, verification, safetyNotes). `validate` checks references against the registered templates / pipelines and flags duplicate or empty steps. MCP: `preview_playbook_script` returns `{ preview, script, validation }`. ## MCP (read-only) - `list_playbooks` - `get_playbook` - `recommend_playbooks` - `preview_playbook_script`