Backend Document Workflow
Purpose
- Execute document-centered backend commands directly in Claude.
- Cover
/design, /plan, /update-doc, and /reverse-engineer equivalent flows.
Execution Contract
This skill follows the non-entry execution contract standard.
Required contract_extensions: mode, target_docs.
See codex-execution-contract.md and non-entry-execution-contract-template.md for full rules.
input:
objective: "Generate backend design documents"
contract_extensions: { mode: "design", target_docs: ["docs/design/backend-module-a.md", "docs/design/backend-module-b.md"] }
output:
status: "completed"
quality_gate:
gate_id: "backend-document-review"
gate_type: "document"
trigger: "post-document review"
criteria:
- "Target documents are complete"
- "Document content is consistent across outputs"
result: "pass"
evidence:
- "Docs reviewed and consistent"
blockers: []
branching:
on_pass: "handoff"
on_fail: "revise"
max_cycles: 2
contract_extensions: { mode: "design", target_docs: ["docs/design/backend-module-a.md", "docs/design/backend-module-b.md"] }
Contract Compliance
- Emit structured output compliant with
codex-execution-contract.md.
- Always include baseline output fields:
status, summary, changed_files, tests, quality_gate, blockers, next_actions.
- Validate required input fields from
../workflow-entry/references/non-entry-execution-contract-template.md (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.
- Echo required skill extensions in
contract_extensions: mode, target_docs.
- Treat missing required fields as contract violations and regenerate output before handoff.
- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.
- Reference:
non-entry-execution-contract-template.md.
Modes
design: Requirement -> Design Doc/ADR -> review -> consistency -> [Stop: pre-design-approval] + [Approve: design-approval].
plan: Design Doc -> test planning -> Work Plan -> [Stop: pre-design-approval] + [Approve: design-approval].
update: Target doc selection -> change clarification -> update -> review -> [Stop: pre-design-approval] + [Approve: design-approval].
reverse: Codebase discovery -> PRD -> Design Docs -> verification/review loop.
Design Mode
- Clarify problem, expected outcomes, constraints.
- Determine scale and ADR requirement.
- Produce Design Doc (and ADR when needed).
- Run document quality review.
- Run consistency review against related docs.
- Emit
[Stop: pre-design-approval] + [Approve: design-approval].
Plan Mode
- Select approved Design Doc.
- Define integration/E2E test strategy.
- Produce Work Plan and atomic task strategy.
- Emit
[Stop: pre-design-approval] + [Approve: design-approval].
Update Mode
- Identify target document and type (PRD/ADR/Design Doc).
- Clarify requested changes and reason.
- Apply update with minimal coherent edits.
- Run review and consistency check (for Design Docs).
- Emit
[Stop: pre-design-approval] + [Approve: design-approval].
Reverse Mode
- Confirm target path, depth, architecture style, review policy.
- Discover PRD units from existing code.
- Generate PRD per unit.
- Verify PRD against code and revise up to two iterations.
- Discover design components from approved PRD scope.
- Generate Design Doc per component.
- Verify and review with up to two revisions.
- Summarize generated docs, discrepancies, and follow-up items.
Hard Rules
- Do not skip review before approval.
- Do not auto-approve docs with critical inconsistencies.
- Limit revision loops to prevent unbounded churn, then escalate.
Quality Gate Evidence
- This executor owns
quality_gate emission and branching using quality-gate-evidence-template.md.
- Emit canonical fields:
gate_id, gate_type, trigger, criteria, result, evidence, blockers, branching.
- Use
gate_type: document for backend document quality and completeness checks.
- Normalize local statuses into
result: pass|fail|blocked before handoff.
- If
result: blocked, emit [Stop: quality-gate-failed] and pause for escalation handling.
Stop/Approval Protocol
Use canonical markers: [Stop: <Gate Name>].
Classify every stop as approval_gate or escalation_gate.
At each stop, emit a full gate record: gate_name, gate_type, trigger, ask_method, required_user_action, resume_if, fallback_if_rejected.
Default ask_method is AskUserQuestion.
Resume an approval_gate only with explicit user approved: true; resume an escalation_gate only after user direction or reroute.
Respect batch boundary: document phases are human-gated, and transitions into implementation require [Stop: pre-implementation-approval].
Enforce max_revision_cycles: 2; overflow requires human intervention.
Agent-local document review approvals never replace user approvals.
Stop points for this skill:
[Stop: pre-design-approval] (approval_gate)
[Stop: pre-implementation-approval] (approval_gate)
[Stop: high-risk-change] (approval_gate)
[Stop: requirement-change-detected] (escalation_gate)
[Stop: quality-gate-failed] (escalation_gate)
[Stop: revision-limit-reached] (escalation_gate)
Full protocol and payload schema: ../workflow-entry/references/stop-approval-section-template.md.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: backend-document-workflow3description: Document workflow for backend design/plan/reverse-engineer/update-doc commands in Claude without subagent dependency. Use when this capability is needed.4---56# Backend Document Workflow78## Purpose910- Execute document-centered backend commands directly in Claude.11- Cover `/design`, `/plan`, `/update-doc`, and `/reverse-engineer` equivalent flows.1213## Execution Contract1415This skill follows the non-entry execution contract standard.16Required `contract_extensions`: `mode`, `target_docs`.17See [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md) and [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md) for full rules.1819```yaml20input:21 objective: "Generate backend design documents"22 contract_extensions: { mode: "design", target_docs: ["docs/design/backend-module-a.md", "docs/design/backend-module-b.md"] }23output:24 status: "completed"25 quality_gate:26 gate_id: "backend-document-review"27 gate_type: "document"28 trigger: "post-document review"29 criteria:30 - "Target documents are complete"31 - "Document content is consistent across outputs"32 result: "pass"33 evidence:34 - "Docs reviewed and consistent"35 blockers: []36 branching:37 on_pass: "handoff"38 on_fail: "revise"39 max_cycles: 240 contract_extensions: { mode: "design", target_docs: ["docs/design/backend-module-a.md", "docs/design/backend-module-b.md"] }41```4243## Contract Compliance4445- Emit structured output compliant with [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md).46- Always include baseline output fields: `status`, `summary`, `changed_files`, `tests`, `quality_gate`, `blockers`, `next_actions`.47- Validate required input fields from `../workflow-entry/references/non-entry-execution-contract-template.md` (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.48- Echo required skill extensions in `contract_extensions`: `mode`, `target_docs`.49- Treat missing required fields as contract violations and regenerate output before handoff.50- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.51- Reference: [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md).5253## Modes5455- `design`: Requirement -> Design Doc/ADR -> review -> consistency -> `[Stop: pre-design-approval]` + `[Approve: design-approval]`.56- `plan`: Design Doc -> test planning -> Work Plan -> `[Stop: pre-design-approval]` + `[Approve: design-approval]`.57- `update`: Target doc selection -> change clarification -> update -> review -> `[Stop: pre-design-approval]` + `[Approve: design-approval]`.58- `reverse`: Codebase discovery -> PRD -> Design Docs -> verification/review loop.5960## Design Mode61621. Clarify problem, expected outcomes, constraints.632. Determine scale and ADR requirement.643. Produce Design Doc (and ADR when needed).654. Run document quality review.665. Run consistency review against related docs.676. Emit `[Stop: pre-design-approval]` + `[Approve: design-approval]`.6869## Plan Mode70711. Select approved Design Doc.722. Define integration/E2E test strategy.733. Produce Work Plan and atomic task strategy.744. Emit `[Stop: pre-design-approval]` + `[Approve: design-approval]`.7576## Update Mode77781. Identify target document and type (PRD/ADR/Design Doc).792. Clarify requested changes and reason.803. Apply update with minimal coherent edits.814. Run review and consistency check (for Design Docs).825. Emit `[Stop: pre-design-approval]` + `[Approve: design-approval]`.8384## Reverse Mode85861. Confirm target path, depth, architecture style, review policy.872. Discover PRD units from existing code.883. Generate PRD per unit.894. Verify PRD against code and revise up to two iterations.905. Discover design components from approved PRD scope.916. Generate Design Doc per component.927. Verify and review with up to two revisions.938. Summarize generated docs, discrepancies, and follow-up items.9495## Hard Rules9697- Do not skip review before approval.98- Do not auto-approve docs with critical inconsistencies.99- Limit revision loops to prevent unbounded churn, then escalate.100101## Quality Gate Evidence102103- This executor owns `quality_gate` emission and branching using [`quality-gate-evidence-template.md`](../workflow-entry/references/quality-gate-evidence-template.md).104- Emit canonical fields: `gate_id`, `gate_type`, `trigger`, `criteria`, `result`, `evidence`, `blockers`, `branching`.105- Use `gate_type: document` for backend document quality and completeness checks.106- Normalize local statuses into `result: pass|fail|blocked` before handoff.107- If `result: blocked`, emit `[Stop: quality-gate-failed]` and pause for escalation handling.108109## Stop/Approval Protocol110111Use canonical markers: `[Stop: <Gate Name>]`.112Classify every stop as `approval_gate` or `escalation_gate`.113At each stop, emit a full gate record: `gate_name`, `gate_type`, `trigger`, `ask_method`, `required_user_action`, `resume_if`, `fallback_if_rejected`.114Default `ask_method` is `AskUserQuestion`.115Resume an `approval_gate` only with explicit user `approved: true`; resume an `escalation_gate` only after user direction or reroute.116Respect batch boundary: document phases are human-gated, and transitions into implementation require `[Stop: pre-implementation-approval]`.117Enforce `max_revision_cycles: 2`; overflow requires human intervention.118Agent-local document review approvals never replace user approvals.119120Stop points for this skill:121- `[Stop: pre-design-approval]` (`approval_gate`)122- `[Stop: pre-implementation-approval]` (`approval_gate`)123- `[Stop: high-risk-change]` (`approval_gate`)124- `[Stop: requirement-change-detected]` (`escalation_gate`)125- `[Stop: quality-gate-failed]` (`escalation_gate`)126- `[Stop: revision-limit-reached]` (`escalation_gate`)127128Full protocol and payload schema: [`../workflow-entry/references/stop-approval-section-template.md`](../workflow-entry/references/stop-approval-section-template.md).129130---131> Converted and distributed by [TomeVault](https://tomevault.io/claim/ssaattww) — claim your Tome and manage your conversions.132<!-- tomevault:4.0:skill_md:2026-04-14 -->