Documentation-Code Sync
Detect and resolve drift between code and documentation without front-loading a
full repository audit. Treat standard Sonnet context as the baseline.
Invocation
/doc-sync <direction> [options]
Directions:
code-to-docs: code is source of truth
docs-to-code: docs are source of truth
full: bidirectional reconciliation; conflicts require human review
Options:
--scope "path": limit the run to a subtree or file group
--incremental: inspect changed files first
--dry-run: report only
--parallel N: cap concurrent auditors; default 2, maximum 4
--guidance "text": use operator guidance for ambiguous cases
--no-commit: do not commit
Artifact root resolution
Treat every .aiwg/... path below as a logical artifact path. Before reading
or writing sync state, working evidence, or reports, run aiwg artifacts path
from the active workspace and use the returned absolute directory as
AIWG_ARTIFACT_ROOT. Never write these payloads to a literal project-local
.aiwg/ when AIWG_ARTIFACTS_PATH or .aiwg-location redirects the corpus.
Context Budget Rules
- Start with
git status --short and git diff --name-only; do not read broad
diffs before the changed-file set is known.
- If neither
--scope nor --incremental is supplied, derive a candidate scope
from changed files and ask before expanding to full repo.
- Prefer shell inventories (
find, rg --files, git diff --name-only) over
reading file bodies.
- Dispatch subagents only after scope is known. Use at most
min(--parallel, 4)
auditors, and prefer 2 for broad or release requests.
- Each auditor must return at most 10 findings and 600 words. It should write
detailed evidence to
$AIWG_ARTIFACT_ROOT/working/doc-sync/ and return only the path plus a
summary.
- Do not preload other skills into subagents. If another capability is needed,
invoke it after this skill finishes or in an isolated follow-up.
Workflow
- Parse direction and options.
- Build a cheap scope inventory:
git status --short
git diff --name-only
git diff --cached --name-only
rg --files docs README.md CHANGELOG.md package.json src agentic tools
only when the changed-file set is insufficient.
- Choose audit lanes from the scoped files:
- CLI/API docs
- provider/deployment docs
- skill/agent catalogs
- README, changelog, release, or blog material
- config/schema docs
- Run bounded auditors for only the selected lanes. Each prompt must include:
- exact paths to inspect
- direction
- max 10 findings
- max 600-word return summary
- instruction to store detailed notes under
$AIWG_ARTIFACT_ROOT/working/doc-sync/
- Merge summaries into
$AIWG_ARTIFACT_ROOT/reports/doc-sync-audit-{date}.md with:
- scope
- findings by severity
- auto-fixable vs human-required items
- files changed or proposed changes
- If not
--dry-run, apply high-confidence fixes only.
- Validate modified files with targeted checks:
- markdown link/anchor checks where available
npm run lint:claude-context if Claude-facing skills or agents changed
- project-specific build/test checks only when source changed
- Record
$AIWG_ARTIFACT_ROOT/.last-doc-sync.
- Commit only when requested by the surrounding workflow and not blocked by
--no-commit; otherwise leave a concise final summary.
Release or Blog Coverage Requests
For combined requests such as "docSync code2doc, ensure the monthly blog covers
the work, then commit-and-push":
- Keep this skill to documentation drift detection and fixes.
- Treat blog/release coverage as one selected audit lane with changed files plus
month-bounded git history, not a full repository read.
- Return a handoff summary for
commit-and-push instead of invoking it inside
this skill.
Output Contract
Return:
- audit report path
- files changed
- remaining human-review items
- validation commands run
- next recommended skill, if any
1---2namespace: aiwg3name: doc-sync4platforms: [all]5description: Synchronize documentation and code with bounded, scope-first drift checks6commandHint:7 argumentHint: <direction> [--scope "path" --dry-run --parallel N --incremental --guidance "text" --no-commit]8 allowedTools: Task, Read, Write, Bash, Glob, Grep, Edit9 model: haiku10 category: documentation11 modelRole: efficiency12 modelTier: economy13---1415# Documentation-Code Sync1617Detect and resolve drift between code and documentation without front-loading a18full repository audit. Treat standard Sonnet context as the baseline.1920## Invocation2122`/doc-sync <direction> [options]`2324Directions:25- `code-to-docs`: code is source of truth26- `docs-to-code`: docs are source of truth27- `full`: bidirectional reconciliation; conflicts require human review2829Options:30- `--scope "path"`: limit the run to a subtree or file group31- `--incremental`: inspect changed files first32- `--dry-run`: report only33- `--parallel N`: cap concurrent auditors; default `2`, maximum `4`34- `--guidance "text"`: use operator guidance for ambiguous cases35- `--no-commit`: do not commit3637## Artifact root resolution3839Treat every `.aiwg/...` path below as a logical artifact path. Before reading40or writing sync state, working evidence, or reports, run `aiwg artifacts path`41from the active workspace and use the returned absolute directory as42`AIWG_ARTIFACT_ROOT`. Never write these payloads to a literal project-local43`.aiwg/` when `AIWG_ARTIFACTS_PATH` or `.aiwg-location` redirects the corpus.4445## Context Budget Rules4647- Start with `git status --short` and `git diff --name-only`; do not read broad48 diffs before the changed-file set is known.49- If neither `--scope` nor `--incremental` is supplied, derive a candidate scope50 from changed files and ask before expanding to full repo.51- Prefer shell inventories (`find`, `rg --files`, `git diff --name-only`) over52 reading file bodies.53- Dispatch subagents only after scope is known. Use at most `min(--parallel, 4)`54 auditors, and prefer `2` for broad or release requests.55- Each auditor must return at most 10 findings and 600 words. It should write56 detailed evidence to `$AIWG_ARTIFACT_ROOT/working/doc-sync/` and return only the path plus a57 summary.58- Do not preload other skills into subagents. If another capability is needed,59 invoke it after this skill finishes or in an isolated follow-up.6061## Workflow62631. Parse direction and options.642. Build a cheap scope inventory:65 - `git status --short`66 - `git diff --name-only`67 - `git diff --cached --name-only`68 - `rg --files docs README.md CHANGELOG.md package.json src agentic tools`69 only when the changed-file set is insufficient.703. Choose audit lanes from the scoped files:71 - CLI/API docs72 - provider/deployment docs73 - skill/agent catalogs74 - README, changelog, release, or blog material75 - config/schema docs764. Run bounded auditors for only the selected lanes. Each prompt must include:77 - exact paths to inspect78 - direction79 - max 10 findings80 - max 600-word return summary81 - instruction to store detailed notes under `$AIWG_ARTIFACT_ROOT/working/doc-sync/`825. Merge summaries into `$AIWG_ARTIFACT_ROOT/reports/doc-sync-audit-{date}.md` with:83 - scope84 - findings by severity85 - auto-fixable vs human-required items86 - files changed or proposed changes876. If not `--dry-run`, apply high-confidence fixes only.887. Validate modified files with targeted checks:89 - markdown link/anchor checks where available90 - `npm run lint:claude-context` if Claude-facing skills or agents changed91 - project-specific build/test checks only when source changed928. Record `$AIWG_ARTIFACT_ROOT/.last-doc-sync`.939. Commit only when requested by the surrounding workflow and not blocked by94 `--no-commit`; otherwise leave a concise final summary.9596## Release or Blog Coverage Requests9798For combined requests such as "docSync code2doc, ensure the monthly blog covers99the work, then commit-and-push":1001011. Keep this skill to documentation drift detection and fixes.1022. Treat blog/release coverage as one selected audit lane with changed files plus103 month-bounded git history, not a full repository read.1043. Return a handoff summary for `commit-and-push` instead of invoking it inside105 this skill.106107## Output Contract108109Return:110- audit report path111- files changed112- remaining human-review items113- validation commands run114- next recommended skill, if any