Code Example Synchronization
Use this skill when docs contain code snippets that are likely to drift from the real implementation.
- Leverage native parallel subagent dispatch and 200k+ context windows where available.
Activation Conditions
Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.
- Function signatures changed
- Imports or package names changed
- Request or response contracts changed
- Framework guidance or recommended patterns changed
- A doc snippet compiles conceptually but no longer matches the codebase
Workflow
- Find the canonical implementation first.
- Update every affected snippet in docs, examples, and READMEs.
- Verify syntax, imports, and expected outputs.
- Note any intentional divergence, such as simplified tutorial snippets.
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
workflow in project instructions when folder discovery is unavailable.
- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/code-examples-sync and restart Codex after major changes.
MCP Availability And Fallback
Preferred MCP Server: None required
- Fallback prompt: "Use the Code Example Synchronization skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
- Do not claim an MCP operation was used when the active host does not expose it.
- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
Anti-Patterns
- Starting work before the plan or gate is clear: Execution drifts when success criteria are implied instead of explicit.
- Treating verification as optional cleanup: The last mile is where regressions and missing updates are usually hiding.
- Mixing planning, implementation, and release work in one jump: You lose the causal chain that explains why a change is safe.
Verification Protocol
Before claiming "skill applied successfully":
- Pass/fail: The Code Examples Sync workflow starts from explicit success criteria, constraints, and stop conditions.
- Pass/fail: Required evidence is collected before any completion, approval, or readiness claim.
- Pass/fail: The next action follows the documented gate order without skipping review or verification steps.
- Pressure-test scenario: Apply the workflow under time pressure with one failing check and one tempting shortcut.
- Success metric: Zero rationalizations; blocked, failed, or unverified work is reported as such.
Quality Checklist
References & Resources
Documentation
Scripts
- Example Sync Check - Audit Markdown files for untyped fences, placeholder text, and obviously stale examples
Related Skills
- development-workflow: Use it when the workflow also needs planning, quality gates, and delivery tracking.
- code-quality: Use it when the workflow also needs two-stage review (spec compliance first, then code quality), maintainability, and refactoring guidance.
- systematic-debugging: Use it when the workflow also needs root-cause debugging before proposing fixes.
- test-driven-development: Use it when the workflow also needs test-first implementation and regression safety.
1---
2name: code-examples-sync
3version: "2.0"
4last_updated: 2026-09-08
5tags: [code, examples, sync, workflow, quality]
6description: "Synchronize and verify code examples in documentation. Use when function signatures change, API interfaces update, imports shift, or documentation snippets become outdated and need correction."
7metadata:
8 source: https://skillmd.com/skills/practicalswan/code-examples-sync
9---
10
11# Code Example Synchronization
12
13Use this skill when docs contain code snippets that are likely to drift from the real implementation.
14
15- Leverage native parallel subagent dispatch and 200k+ context windows where available.
16
17
18## Activation Conditions
19
20Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.
21
22- Function signatures changed
23- Imports or package names changed
24- Request or response contracts changed
25- Framework guidance or recommended patterns changed
26- A doc snippet compiles conceptually but no longer matches the codebase
27
28## Workflow
29
301. Find the canonical implementation first.
312. Update every affected snippet in docs, examples, and READMEs.
323. Verify syntax, imports, and expected outputs.
334. Note any intentional divergence, such as simplified tutorial snippets.
34
35<!-- MCP:START -->
36
37<!-- PORTABILITY:START -->
38## Cross-Client Portability
39
40This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
41
42- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
43 workflow in project instructions when folder discovery is unavailable.
44- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
45- Codex: install or sync the folder into
46 `$CODEX_HOME/skills/code-examples-sync` and restart Codex after major changes.
47
48<!-- PORTABILITY:END -->
49
50## MCP Availability And Fallback
51
52Preferred MCP Server: None required
53
54- Fallback prompt: "Use the Code Example Synchronization skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
55- Do not claim an MCP operation was used when the active host does not expose it.
56- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
57
58<!-- MCP:END -->
59
60## Anti-Patterns
61
62- Starting work before the plan or gate is clear: Execution drifts when success criteria are implied instead of explicit.
63- Treating verification as optional cleanup: The last mile is where regressions and missing updates are usually hiding.
64- Mixing planning, implementation, and release work in one jump: You lose the causal chain that explains why a change is safe.
65
66## Verification Protocol
67
68Before claiming "skill applied successfully":
69
701. Pass/fail: The Code Examples Sync workflow starts from explicit success criteria, constraints, and stop conditions.
712. Pass/fail: Required evidence is collected before any completion, approval, or readiness claim.
723. Pass/fail: The next action follows the documented gate order without skipping review or verification steps.
734. Pressure-test scenario: Apply the workflow under time pressure with one failing check and one tempting shortcut.
745. Success metric: Zero rationalizations; blocked, failed, or unverified work is reported as such.
75
76## Quality Checklist
77
78- [ ] Snippet matches current API shape
79- [ ] Imports and package names are current
80- [ ] Async, error handling, and setup steps still make sense
81- [ ] Output examples match current behavior
82- [ ] Duplicate snippets across docs were updated together
83
84## References & Resources
85
86### Documentation
87- [Code Example Verification](./references/verification.md) - Checks for examples, imports, outputs, and compatibility
88
89### Scripts
90- [Example Sync Check](./scripts/example-sync-check.py) - Audit Markdown files for untyped fences, placeholder text, and obviously stale examples
91
92## Related Skills
93
94- [development-workflow](../development-workflow/SKILL.md): Use it when the workflow also needs planning, quality gates, and delivery tracking.
95- [code-quality](../code-quality/SKILL.md): Use it when the workflow also needs two-stage review (spec compliance first, then code quality), maintainability, and refactoring guidance.
96- [systematic-debugging](../systematic-debugging/SKILL.md): Use it when the workflow also needs root-cause debugging before proposing fixes.
97- [test-driven-development](../test-driven-development/SKILL.md): Use it when the workflow also needs test-first implementation and regression safety.