Commenting Intent

Explain code intent and non-obvious decisions in comments.

41|27|Updated Oct 6, 2025
One-click install
npx skills add https://github.com/obra/clank --skill commenting-intent-obra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Commenting Intent
Source: https://github.com/obra/clank/tree/main/skills/coding/commenting-intent
Command: npx skills add https://github.com/obra/clank --skill commenting-intent-obra

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates over-commenting and unhelpful comments that just restate code mechanics, ensuring your comments provide genuine value by explaining intent, decisions, and non-obvious reasoning.

Core Features & Use Cases

  • Intent-Focused Commenting: Learn to comment on why code exists rather than what it does
  • Decision Documentation: Explain non-obvious choices, algorithm trade-offs, and business rule origins
  • Use Case: When reviewing a complex algorithm implementation, use this Skill to identify where to add comments explaining why you chose this specific approach over alternatives.

Quick Start

Use the Commenting Intent skill to review this code and suggest where to add comments explaining the reasoning behind implementation choices.

Frequently Asked Questions about Commenting Intent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write code comments that explain intent instead of restating what the code does?

Intent-focused comments explain why code exists and the reasoning behind design choices rather than describing mechanics. Document non-obvious decisions, trade-offs, and the business logic that justifies the implementation, helping future maintainers understand the original reasoning.

What should I comment on when reviewing a complex algorithm?

Comment on why you selected a specific algorithm over alternatives, the trade-offs involved, and non-obvious implementation choices. Explain constraints, performance considerations, or business rules that drove the decision rather than restating the algorithm's steps.

How do I document magic numbers and unexplained constants in code?

Add comments explaining the origin and purpose of magic numbers—capture the business rule, formula derivation, or constraint they represent. This preserves context for maintainers and prevents future developers from changing values without understanding their significance.

Why is commenting just the code mechanics unhelpful for code maintenance?

Mechanistic comments duplicate what the code already shows and become stale as code evolves. Comments explaining intent, decisions, and reasoning remain valuable guides for maintaining, debugging, and extending code across different contexts and team members.

Can I use this approach when writing comments across different programming languages?

Yes, intent-focused commenting applies across all languages. The principle—capture why code exists, not what it does—remains constant whether you're writing Python, Java, JavaScript, or any other language, ensuring consistent documentation standards.