| name | code-commenting-checklists |
| description | Use specific checklists to ensure comprehensive and high-quality code commenting for general code, data declarations, and program structures. Apply when writing new code, reviewing existing code, or conducting code reviews to ensure completeness and quality of documentation. |
Code Commenting Checklists
When to Use This Skill
- Writing or reviewing code comments
- Conducting code reviews
- Establishing code quality standards
- Onboarding new developers to commenting practices
- Preparing code for maintenance or handoff
General Comment Techniques Checklist
Apply this checklist to ensure overall comment quality:
Data Declaration Comment Rules
Apply this checklist when declaring variables, constants, and data structures:
Program Structure and File Comment Rules
Apply this checklist for subprograms, functions, classes, and files:
Usage Guidelines
During Code Writing
- Write comments as you write code
- Apply relevant checklist items before committing
- Review against all applicable checklists during self-review
During Code Review
- Use checklists as review criteria
- Flag missing items for correction
- Track common violations for team improvement
For Legacy Code
- Prioritize critical sections first
- Focus on data declarations and public interfaces
- Document complex logic before simple code
Common Violations to Watch
Data Declarations
let timeout = 5000;
let timeout = 5000;
Magic Numbers
days = 365
DAYS_IN_YEAR = 365
days = DAYS_IN_YEAR
Global Variables
public static int count;
count++;
public static int g_userCount;
g_userCount++;
Control Structures
for (let i = 0; i < items.length; i++) {
for (let j = i + 1; j < items.length; j++) {
if (items[i] > items[j]) {
}
}
}
for (let i = 0; i < items.length; i++) {
for (let j = i + 1; j < items.length; j++) {
if (items[i] > items[j]) {
swap(items, i, j);
}
}
}