code-comments_skill

This skill helps you write clear inline code comments and file headers that explain why, not just what, for humans and AI.
  • Shell

17

GitHub Stars

1

Bundled Files

3 weeks ago

Catalog Refreshed

2 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstart where the catalogue uses aiagentskills.

npx veilstart add skill petekp/claude-code-setup --skill code-comments

  • SKILL.md6.8 KB

Overview

This skill produces clear, plain-spoken comments and documentation that live alongside source code. It focuses on explaining why code exists and why decisions were made, optimized for human readers and AI coding assistants. Use it to add file headers, function docs, inline reasoning, architectural notes, and actionable TODOs.

How this skill works

The skill inspects code context and inserts or revises comments that explain intent, contracts, edge cases, and tradeoffs rather than restating implementation. It recommends language-specific patterns (file headers, docstrings, JSDoc/TSDoc, MARKs) and enforces co-located documentation so comments stay in sync with code. It also flags places where comments are unnecessary or risk duplicating obvious code.

When to use it

  • When adding new modules or files to describe purpose and relationships
  • When writing public functions or methods that need a clear contract
  • When reviewing code to surface intent, edge cases, and side effects
  • When documenting architecture decisions and tradeoffs
  • When leaving actionable, traceable TODO/HACK/FIXME notes

Best practices

  • Explain why, not what — skip comments that only restate code
  • Write for future-you, teammates, and AI assistants who see one file
  • Put file-level purpose and key relationships at the top of each file
  • Keep inline comments sparing and focused on reasoning or measurements
  • Reference constants instead of duplicating values; date temporary fixes

Example use cases

  • Add a file header for an auth context describing why context was chosen over global state
  • Write a function doc that states return-value semantics and non-obvious edge cases
  • Annotate a debounce implementation with measured latency tradeoffs
  • Create an architecture note explaining why event sourcing was used and its caching tradeoffs
  • Insert actionable TODOs that include owner, blocker, and issue references

FAQ

Skip comments that merely restate clear code. If a variable or function name is descriptive, no comment is needed. Reserve comments for intent, constraints, and tradeoffs.

How detailed should file headers be?

Keep headers short: purpose, why it exists if unclear, key relationships, and any non-obvious design choices. Link to deeper docs only when necessary.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational