Inline comments

From berkcangumusisik/claude-code-practices · View interactive version

Inline comments is an AI agent skill from the GitHub repository berkcangumusisik/claude-code-practices. Adds inline comments to complex or non-obvious code sections

How to use this skill

Skill file

Add Inline Comments

File: $1

  1. Read the file. Identify sections that are non-obvious:
  1. Write comments that explain the why, not the what:

```ts

// ❌ Bad: increment counter

count++

// ✅ Good: offset by 1 because API uses 1-based page numbering

page = requestedPage + 1

```

  1. For workarounds, use this format:

```ts

// HACK: Safari doesn't support X, so we Y instead

// TODO: remove when Safari 18 becomes baseline

```

  1. Don't comment obvious code. If code needs a comment to be understood, also consider if it should be refactored instead.
  1. Apply comments. Show before/after diff.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.