skills/code-comment-best-practices/SKILL.md
Code comment conventions for TypeScript/React — JSDoc vs inline, when to explain why vs what, params/returns rules, spacing, placement, test comment rules, links in comments (@see vs {@link}), TODO/FIXME format, anti-patterns, writing style. Use when adding, updating, or reviewing comments in .ts or .tsx files. Do NOT use for general documentation questions unrelated to in-code comments.
npx skillsauth add bkinsey808/songshare-effect code-comment-best-practicesInstall 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.
Requires: file-read. No terminal needed unless validating after edits.
Depends on: typescript-best-practices/SKILL.md — load when comment changes are driven by API clarity or type changes.
docs/code-comment-best-practices.md — load on demand for detailed formatting patterns, examples, and edge cases.
Preconditions:
docs/ai/rules.md for repo-wide constraints.Clarifying questions:
Output format:
Error handling:
Core philosophy: explain the "why," not the "what." (philosophy)
/** */) for exported functions, components, and types. (when to use)// for logic blocks (useEffect, complex conditionals), test descriptions, and grouped constants. (inline comments)@param name - description only. (formatting)@returns — write @returns void for void functions. (params & returns)@param props wrapper; list each destructured field. (params & returns)/** and */ each on their own line. (formatting)describe/it/test — use // only when the name isn't self-explanatory. (test comments)// above the group, not JSDoc spanning multiple symbols. (constants)/** ... */) rather than //. Reserve // for inline implementation notes and small logic comments. This keeps symbol-level documentation consistent and machine-readable.@see for standalone links (URLs, file paths), {@link} for inline symbol refs; never // for comments containing links. (links in comments)// TODO: [action] — [reason or ticket]; switch to JSDoc when the comment includes a link. (inline comments)//; active voice; present tense; one space after //. (writing style)npm run lint
docs/ai/rules.md..ts/.tsx files.typescript-best-practices.react-best-practices.Input: "Add JSDoc to all exported functions in src/utils/format.ts"
Expected: Agent reads the file, adds JSDoc with correct param/returns rules (no types, destructured props, @returns void where applicable), runs lint + tsc, reports what was added.
Input: "How should I comment a useEffect block?"
Expected: Agent answers in prose: use // above the useEffect, explain the why not the what, never on the same line. References §6 of the doc.
Input: "Add comments" (no file specified) Expected: Agent asks which file before proceeding.
tools
Zustand state management patterns for this project — store creation, selectors, Immer middleware, async actions with loading states, devtools, persist, and testing. Use when authoring or editing Zustand stores (use*Store files) or components that subscribe to stores. Do NOT use for React component structure or TypeScript-only utilities.
testing
How to write, update, or split skill files in this repo. Use when creating a new SKILL.md, updating an existing one, or deciding whether to put content in a skill vs. docs/.
development
Complete guide for testing React hooks — renderHook, Documentation by Harness, installStore, fixtures, subscription patterns, lint/compiler traps, and pre-completion checklist. Read docs/testing/unit-test-hook-best-practices.md for the full reference.
development
Vitest unit test authoring for this repo — setup, mocking, API handler testing, and common pitfalls for non-hook code. Use when the user asks to add, update, fix, or review unit tests for utilities, components, API handlers, or scripts. Do NOT use for React hook tests — load unit-test-hook-best-practices instead.