HeadlinesBriefing favicon HeadlinesBriefing.com

Keeping AI‑Generated Code Modular in Start‑ups

DEV Community •
×

Senior engineer Paul, who builds SaaS products at Vybe.build, argues that generic AI assistants such as OpenAI’s ChatGPT and Anthropic’s Claude tend to dump thousands of lines into a single index.js file. In fast‑moving start‑ups that habit creates hidden dependencies, makes refactoring painful, and obscures security impacts.

Paul’s solution is to lock the model into a strict module layout built on Next.js’s App Router, TypeScript, and Vercel. A skeleton under src/__template__ separates api, components, hooks, and types, while shared UI lives in ui. Generating a new feature runs an EJS‑powered script that scaffolds this structure automatically.

To keep AI honest, Paul adds custom ESLint rules that reject routes lacking the required withAuth wrapper and forbid cross‑module imports. When the assistant slips, the linter flags the error, the model corrects itself, and the code stays isolated. This disciplined pipeline turns AI from a lazy code generator into a reliable, modular development partner.