Clean Codejs Comments

Commenting patterns that improve readability and maintainability.

damianwrooby 6b37b01 520 B Updated

File contents

Clean Code JavaScript – Comment Patterns

Table of Contents

  • When to Comment
  • When Not to Comment
  • Examples

When to Comment

  • Explain why, not what
  • Document complex business rules

When Not to Comment

  • Obvious code
  • Outdated explanations

Examples

// ❌ Bad
// Increment i by 1
i++;

// ✅ Good
// Retry once to handle flaky network condition
retryRequest();

damianwrooby/javascript-clean-code-skills/tree/main/skills/clean-codejs-comments commit 6b37b01cc1

Frequently asked questions

npx skillmds@latest add damianwrooby/clean-codejs-comments