skills/code-comments/SKILL.md
Use when adding, fixing, reviewing, or generating code comments, docstrings, Javadoc, JSDoc/TSDoc, rustdoc, SQL comments, or documentation comments for source, markup, configuration, or database files.
npx skillsauth add Refinex-Space/Refinex-Skills code-commentsInstall 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.
This skill enforces correct, standardized commenting across all major programming languages, markup languages, and configuration formats. It serves two purposes:
These principles apply universally regardless of language:
Every public API surface must be documented. Classes, interfaces, public methods, exported functions, public fields — no exceptions. The documentation must describe what and why, not how (the code shows how).
Comments describe intent, not mechanics. // increment i on i++ is noise. // Retry with exponential backoff to handle transient network failures is signal. If a comment restates the code literally, delete it.
Use the language's standard doc-comment format. Javadoc for Java, docstrings for Python, /// for Rust, JSDoc for JavaScript/TypeScript, <!-- --> for XML/HTML, # for YAML. Never invent custom formats when a standard exists.
Comments must stay synchronized with code. A wrong comment is worse than no comment. When modifying code, update the adjacent comments in the same edit.
Comment density scales with complexity, not length. A 200-line CRUD handler may need few inline comments. A 30-line algorithm may need comments on every block. Density follows cognitive load, not line count.
First sentence is the contract. In doc comments, the first sentence (before any blank line or tag) should be a complete, standalone summary. Tools extract this as the short description.
Language matters. Write comments in the project's primary human language. If the project uses English, all comments in English. If Chinese, all in Chinese. Never mix within a file unless terms are domain-specific.
When a user explicitly asks you to comment a file or directory, follow this procedure.
For directory-scope work, list the discovered files and their languages to the user before starting, so they can confirm or exclude any.
Before commenting any file, read the appropriate reference from references/:
| Language/Format | Reference File | Standard |
| ------------------------------------------- | ----------------------------- | ----------------------------------- |
| Java | references/java.md | Javadoc (Oracle), Google Java Style |
| Python | references/python.md | PEP 257, Google/NumPy style |
| TypeScript, JavaScript, React, Vue | references/typescript-js.md | JSDoc, TSDoc, Vue SFC conventions |
| Rust | references/rust.md | rustdoc conventions |
| XML, HTML, YAML, SQL, CSS, Shell, Go, C/C++ | references/markup-config.md | Language-specific standards |
Read the reference before writing any comments. The references contain exact formatting rules, required tags, and calibrated examples. Do not rely on memory alone.
For each file, perform a gap analysis:
@param/@return (Java), Args:/Returns: (Python), etc.Add, correct, or remove comments according to the language reference. For each file:
After commenting, do a quick self-check per file:
When writing code for any task (not just commenting tasks), apply these rules automatically:
@param, @return, @throws tags.The goal is zero remediation — code should be properly commented when first written, not patched after the fact.
Regardless of language, these categories always require comments:
userId needs "Unique identifier for the user in the authentication system", not "the user ID")Required before:
When analyzing existing comments, actively look for and fix these:
// set the name on setName(). Remove or replace with meaningful context.// TODO comments with no intent to complete. Flag to user.// Modified by X on date Y). This belongs in version control, not in code.development
Deep initialization of project AGENTS.md hierarchy and control plane for AI coding agents. Use this skill whenever the user wants to set up, initialize, bootstrap, or create AGENTS.md / CLAUDE.md files for their project, or when they mention "init-deep", "harness setup", "control plane", "agent context", "project initialization for agents", or want to make their codebase agent-ready. Also trigger when a user says things like "set up my repo for Claude Code", "make this project work better with agents", "create agent instructions", "bootstrap harness", or "initialize agent docs". This skill handles both existing large codebases (where hierarchical, module-scoped AGENTS.md files are needed) and new/small projects (where brainstorming with the user comes first). Do NOT use this skill for routine code changes, bug fixes, or general documentation — it is specifically for creating the structured agent control plane.
development
Detect and fix drift in project AGENTS.md files and agent control plane. Use this skill whenever the user wants to audit, recalibrate, refresh, update, or fix their existing AGENTS.md files, or when they mention "drift", "stale AGENTS.md", "outdated agent instructions", "recalibrate", "sync agents", "audit control plane", "AGENTS.md is wrong/old/broken", or when they suspect their agent harness has fallen out of sync with the codebase. Also trigger when a user says things like "my agents keep making wrong assumptions", "Claude doesn't understand the new structure", "we refactored but the AGENTS.md is old", "check if my AGENTS.md is still accurate", or "update my agent docs". This skill is the companion to init-deep — init-deep creates the control plane from scratch, drift-doctor maintains it over time. Do NOT use for initial creation of AGENTS.md (use init-deep instead). Do NOT use for general code review or documentation updates unrelated to agent context.
development
Enforce production-grade Java development standards when writing, reviewing, or architecting Java code. Covers commenting, core Java idioms (Stream, collections, concurrency, generics), 23 GoF design patterns, SonarQube/Alibaba p3c/Lombok rules, Spring Boot MVC structure, Spring Cloud DDD microservices, MyBatis/JPA/transaction management, exception handling, logging, REST API design, testing, and security. Trigger whenever the user writes Java code, reviews Java code, designs a Spring Boot or Spring Cloud project, implements a design pattern, fixes code smells, discusses architecture, or asks about Java best practices. Also trigger when Java code is pasted for feedback or the user asks about package structure, DTO/VO/PO conventions, or coding standards.
development
Use when starting Harness implementation work that needs an isolated git worktree, especially before executing an approved plan or beginning a scoped feature/fix branch. Select the repository's worktree directory, verify ignored project-local directories, create a `codex/`-prefixed branch by default, run setup and baseline checks, and prevent plan execution on main/master unless the user explicitly allows it.