How I Use AI Through a Repeatable Workflow to Stop Fixing the Same Mistakes

Fazm Team··2 min read

A Repeatable AI Workflow to Stop Fixing the Same Mistakes

The same bugs kept appearing. Not identical bugs - the same categories of bugs. Missing error handling. Incomplete state management. Edge cases that only surface with real data. The fix was not better prompts. It was splitting the work into phases.

Phase Splitting

Instead of asking an AI agent to "build feature X," split the work into three distinct phases. Phase 1: planning. Write a spec that describes inputs, outputs, error cases, and constraints. Phase 2: implementation. The agent builds against the spec. Phase 3: review. Compare the implementation against the spec and check for gaps.

Each phase has a different prompt, a different success criterion, and ideally a different context. The planning phase does not include implementation details. The implementation phase does not re-litigate design decisions. The review phase checks reality against the plan.

Why Specs Prevent Recurring Errors

Most recurring errors come from implicit requirements. "Handle errors" is implicit. "Return a 400 status with a JSON error body containing error_code and message fields, log the error with the request ID, and do not leak stack traces" is explicit.

Writing the spec forces you to make implicit requirements explicit before any code is written. The agent cannot miss a requirement that is written down in its context. It can still implement it incorrectly, but that is what the review phase catches.

The Repeatable Part

The power is in repeatability. Once you have a spec template, every feature goes through the same process. The spec template includes sections for: inputs/outputs, error handling, state management, edge cases, and testing requirements.

Over time, your spec template grows to include every category of bug you have encountered. Each past mistake becomes a checkbox in future specs. The AI agent gets better not because the model improves, but because the spec it works from gets more complete.

Stop debugging the same mistakes. Start specifying against them.

Fazm is an open source macOS AI agent. Open source on GitHub.

More on This Topic

Related Posts