Check if code changes require documentation updates and update the /docs knowledge base accordingly.
Review code changes and update the documentation knowledge base in /docs to keep it in sync.
If $ARGUMENTS is provided, focus on that file or directory. Otherwise, use git diff --name-only $(git merge-base HEAD main)...HEAD to get the list of changed files on the current branch.
The knowledge base consists of:
| Doc File | Covers |
|---|---|
docs/ai-sdk.md | AI SDK patterns, createChatResponse, createTool, built-in tools, useChat |
docs/ui-components.md | shadcn/ui components, cn() utility, CVA variants, AI components |
docs/mcp-integration.md | MCP servers, Smithery registry, createMCPClient, transport types |
docs/skills.md | Skills system, SKILL.md format, manifest configuration |
docs/README.md | Index and external links |
Get the list of changed files:
git diff --name-only $(git merge-base HEAD main)...HEAD
Check if any changed files affect documented areas:
docs/ai-sdk.md)Watch for changes in:
src/lib/chat/index.ts - Core chat helperssrc/lib/chat/tools.ts - Tool definitionssrc/lib/chat/skills.ts - Skill loadingsrc/app/api/chat/*/route.ts - API routespackage.json - AI SDK version changesdocs/ui-components.md)Watch for changes in:
src/components/ui/*.tsx - New or modified shadcn componentssrc/components/ai-elements/*.tsx - AI-specific componentssrc/lib/utils.ts - Utility functions like cn()docs/mcp-integration.md)Watch for changes in:
src/lib/mcp/index.ts - Core MCP functionssrc/lib/mcp/servers.ts - Server definitionssrc/lib/actions/integrations.ts - Smithery integrationsrc/lib/hooks/use-server-search.ts - Search hookpackage.json - MCP package version changesdocs/skills.md)Watch for changes in:
src/lib/chat/skills.ts - Skill loading logicskills/*/SKILL.md - Skill examples.claude/skills/*/SKILL.md - Claude Code skillsFor each affected documentation file, determine:
package.jsonCreate a new doc file in /docs when:
New doc files should:
docs/<topic>.mddocs/README.md indexFor each documentation file that needs updating:
For new documentation files:
docs/README.md index# [Feature Name]
Brief description of what this covers.
## Overview
What this feature/system does and why it exists.
## Package (if applicable)
\`\`\`json
{
"package-name": "^x.y.z"
}
\`\`\`
## Key Concepts
### [Concept 1]
Explanation with code example.
### [Concept 2]
Explanation with code example.
## Key Files
| File | Purpose |
|------|---------|
| `/src/path/to/file.ts` | Description |
## Related Documentation
- [Related Doc](./related.md) - How it connects
Output a report in this format:
## Documentation Update Report
### Changed Source Files
- `path/to/file.ts` - [brief description of change]
### New Documentation Needed
#### docs/[new-feature].md (NEW)
- [ ] Create new doc for [feature name]
- [ ] Add to docs/README.md index
- [ ] Cross-reference from [related docs]
### Documentation Updates Needed
#### docs/ai-sdk.md
- [ ] Update `createChatResponse` section - new parameter added
- [ ] Add new tool helper function
#### docs/ui-components.md
- [ ] Add new `Dialog` component documentation
- [ ] Update `Button` variants
#### docs/mcp-integration.md
- [ ] No updates needed
### Package Version Changes
- `ai`: 6.0.48 → 6.1.0
- `@ai-sdk/mcp`: 1.0.13 → 1.0.15
### Recommended Actions
1. [First update to make]
2. [Second update to make]
Ask the user if they want to:
When applying updates:
When creating new documentation:
/docsdocs/README.md guide tableThis skill should be run before creating a PR to ensure documentation stays in sync with code changes. It's referenced in CLAUDE.md as part of the PR readiness workflow.