AI Joe
← Blog· Engineering Reality

When AI Writes Both Sides of an API in One Sitting

November 5, 2026

Why it matters: AI collapses the gap between writing an endpoint and writing the code that calls it, so accidental dependencies form on day one instead of surfacing years later.

The Details:

  • Field names leak straight out of the database model. Ask an AI to return a user object and it serializes the nearest convenient structure, so internal columns like created_at_utc or a cache flag ride into the JSON payload. A mobile client starts branching on that field within weeks, and now a schema decision is a public promise.

  • Error text becomes a parsed contract. Raw exception strings expose constraint names and file paths, which already leaks your internals. Worse, a consumer somewhere writes a substring check against your wording, and you lose the ability to reword your own error message without breaking a dependency you cannot even see.

  • Sort order turns into an implicit guarantee. Without an explicit ORDER BY, a list endpoint returns rows in whatever order the database happens to produce. Dashboards and job queues quietly assume newest-first, and a later infrastructure change or query planner shift breaks something that was never actually specified.

  • Retry logic rewrites your idempotency guarantees. Backoff wrapped around a flaky downstream call is often correct behavior, but it turns response time into an undocumented range and implies deduplication the code underneath may not actually have. If that call charges a payment, the retry is a promise nobody signed off on.

Bottom Line: Define response shapes, error codes, ordering, and idempotency before any code gets generated, because AI will build exactly what you hand it, whether that is a deliberate contract or whatever internal structure happened to be nearby.

Enjoy this article?

Listen to the Claude Code Conversations radio show or join the community.