Readable variable names
Use readable variable names; avoid single-letter or cryptic names
Source: .agents/rules/readable-variable-names.mdc
Metadata
- alwaysApply: true
Content
Readable variable names
- Prefer clear, readable names over short or cryptic ones.
- Avoid single-letter or minimal names (e.g.
c,x,iin non-loop index cases) when a short descriptive name is better (e.g.city,item,user). - Keep names concise but meaningful: not too long, not too vague.
- In callbacks (e.g.
.map(x => ...)), use the singular of the collection (e.g.cityforcities,itemforitems,userforusers) unless a more specific name is clearer.
// ✅ Prefer
cities.map((city) => `${city.name} (${city.country_name})`);
items.filter((item) => item.active);
// ❌ Avoid when a better name is obvious
cities.map((c) => `${c.name} (${c.country_name})`);
items.filter((x) => x.active);