| name | doc-sync |
| description | Enforce docs โ code consistency before and after implementation. Launches doc-reviewer agent to cross-check domain documentation against actual codebase, detects drift, and ensures documentation updates accompany code changes. |
| license | MIT |
| compatibility | opencode |
| metadata | {"category":"development","complexity":"intermediate","audience":"developers","workflow":"feature-development"} |
SKILL: Doc Sync
Before and after any feature implementation, ensure docs/ domain documentation stays consistent with the codebase. This skill orchestrates the doc-reviewer agent for independent, thorough cross-validation.
What I do
- Identify which
docs/ files are relevant to the current task
- Launch
doc-reviewer agent for pre-implementation conflict detection
- After implementation, launch
doc-reviewer agent for post-implementation drift detection
- Apply docs updates when the reviewer identifies inconsistencies
- Maintain the single-source-of-truth chain:
docs/ = domain truth, AGENTS.md = coding truth
When to use me
Mandatory (always run)
- Before implementing a new feature (pre-check)
- After implementing a feature (post-check)
- When modifying an existing domain entity, rule, or API endpoint
- When adding a new entity type, business rule, or API endpoint
Conditional (run if)
- Bug fix that changes documented behavior (e.g., pruning threshold changed)
- Refactoring that changes public API surface or data flow
- Renaming that affects ubiquitous language terms
Skip (do not run)
- Pure test additions with no code behavior change
- Comment-only or formatting changes
- Dependency version updates
- CSS/style changes that don't affect component API
Domain โ Docs Mapping
Use this mapping to identify relevant docs for any given task:
Task involves โ Check these docs
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Likes (entity, repo, API) โ docs/likes.md
History (entity, repo, API) โ docs/history.md
Playlists (entity, repo, API) โ docs/playlists.md
Channels (entity, repo, API) โ docs/channels.md
Playback / Audio / Queue โ docs/playback.md
Search / Melon / Recommend โ docs/discovery.md
Auth / User / Session โ docs/auth.md
Any domain entity โ docs/ubiquitous-language.md
Cross-domain changes โ docs/README.md (relationships, data flow)
Layer/architecture changes โ docs/architecture.md
API endpoint changes โ AGENTS.md (API Specification table)
Workflow
Step 1: Identify Scope
Before launching the reviewer, determine what to check:
1. What domain(s) does this task touch?
2. Which docs files are relevant? (see mapping above)
3. What code files will change? (entities, rules, repos, routes, schemas)
4. What type of review? (pre-implementation or post-implementation)
Step 2: Launch doc-reviewer Agent
Launch a doc-reviewer Task agent with a specific prompt based on review type.
Pre-implementation Prompt Template
You are reviewing a planned feature before implementation.
## Feature Brief
[BRIEF DESCRIPTION OF WHAT WILL BE BUILT]
## Affected Domains
[LIST DOMAINS: e.g., likes, playlists, playback]
## Files that will change
[LIST EXPECTED CODE FILES]
## Your Task
1. Read the relevant docs files: [LIST DOCS FILES]
2. Read the current code that will be affected: [LIST CURRENT CODE FILES]
3. Check for conflicts between the planned feature and documented policies
4. Identify what docs updates will be needed after implementation
5. Return your review in the standard output format
Focus on: business rule conflicts, undocumented entity changes, API surface changes.
Post-implementation Prompt Template
You are reviewing completed code changes for docs consistency.
## What Changed
[DESCRIPTION OF WHAT WAS IMPLEMENTED]
## Changed Files
[LIST ALL MODIFIED/ADDED CODE FILES]
## Your Task
1. Read the relevant docs files: [LIST DOCS FILES]
2. Read the changed code files: [LIST CODE FILES]
3. Cross-check entity attributes, business rules, identifiers, API endpoints
4. Identify any drift between docs and the new code
5. Return your review in the standard output format with a specific Update Plan
Focus on: missing attributes, changed policies, new endpoints, terminology drift.
Full Audit Prompt Template
You are performing a full docs โ code consistency audit.
## Scope
[LIST DOMAINS TO AUDIT, or "ALL" for everything]
## Your Task
1. Read docs/README.md for domain index
2. For each domain:
a. Read the domain doc file
b. Read the corresponding entity schema in server/domain/entities/
c. Read the Drizzle schema in server/infrastructure/persistence/schema.ts
d. Read the API routes in app/api/
e. Read the domain rules in server/domain/rules/ (if any)
3. Cross-check all items per your validation checklist
4. Return comprehensive review
Focus on: accumulated drift, stale sections, missing documentation.
Step 3: Handle Review Result
Based on the reviewer's verdict:
| Verdict | Action |
|---|
| SYNCED | Proceed. No docs changes needed. |
| NEEDS_UPDATE | Apply the Update Plan from the reviewer's output. Then re-verify. |
| CONFLICT | STOP. Present the conflict to the user. Resolve before proceeding. |
Step 4: Apply Docs Updates
When the reviewer identifies NEEDS_UPDATE:
- Read the specific doc file that needs updating
- Apply the changes from the reviewer's Update Plan
- Verify the update doesn't introduce new inconsistencies with other docs
- Check if
ubiquitous-language.md or docs/README.md index also needs updating
Step 5: Verify (optional but recommended)
After applying docs updates, launch a quick follow-up check:
Launch doc-reviewer with:
"I've updated docs/X.md based on the previous review. Verify these specific changes
are consistent with the code: [list specific changes made]. Quick check only."
Integration Points
With feature-consensus
The feature-consensus protocol includes a doc-review step. When used together:
feature-consensus Step 2 โ includes doc-reviewer as 3rd reviewer
โ
consensus reached
โ
doc-sync pre-implementation check
โ
TDD implementation
โ
doc-sync post-implementation check
โ
docs updated
โ
build + lint + test + typecheck
With AGENTS.md Checklist
The AGENTS.md ์์
์๋ฃ ์ฒดํฌ๋ฆฌ์คํธ includes docs sync items:
๊ธฐ๋ฅ ์ถ๊ฐ ์:
- [ ] docs ๋๊ธฐํ (pre): ๊ด๋ จ docs ์ฝ๊ณ ์ถฉ๋ ํ์ธ
- [ ] docs ๋๊ธฐํ (post): ์ฝ๋ ๋ณ๊ฒฝ ํ docs ์
๋ฐ์ดํธ
๋ฒ๊ทธ ์์ ์:
- [ ] docs ๋๊ธฐํ: ๋ฌธ์ํ๋ ์ ์ฑ
์ด ๋ณ๊ฒฝ๋ ๊ฒฝ์ฐ docs ์
๋ฐ์ดํธ
Docs Update Rules
When to update docs
| Code Change | Docs Update |
|---|
| New entity property added to Zod schema | Add to attribute table in domain doc |
| Entity property removed | Remove from attribute table |
Business rule changed in server/domain/rules/ | Update corresponding policy section |
| New API endpoint added | Update AGENTS.md API table + domain doc if relevant |
| API endpoint removed or method changed | Update AGENTS.md API table |
| New composite key or constraint in Drizzle schema | Update ์๋ณ์ section |
| New ubiquitous language term introduced | Add to ubiquitous-language.md |
| Cross-domain relationship changed | Update docs/README.md Context ๊ฐ ๊ด๊ณ + Data Flow |
| New track adapter added | Update docs/playback.md ํธ๋ ์ด๋ํฐ table |
| Queue behavior changed | Update docs/playback.md ํ ๊ด๋ฆฌ section |
When NOT to update docs
- Internal implementation details (algorithm choice, variable naming)
- Bug fixes that restore documented behavior (code was wrong, docs was right)
- Test additions or modifications
- Build/config changes
Priority order for updates
docs/ubiquitous-language.md โ terminology changes propagate everywhere
- Domain-specific doc (e.g.,
docs/likes.md) โ entity/rule changes
docs/README.md โ relationship/index changes
docs/architecture.md โ layer/structural changes
AGENTS.md โ API spec table changes
Common Drift Scenarios
Scenario 1: New attribute added to entity
Code: server/domain/entities/like.ts gains `source` field
Docs: docs/likes.md attribute table missing `source`
Fix: Add row to attribute table, describe what source means
Scenario 2: Business rule threshold changed
Code: server/domain/rules/ changes pruning from 200โ100 to 300โ150
Docs: docs/history.md still says "200๊ฐ๋ฅผ ์ด๊ณผ...100๊ฐ๋ก ์ถ์"
Fix: Update pruning policy section with new thresholds
Scenario 3: New API endpoint added
Code: app/api/playlists/{id}/share/route.ts created (POST)
Docs: AGENTS.md API table missing the endpoint
Fix: Add row to protected routes table
Scenario 4: Ubiquitous language drift
Code: Uses "FollowedChannel" consistently
Docs: ubiquitous-language.md uses "Channel Follow" as term
Fix: Align โ decide on one term, update the other
Scenario 5: Cross-domain relationship changed
Code: Discovery now also uses channels (new feature)
Docs: docs/README.md Context ๊ฐ ๊ด๊ณ missing Discovery โ Channels
Fix: Add relationship row
Checklist
Before marking a task complete:
Quick Reference
| Review Type | When | Agent Prompt | Time |
|---|
| Pre-implementation | Before coding | Feature brief + affected domains | ~30s |
| Post-implementation | After coding | Changed files list | ~45s |
| Full audit | Periodic / on request | Scope = ALL or specific domains | ~2min |
| Verdict | Meaning | Next Step |
|---|
| SYNCED | Docs match code | Proceed |
| NEEDS_UPDATE | Docs missing or slightly wrong | Apply Update Plan |
| CONFLICT | Docs contradict code | STOP and resolve with user |
Related SKILLS: feature-consensus, api-route-development, react-components, parser-patterns, zod-validation