Fix codebase structure before asking AI agents to write tests, says engineer
arpit_bhayani · x · 2026-11-02
Arpit Bhayani shares a practical tip: restructure your codebase before asking coding agents to write tests — he claims this improves test quality more than any prompt tweak.
- With clear conventions, the model knows where logic lives and its dependencies, so it writes focused per-layer tests, mocks the right boundaries, and covers more branches on the first pass
- Messy code (business logic in handlers, global state, functions doing five things) yields brittle tests or tests that pass without verifying much
- Order matters: fix structure first, or have the LLM follow one from the start, then ask for tests
More from coding & agent
- spaCy makers launch free Solo plan for Ellf, an AI agent for NLP engineering — _inesmontani · 2026-11-02
- Ellf launches free Solo plan for solo developers working locally — _inesmontani · 2026-11-02
- DeepSeek Harness launches Creator Mode to turn ideas into plugins — CurieuxExplorer · 2026-11-02
- HF engineer's agent hits 99.7% storage savings on Parquet edits in DuckDB via content-defined chunking — lhoestq · 2026-11-02
- Dev rebuilds Super Auto Pets 1:1 in Rust to train a Stockfish-like RL god — jaivin · 2026-11-02
- Nine hand-drawn statecharts go viral, each verified with a statechart skill — DavidKPiano · 2026-11-02