ilude/claude-code-config/code-documentation
Claude Code and agent skill by ilude/claude-code-config
- community
Checking that the SKILL.md file is still in the repository.
Guidelines for self-explanatory code and meaningful documentation. Activate when working with comments, docstrings, documentation, code clarity, API documentation, JSDoc, or discussing code commenting strategies. Guides on why over what, anti-patterns, decision frameworks, and language-specific examples.
Install
npx vskill@latest install ilude/claude-code-config/code-documentationSKILL.md
The same SKILL.md was published earlier as ilude/claude-code-config/code-documentation.
Code Documentation & Self-Explanatory Code
Auto-activate when: User discusses comments, documentation, docstrings, code clarity, code quality, API docs, JSDoc, Python docstrings, or asks about commenting strategies.
Core Principle
Write code that speaks for itself. Comment only when necessary to explain WHY, not WHAT.
Most code does not need comments. Well-written code with clear naming and structure is self-documenting.
The best comment is the one you don't need to write because the code is already obvious.
The Commenting Philosophy
When to Comment
✅ DO comment when explaining:
- WHY something is done (business logic, design decisions)
- Complex algorithms and their reasoning
- Non-obvious trade-offs or constraints
- Workarounds for bugs or limitations
- API contracts and public interfaces
- Regex patterns and what they match
- Performance considerations or optimizations
- Constants and magic numbers
- Gotchas or surprising behaviors
❌ DON'T comment when:
- The code is obvious and self-explanatory
- The comment repeats the code (redundant)
- Better naming would eliminate the need
- The comment would become outdated quickly
- It's decorative or organizational noise
- It states what a standard language construct does
Comment Anti-Patterns
❌ 1. Obvious Comments
BAD:
Better: No comment needed - the code is self-explanatory.
❌ 2. Redundant Comments
BAD:
Better:
❌ 3. Outdated Comments
BAD:
Better: Keep comments in sync with code, or remove them entirely.
❌ 4. Noise Comments
BAD:
Better: Remove all of these comments.
❌ 5. Dead Code & Changelog Comments
BAD:
Better: Delete the code. Git has the history.
Good Comment Examples
✅ Complex Business Logic
✅ Non-obvious Algorithms
✅ Regex Patterns
✅ API Constraints or Gotchas
✅ Workarounds for Bugs
Decision Framework
Before writing a comment, ask yourself:
Step 1: Is the code self-explanatory?
- If YES → No comment needed
- If NO → Continue to step 2
Step 2: Would a better variable/function name eliminate the need?
- If YES → Refactor the code instead
- If NO → Continue to step 3
Step 3: Does this explain WHY, not WHAT?
- If explaining WHAT → Refactor code to be clearer
- If explaining WHY → Good comment candidate
Step 4: Will this help future maintainers?
- If YES → Write the comment
- If NO → Skip it
Special Cases for Comments
Public APIs and Docstrings
Python Docstrings
JavaScript/TypeScript JSDoc
Constants and Configuration
Annotations for TODOs and Warnings
Common Annotation Keywords
TODO:- Work that needs to be doneFIXME:- Known bugs that need fixingHACK:- Temporary workaroundsNOTE:- Important information or contextWARNING:- Critical information about usagePERF:- Performance considerationsSECURITY:- Security-related notesBUG:- Known bug documentationREFACTOR:- Code that needs refactoringDEPRECATED:- Soon-to-be-removed code
Refactoring Over Commenting
Instead of Commenting Complex Code...
BAD: Complex code with comment
...Extract to Named Function
GOOD: Self-explanatory through naming
Language-Specific Examples
JavaScript
Python
TypeScript
Comment Quality Checklist
Before committing, ensure your comments:
- [ ] Explain WHY, not WHAT
- [ ] Are grammatically correct and clear
- [ ] Will remain accurate as code evolves
- [ ] Add genuine value to code understanding
- [ ] Are placed appropriately (above the code they describe)
- [ ] Use proper spelling and professional language
- [ ] Follow team conventions for annotation keywords
- [ ] Could not be replaced by better naming or structure
- [ ] Are not obvious statements about language features
- [ ] Reference tickets/issues when applicable
Summary
Priority order:
- Clear code - Self-explanatory through naming and structure
- Good comments - Explain WHY when necessary
- Documentation - API docs, docstrings for public interfaces
- No comments - Better than bad comments that lie or clutter
Remember: Comments are a failure to make the code self-explanatory. Use them sparingly and wisely.
Key Takeaways
| Goal | Approach | |
|---|---|---|
| Reduce comments | Improve naming, extract functions, simplify logic | |
| Improve clarity | Use self-explanatory code structure, clear variable names | |
| Document APIs | Use docstrings/JSDoc for public interfaces | |
| Explain WHY | Comment only business logic, algorithms, workarounds | |
| Maintain accuracy | Update comments when code changes, or remove them |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/code-documentation/SKILL.md
Popularity
- Repository stars
- 7
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ilude/claude-code-config/code-documentation)