Rebuilds a design doc from its ADRs after they were added, changed or superseded, then rewrites it on sign-off. Use when the user says "sync the design doc", "the ADRs changed" or "update the design from its ADRs". Not for one decision (use govern).
3 stars
0 votes
0 copies
1 view
Added November 29, 2026
ai-agentsgobashgit
Security analysis
B75/100
criticalSends environment variables or credentials to an external URL
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Gov Design Sync?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/doctormozg-gov-design-sync)
---
name: gov-design-sync
description: 'Rebuilds a design doc from its ADRs after they were added, changed or superseded, then rewrites it on sign-off. Use when the user says "sync the design doc", "the ADRs changed" or "update the design from its ADRs". Not for one decision (use govern).'
argument-hint: <docs/design/NNNN-slug.md>
allowed-tools: Agent(gov-provenance-recorder), Agent(gov-design-composer), Agent(gov-coverage-auditor), Agent(gov-coverage-prober), Agent(gov-coverage-answerer), Agent(gov-critic-consistency), Agent(gov-artifact-writer), AskUserQuestion, Read, Write, Edit, Bash(${CLAUDE_PLUGIN_ROOT}/scripts/gov-program.sh *), Bash(git rev-parse *), Bash(mkdir *), Bash(date *), Bash(printf *), Bash(diff *), Glob, Grep
---
# Gov Design Sync: Rebuild a Design Doc from Its ADRs
## Overview
A design doc built by `gov-program` is a view of its ADRs: every decision it states cites an ADR, and its `## Decision index` lists each one with a body hash. ADRs change after that. They get superseded, new ones join with `Part of:` the doc, and an accepted ADR is sometimes amended. This skill finds what moved with `gov-program.sh check`, has `gov-design-composer` rewrite only the sections those ADRs touch, runs the full coverage check on the result, and after a human signs off rewrites the doc in place with a revision line and fresh provenance. It never edits a decision: a gap that needs an ADR to say more stops the run and points at `/govern`.
## When to Use
- An ADR in a design doc's index was superseded, rejected or deprecated.
- A new ADR says `Part of:` a design doc that doesn't list it yet.
- An indexed ADR's text changed since the doc was composed.
- The user wants to know whether a design doc still matches its decisions; a clean check ends the run with that answer.
### When NOT to use
- One new decision to make and record: use `govern`, then come back here.
- A whole architecture to decompose into ADRs and a design doc: use `gov-program`.
- Auditing records for quality without rebuilding anything: use `gov-review`.
- A hand-written design doc with no decision index. The check reports it as broken; there is nothing to sync until it has one.
## Input
- `$ARGUMENTS`: the design doc path, such as `docs/design/0001-reply-service.md`. Without one, Glob `docs/design/*.md` for files with the decision index header. One match: use it. Several: ask which with AskUserQuestion. None: report that no design doc has a decision index and stop.
## Constants
- **PROJECT_ROOT**: resolved once in setup with `echo "${MZ_MEMORY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"`; expand `<PROJECT_ROOT>` to it in every command and agent prompt.
- **TASK_DIR**: `<PROJECT_ROOT>/.mz/task/<task_name>/` | **DESIGN_DIR**: `docs/design/` | **DECISIONS_DIR**: `docs/decisions/`
- **MAX_COVERAGE_ITERATIONS**: 6 rounds of doc fixes before the gaps escalate.
- **MAX_PROBE_QUESTIONS**: 40 across both probe directions, enough for every decision's what and why on a doc of about 15 ADRs.
- **SCRIPT**: `${CLAUDE_PLUGIN_ROOT}/scripts/gov-program.sh`. **SKILL_DIR**: `${CLAUDE_SKILL_DIR}`. **PLUGIN_ROOT**: `${CLAUDE_PLUGIN_ROOT}`. Phase and reference files write `<SCRIPT>`, `<SKILL_DIR>/...` and `<PLUGIN_ROOT>/...` because files opened with Read get no variable substitution; expand them to these absolute paths before running a command or passing a path to an agent.
## Core Process
### Phase Overview
| Phase | Goal | Details | Loop? |
| ----- | ---------------------------------------------- | -------------------------------------------------- | --------------- |
| 0 | Setup | inline below | — |
| 1 | Check: what changed since the doc was composed | `phases/check.md` | — |
| 2 | Regenerate the touched sections | `phases/check.md` | — |
| 3 | Coverage: claims, blind probe, consistency | `${CLAUDE_SKILL_DIR}/references/coverage-check.md` | max 6 doc fixes |
| 4 | Sign-off gate | `phases/signoff.md` | feedback loop |
| 5 | Record: rewrite in place, stamp, verify | `phases/signoff.md` | — |
### Phase 0: Setup (inline)
1. Resolve `PROJECT_ROOT` with the command in Constants, before any `cd`, and use it for every `.mz/` path.
1. Resolve the design doc from `$ARGUMENTS` as Input describes. A path outside `docs/design/` or a file that doesn't exist → say so and stop.
1. Derive `task_name` = `<YYYY_MM_DD>_gov-design-sync_<slug>`, where `<slug>` is the doc's file name without its number, in snake_case, at most 20 characters. On a same-day collision append `_v2`, `_v3`.
1. **Resume check**: read `<TASK_DIR>/state.md` if it exists. `complete` or `aborted_by_user` → suffix `_v2` and start fresh. `pending`, `running`, `blocked` or `failed` → ask with AskUserQuestion: **Resume** re-enters at the recorded `Phase`, **Restart** archives the dir to `<task_name>_archived_<YYYY_MM_DD_HHMMSS>/`, **New** suffixes `_v2`. The sign-off gate never auto-resumes; re-present it. Unattended → report the path, `Status` and `what_remains`, and stop.
1. Create `TASK_DIR` and write `state.md`: `schema_version: 2`, `Status: running`, `Phase: 0`, `PhaseName: setup`, `Started: <ISO>`, `Iteration: 0`, `FilesWritten: []`, `phase_complete: false`, `what_remains: []`, `DesignDoc: <path>`.
1. Dispatch `gov-provenance-recorder` to write `<TASK_DIR>/provenance.md` for this run: the authoring agent `gov-artifact-writer`, the exact model id, the ISO timestamp and the trigger (`user-prompt` for a direct call, `automation` when `govern` or a policy recommended it). It starts at `human_signoff: pending`.
1. Emit a setup block: task name, design doc, provenance path. Then read `phases/check.md`.
### Phases 1 and 2: Check and regenerate
Run `<SCRIPT> check` on the doc. No findings → report that the doc matches its ADRs, mark `complete` and stop. Findings that a rebuild can't fix (a missing ADR file, an unresolved link token) → stop as `blocked` with the fix. Otherwise write `changes.md`, then dispatch `gov-design-composer` in regenerate mode into `<TASK_DIR>/design_draft.md`. See `phases/check.md`.
### Phase 3: Coverage
Run the coverage check in `${CLAUDE_SKILL_DIR}/references/coverage-check.md` on the whole draft, not just the changed sections: the claim audit and its quote check, the blind probe in both directions, and the consistency critic when an ADR was added or replaced. Doc-side findings go back to the composer, up to **MAX_COVERAGE_ITERATIONS**. A finding that needs an ADR to change is a gap: the run stops before sign-off as `blocked` and recommends `/govern` for each gap.
### Phases 4 and 5: Sign-off and record
The two-surface gate: the change list, the coverage summary, the diff and then the full new doc, with Approve and Reject. There is no auto-approve. On approve, `gov-artifact-writer` rewrites the doc in place, then `<SCRIPT> stamp` and `<SCRIPT> check` must come back clean. See `phases/signoff.md`.
## Red Flags
- You edited an ADR's decision, context or consequences. ADRs are the source of truth; a gap that needs one to change goes to `/govern`.
- You presented the gate with gaps still open, or showed only the diff without the full doc.
- You rewrote sections no changed ADR touches, or wrote `docs/` before an explicit Approve.
- You took a quote from the auditor or answerer as found without running `<SCRIPT> quotes` on its TSV.
## Verification
The final block lists the doc path, the changes applied, the coverage counts, the sign-off and the output of the closing `<SCRIPT> check`, which reads `ok:`. `state.md` is `complete` with `what_remains: []`.
## References
- `${CLAUDE_SKILL_DIR}/references/coverage-check.md`: the coverage engine shared with `gov-program`: waves, dispatch prompts, the quote check, the gate rule and how findings split into doc fixes and gaps. Read it in full at the start of Phase 3.
- `${CLAUDE_PLUGIN_ROOT}/skills/govern/references/design-doc-template.md`: the design doc template, with the rules for a doc built from ADRs. The composer reads it in Phase 2.
## Error Handling
- The doc has no decision index, or `check` exits 1 or 2 → report the script's message and stop; never guess at an index.
- An agent returns `NEEDS_CONTEXT` → supply what it names and dispatch once more. `BLOCKED`, or no valid `STATUS:` line → retry once, then escalate with AskUserQuestion; unattended, stop as `blocked`.
- Coverage still fails after **MAX_COVERAGE_ITERATIONS** → `blocked`, with every remaining finding and its suggested fix in the report.
- The closing `check` reports findings after the rewrite → `failed`; show the findings, since the doc on disk now needs a hand fix or a new sync.
## State Management
State persists to `.mz/task/<task_name>/state.md` under the project root, `${MZ_MEMORY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}`, resolved once at the start of the run. Schema is **v2**: line 1 is `schema_version: 2`; line 2 is `Status:` with one of `pending`, `running`, `blocked`, `complete`, `aborted_by_user` or `failed`, lowercase and unquoted; then `Phase`, `Started`, `phase_complete` (boolean) and `what_remains` (YAML list of strings), with skill-specific keys below them. Milestones go in `Phase`; the reason for `blocked` or `failed` goes in `what_remains`. Set `phase_complete: false` on phase entry and `true` once the phase's artifacts are written and its gates pass. Refresh `what_remains` on every phase transition; it is `[]` when `Status` is `complete`. Write the file after every phase and before every gate, and re-read it after compaction. Record decisions worth recalling under a heading that reads exactly `## Decisions`, placed before `## Notes`; mz-memory harvests them only once `Status` is `complete`. Under a heading that reads exactly `## Lessons`, add one line whenever a review finding is accepted and fixed, a step fails, gate feedback corrects a mistake, or an approved approach is reversed, in the form `- (review|failure|correction|change) WHEN <situation> → <what to do> — WHY <cause>`, concrete and under about 40 words; mz-memory harvests lessons whatever the `Status`. Treat a legacy `completed` as `complete`. On reading a `schema_version: 1` or unversioned file, put `schema_version: 2` on line 1 and `Status` on line 2, add the missing keys, and log the upgrade. Leave a file with a higher `schema_version` untouched: ask whether to Restart (archive it), start New (`_v2`) or Abort, and stop if nobody can answer.
Append every file the run writes to `FilesWritten`: provenance.md, changes.md, design_draft.md, the coverage and probe files, and the rewritten doc. Record `human_signoff` only after the gate.