Write Documentation
Use this skill to keep code and documentation synchronized as part of the same change.
When To Use
- Public API additions or signature changes
- User-facing behavior changes
- Internal workflow or architecture changes
- New modules or systems that need discoverable guidance
Prerequisite Checks
- Identify whether the change is public API, internal workflow, or architecture.
- Identify all touched entry points and exports.
- Identify which docs are currently source-of-truth for the affected behavior.
Documentation Targets
- Public exports: add complete JSDoc (
description,@param,@returns,@throws,@example). - User-facing usage changes: update
README.md. - Agent workflow or internal pattern changes: update
AGENTS.md. - New architecture or subsystem docs: update
docs/.
Workflow
- Classify the change type before finalizing implementation.
- Build a docs-impact checklist from changed files and exports.
- Update JSDoc while writing code, not as a post-pass.
- Update
README.mdusage snippets for any user-facing behavior change. - Update
AGENTS.mdfor contributor or internal policy updates. - Update
docs/for architecture-level changes. - Verify examples match current signatures and behavior.
- Re-check docs during quality gate run to prevent stale guidance.
Commonly Missed Cases
- Return-type changes with unchanged function names.
- New error tags introduced without JSDoc
@throwsupdates. - Configuration and environment variable changes not reflected in docs.
- Internal behavior changes that invalidate AGENTS guidance.
Example: Public API Change
If createSession(input) now requires tenantId, update all of:
- JSDoc in source:
- Add
@param tenantIddetails and update example.
- Add
README.md:- Update usage snippets and migration notes.
AGENTS.md:- Add any new contributor rule or workflow impact.
Review Checklist
- Public exports have complete and accurate JSDoc.
- README usage examples compile logically against current API.
- AGENTS guidance reflects current internal patterns.
- Architecture docs cover any new subsystem or integration.
- No contradictory statements remain across docs.