← Prompts
System / Understand Copilot Instructions Collection
Guidelines for GitHub Copilot to write comments to achieve self-explanatory code with less comments
Guidelines for GitHub Copilot to write comments to achieve self-explanatory code with less comments. Examples are in JavaScript but it should work on any language that has comments.
# 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
}
```
Sign in to view the full prompt.
Sign InClassification
System Behavioral rules defining AI identity and persona
System Understand
Explain or analyzeScope Project
This codebase Manual Manually placed / Persistent