Developer Tools

Better AI Instructions Mean Cheaper Coding Help

Better AI Instructions Mean Cheaper Coding Help

⚡Want AI to write better code for less money? This changes how you talk to it.

Deep Dive

LLM-based coding agents generate complete software systems from high-level descriptions, yet little is known about how the format of architecture specifications affects the quality of generated code or whether this effect depends on model capability. We present a controlled experiment comparing five informationally equivalent specification formats (informal prose, Mermaid diagrams with constraints and ADRs, OpenAPI, C4/Structurizr DSL, and TypeScript interface contracts with ArchUnit-style rules) across six models from three vendor families (Anthropic Claude, OpenAI GPT, Google Gemini). Across 90 multi-turn agent trials, specification format shows a strong format x model interaction.

On the strongest models (Sonnet 4.6, GPT-5), format barely matters (quality spread 0.17-0.92). On weaker models, format produces spreads of 0.83-2.42 points, with code-proximate formats (OpenAPI, TypeScript contracts) recovering most of the capability gap. Mid-tier models can consume more tokens than frontier models for worse output when they enter compilation debugging loops that stronger models avoid.

Self-validation rates collapse from 100% (Sonnet) to 0% (Gemini Flash) across the capability spectrum. TypeScript contracts triple API route coverage for the weakest model (33% to 100%). Structured architecture specifications serve as a capability equalizer, with value inversely proportional to model strength and the largest returns for cost-optimized deployments.

Key Points
  • Clear, structured instructions (like OpenAPI or TypeScript) help weaker AI models write better code—sometimes as well as stronger ones.
  • Using these formats could cut AI coding costs by up to two-thirds for businesses.
  • You’ll need to learn new ways to describe software designs, but it’s worth it for better results.

Why It Matters

It could save your company money on AI coding tools while making them more reliable—even for non-experts.

📬 Get the top 10 AI stories daily