skills/developer/code-intelligence/doc-sync-automation/SKILL.md
Use this skill when keeping documentation synchronized with code. Activate when the user needs to update docs after code changes, generate API documentation, create README updates, keep JSDoc/TSDoc in sync, or automate documentation workflows.
npx skillsauth add latestaiagents/agent-skills doc-sync-automationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Keep documentation synchronized with code changes automatically.
| Type | Location | Sync Trigger |
|------|----------|--------------|
| Inline (JSDoc/TSDoc) | In code files | Code changes |
| API Reference | /docs/api/ | Endpoint changes |
| README | Root or feature folders | Feature changes |
| Changelog | CHANGELOG.md | Any release |
| Architecture | /docs/architecture/ | Structure changes |
Generate JSDoc comments for this function:
```typescript
async function createUser(
email: string,
password: string,
options?: { role?: string; sendWelcome?: boolean }
): Promise<User> {
// implementation
}
Include:
### Generated Output
```typescript
/**
* Creates a new user account with the specified credentials.
*
* @param email - The user's email address (must be unique)
* @param password - The user's password (min 8 characters)
* @param options - Optional configuration
* @param options.role - User role, defaults to 'user'
* @param options.sendWelcome - Send welcome email, defaults to true
* @returns The newly created user object
* @throws {ValidationError} If email is invalid or password too short
* @throws {DuplicateError} If email already exists
*
* @example
* const user = await createUser('[email protected]', 'securepass123');
*
* @example
* const admin = await createUser('[email protected]', 'adminpass', {
* role: 'admin',
* sendWelcome: false
* });
*/
Update JSDoc for all exported functions in this file.
Keep existing descriptions if accurate, update if code changed.
```[paste file content]```
For each function, ensure:
- Description matches current behavior
- All parameters documented
- Return type documented
- Examples are valid
Generate OpenAPI 3.1 specification for this Express route:
```typescript
router.post('/users',
authenticate,
validate(createUserSchema),
async (req, res) => {
const user = await userService.create(req.body);
res.status(201).json(user);
}
);
Request schema:
[paste validation schema]
Response type:
[paste User type]
### Generated OpenAPI
```yaml
paths:
/users:
post:
summary: Create a new user
description: Creates a new user account. Requires authentication.
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
example:
email: "[email protected]"
password: "securepassword123"
role: "user"
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Validation error
'401':
description: Unauthorized
'409':
description: Email already exists
Update this README section based on code changes:
**Current README section:**
```markdown
## Installation
npm install mypackage
Code changes made:
Generate updated section reflecting these changes.
### README Sync Checklist
When code changes, check these README sections:
- [ ] **Installation** - Dependencies changed?
- [ ] **Quick Start** - API changed?
- [ ] **Configuration** - New options?
- [ ] **Examples** - Still valid?
- [ ] **Requirements** - Version requirements?
## Changelog Generation
### AI Prompt for Changelog
```markdown
Generate changelog entry for these commits:
abc123 feat(auth): add OAuth2 support for Google def456 fix(api): handle null response from payment gateway ghi789 chore(deps): update React to 19.0 jkl012 docs(readme): add deployment section
Follow Keep a Changelog format. Categorize as:
- Added, Changed, Deprecated, Removed, Fixed, Security
## [1.2.0] - 2026-02-04
### Added
- OAuth2 authentication support for Google accounts (#123)
- Deployment documentation in README
### Fixed
- Null response handling in payment gateway integration (#456)
### Changed
- Updated React from 18.x to 19.0
// package.json
{
"husky": {
"hooks": {
"pre-commit": "npm run docs:check"
}
},
"scripts": {
"docs:check": "node scripts/check-docs-sync.js",
"docs:generate": "typedoc --out docs/api src/"
}
}
# .github/workflows/docs.yml
name: Documentation
on:
push:
branches: [main]
paths:
- 'src/**'
- 'docs/**'
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate API docs
run: npm run docs:generate
- name: Check for changes
id: changes
run: |
git diff --quiet docs/ || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit docs
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name 'Documentation Bot'
git config user.email '[email protected]'
git add docs/
git commit -m 'docs: auto-update API documentation'
git push
src/
├── users/
│ ├── userService.ts
│ ├── userService.test.ts
│ └── README.md # Feature-specific docs
docs/
├── api/
│ └── users.md # References src/users/
src/
├── users/
│ └── userService.ts # @see docs/api/users.md
// Code with JSDoc
/**
* @module UserService
* @description User management functionality
*/
// Auto-generated to docs/api/UserService.md
After documentation updates:
# Check for broken links
npx markdown-link-check docs/**/*.md
# Validate OpenAPI spec
npx @redocly/cli lint openapi.yaml
# Check code examples still work
npx ts-node scripts/test-doc-examples.ts
development
Test skills for correct activation, content quality, and regression — both automated checks (frontmatter validity, lint) and manual verification (query-suite activation testing). Covers CI integration and how to catch skill regressions before users do. Use this skill when adding skills to a repo, setting up CI for a skill library, or debugging "the skill exists but doesn't work". Activate when: test skills, validate skills, skill CI, skill linting, skill activation test, skill regression.
documentation
Write the YAML frontmatter for a SKILL.md file so it activates reliably — name, description, and activation keywords that the model matches against. Covers length, tone, and the most common frontmatter mistakes. Use this skill when authoring a new skill, fixing a skill that isn't auto-activating, or reviewing skills for publication. Activate when: SKILL.md frontmatter, skill description, skill activation, skill YAML, write a skill, author a skill.
development
Design skills that fire at the right moment — neither over-eager (noise) nor under-eager (silent). Covers activation specificity, trigger phrases, disambiguation between overlapping skills, and debugging activation. Use this skill when multiple skills could fire on the same query, a skill never fires, or a skill fires too often. Activate when: skill won't activate, skill over-activates, overlapping skills, skill triggers, skill selection, skill disambiguation.
development
Structure SKILL.md content so the model reads just enough — concise summary up front, progressively deeper detail, examples on demand. Covers section ordering, length budgets, when to split into multiple skills. Use this skill when writing or refactoring a skill body, one skill has grown too long, or a skill is wordy but not useful. Activate when: SKILL.md structure, skill content, skill too long, split skill, progressive disclosure, skill body.