Clean Codejs Comments

Commenting patterns that improve readability and maintainability.

damianwrooby 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 commit 6b37b01cc1

Frequently asked questions

npx get-skill add damianwrooby/clean-codejs-comments