line_compressionTier 1 · 70% confidence

ai-agents-line-compression-verbose-expressions-like-multi-statement-condition-ebe6d3cc

agent: ai_agents

When does this happen?

IF Verbose expressions like multi-statement conditionals, function declarations, string concatenation, and multi-line assignments inflate token count.

How others solved it

THEN Use ternaries over if/else, short-circuit evaluation, destructuring, template literals, arrow functions with implicit returns, optional chaining, nullish coalescing, and combine related declarations on one line (e.g., `const a=1,b=2,c=3`).

// Before
if (userName === null) {
  return defaultName;
} else {
  return userName;
}

// After
return n ?? defaultName

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics