self-explanatory-code-commenting
Guidance for writing code that explains itself, with fewer comments. Examples are in JavaScript; the rules apply to any language with comments.
- Kind
- Rules
- Works with
- GitHub Copilot
- Languages
- TypeScript / JavaScript
- Source
- Awesome Copilot @ d85f762d6e52
- Path
- instructions/self-explanatory-code-commenting.instructions.md
- Jobs
- Implementation
Credit
- Made by
- github
- Original
- github.com/github/awesome-copilot/blob/d85f762d6e521abf5fe167…
- License
- MIT
Listed by Skill Manifest; not made by us.
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
- Adds
- Text to merge into your CLAUDE.md or AGENTS.md (no new files)
- Runs scripts
- None found
- Uses the network
- Yes
- HTTP client calls
- Needs secrets
- None found
- Source revision
- d85f762d6e52
- Licence
- MIT
- Last activity
- 25 Nov 2026
- Source changed after the scan
- Yes
- Last push 25 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
- Review
- Reviewed
Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.
# Self-explanatory Code Commenting Instructions
## Core Principle
**Write code that speaks for itself. Comment only when necessary to explain WHY, not WHAT.**
We do not need comments most of the time.
## Commenting Guidelines
### ❌ AVOID These Comment Types
**Obvious Comments**
```javascript
// Bad: States the obvious
let counter = 0; // Initialize counter to zero
counter++; // Increment counter by one
```
**Redundant Comments**
```javascript
// Bad: Comment repeats the code
function getUserName() {
return user.name; // Return the user's name
}
```
**Outdated Comments**
```javascript
// Bad: Comment doesn't match the code
// Calculate tax at 5% rate
const tax = price * 0.08; // Actually 8%
```
### ✅ WRITE These Comment Types
**Complex Business Logic**
```javascript
// Good: Explains WHY this specific calculation
// Apply progressive tax brackets: 10% up to 10k, 20% above
const tax = calculateProgressiveTax(income, [0.10, 0.20], [10000]);
```
**Non-obvious Algorithms**
```javascript
// Good: Explains the algorithm choice
// Using Floyd-Warshall for all-pairs shortest paths
// because we need distances between all nodes
for (let k = 0; k < vertices; k++) {
…