agents/rules/quality-simplicity.md
Impact: HIGH
The goal is code that is easy to read and understand quickly, not elegant complexity. Simple systems reduce the cognitive load for every engineer.
Questions to ask yourself:
Incorrect (clever but hard to understand):
// Clever one-liner that's hard to parse
const result = data.reduce((a, b) => ({...a, [b.id]: (a[b.id] || []).concat(b)}), {});
Correct (clear and readable):
// Clear, step-by-step approach
const groupedById: Record<string, Item[]> = {};
for (const item of data) {
if (!groupedById[item.id]) {
groupedById[item.id] = [];
}
groupedById[item.id].push(item);
}
Important note: Simple doesn't mean lacking in features. Just because our goal is to create simple systems, this doesn't mean they should feel anemic and lacking obvious functionality.
Reference: Cal.com Engineering Blog