AgentSkillsCN

cc-documentation-quality

审查 README、注释、API 文档、更新日志,以及 AI 文档(CLAUDE.md、.cursorrules、copilot-instructions)等各方面的文档质量。适用于检查文档是否与代码一致、注释是否陈旧、新功能是否缺乏文档,或审查 PR 文档时使用。可通过“审查文档”、“陈旧的注释”、“更新更新日志”、“文档债务”、“README 准确性”、“PR 文档审查”、“缺失文档”等短语来触发。

SKILL.md
--- frontmatter
name: cc-documentation-quality
description: "Review documentation quality across README, comments, API docs, changelog, and AI documentation (CLAUDE.md, .cursorrules, copilot-instructions). Use when checking if documentation matches code, comments are stale, new features lack docs, or reviewing PR documentation. Triggers on: review docs, stale comments, update changelog, documentation debt, README accuracy, PR documentation review, missing docs."

Documentation Quality

STOP - Documentation Freshness

  • Documentation rots faster than code. Stale docs are worse than no docs.
  • If code changed, check which docs need updating - README, CLAUDE.md, API docs, comments
  • Comments explain WHY, not WHAT - If it repeats the code, delete it

Core Principle

"The purpose of comments is to explain things that aren't obvious from the code." — Ousterhout, APOSD

Good documentation:

  • Explains WHY, not WHAT
  • Uses different words than the code
  • Stays synchronized with implementation
  • Describes the non-obvious

Documentation Checklist

1. README Accuracy

  • Does README describe current behavior?
  • Are setup instructions still valid?
  • Do examples still work?
  • Are dependencies current?
  • Is the feature list accurate?

2. Comment Freshness

  • Do comments match the code they describe?
  • Are TODOs still relevant or stale?
  • Do function comments match signatures?
  • Are "temporary" comments actually temporary?

3. API Documentation

  • Public interfaces have doc comments?
  • Parameters documented with types and constraints?
  • Return values documented?
  • Exceptions/errors documented?
  • Examples provided for complex APIs?

4. Changelog Updates

  • Breaking changes documented?
  • New features listed?
  • Bug fixes noted?
  • Migration instructions for breaking changes?

5. Comment Quality (APOSD)

  • Comments describe non-obvious things?
  • Comments use different words than code?
  • Interface comments present (before implementation)?
  • Comments explain "why", not "what"?
  • No comments that repeat the code?

6. Missing Documentation

  • New public APIs documented?
  • New configuration options documented?
  • New environment variables documented?
  • New CLI flags documented?

7. AI Documentation

Check all AI config files that exist in the project:

FileTool
CLAUDE.mdClaude Code
.cursorrules / .cursorignoreCursor
.github/copilot-instructions.mdGitHub Copilot
AGENTS.mdCopilot Workspace
.windsurfrulesWindsurf
.aider.conf.ymlAider
.continue/config.jsonContinue.dev
.clinerulesCline
.roomodesRoo Code
CONVENTIONS.mdVarious
  • AI docs reflect current architecture?
  • Agent/skill descriptions accurate?
  • File structure documentation up to date?
  • All AI config files consistent with each other?
  • Version numbers synchronized?

Comment Anti-Patterns

Anti-PatternExampleProblem
Repeat the codei++ // increment iZero value
State the obvious// loop through usersNoise
Stale commentComment says X, code does YDangerous
TODO forever// TODO: fix this from 2019Clutter
Commented-out codeDead code masquerading as commentConfusion

Comment Patterns That Add Value

PatternExampleValue
Explain rationale// Use insertion sort: n < 10 alwaysDesign decision
Warn about non-obvious// Must call before X, else crashPrevent bugs
Summarize algorithm// Binary search on sorted timestampsQuick understanding
Document edge case// Empty list returns -1, not nullClarify behavior
Reference external// Per RFC 7231 section 6.5.4Authority

Severity Guide

FindingSeverity
README contradicts actual behaviorCRITICAL
API doc says wrong return typeCRITICAL
Stale comment causes bug riskCRITICAL
CLAUDE.md describes deleted/renamed filesCRITICAL
New public API undocumentedIMPORTANT
Breaking change not in changelogIMPORTANT
CLAUDE.md missing new features/agentsIMPORTANT
AI doc version mismatchIMPORTANT
Stale TODO from distant pastSUGGESTION
Could add clarifying commentSUGGESTION
Minor README improvementSUGGESTION

Questions to Ask

  1. "If someone reads only the docs, will they use this correctly?"
  2. "If the code changes, which docs need updating?"
  3. "Does this comment tell me something the code doesn't?"
  4. "Is this TODO actionable or just noise?"

Chain

AfterNext
Docs need code changesBack to implementation
Docs verifiedDone (pre-commit gate)