| name | code-documentation |
| description | TSDoc and inline comment patterns. Use when documenting exported functions, Vue components, or complex logic that needs explanation. |
Code Documentation Skill
"Write code that speaks for itself. Document only WHY, not WHAT."
When to Document
✅ DO document:
- Exported functions, composables, utils
- Vue component props/emits contracts
- Complex business logic or algorithms
- Non-obvious workarounds or hacks
❌ DON'T document:
- Self-explanatory code
- What the code does (use better names instead)
- Obvious operations
Quick Reference
TSDoc for Functions
export function myFunction(paramName: string): ReturnType {
}
Vue Component Documentation
<script setup lang="ts">
interface Props {
/** Brief description of what this prop does */
task: Task
editable?: boolean
}
const emit = defineEmits<{
'update': [task: Task]
'delete': []
}>()
</script>
Inline Comments
Only for WHY, not WHAT:
await debounce(handleSearch, 300)
const total = price + tax
Annotation Keywords
Summary
- Self-documenting code first - Good names > comments
- Explain WHY, not WHAT - Add insight, don't repeat code
- TSDoc for exports - All public APIs need docs
- Keep it updated - Wrong docs are worse than no docs