r/HCAI_Router • u/BakeNo3362 • 3d ago
A four-stage workflow prompt to keep AI coding agents from skipping tests and hiding fixes
One recurring headache with AI-assisted coding is getting a large block of code that looks tidy, fails on the first local run, and then turns into a blind patch loop where you lose track of what changed.
I adapted a structured development workflow (originally from an open community workflow template) into a portable instruction set that works across coding agents and standard chat interfaces. Instead of asking a model to "build X," it separates small and medium engineering tasks into four explicit stages: implementation, testing, fixing, and regression checks.
### How the workflow runs
The core rule is simple: do not jump straight to a final answer without a runnable baseline and a written audit trail.
- **Stage 1 (Runnable build):** Produce a working baseline first rather than an abstract scaffold.
- **Stage 2 (Test checklist):** Define concrete checks covering core flows and edge cases.
- **Stage 3 (Logged fixes):** When a check fails, record the symptom, root cause, and exact change before moving on.
- **Stage 4 (Regression check):** Re-verify earlier passing behavior after fixes so one patch does not quietly break another feature.
For a quick demonstration, you can run it on a small scoped build like a React + TypeScript todo app with CRUD operations and localStorage, or scale the same stages to a multi-part task like a user management module (backend, frontend, automated tests, fixes, and regression).
Act as my development assistant. Build [a React + TypeScript todo app with CRUD and localStorage].
Work strictly in four stages:
Implementation: deliver a runnable version first with clear file paths and run commands.
Testing: write a concrete test checklist covering core behavior and edge cases. If you have workspace tool access, execute the tests.
Fixing: for any failure, log the error, root cause, and exact fix before applying the patch.
Regression: re-run previous checks to confirm no regressions were introduced.
Before finishing, verify that every checklist item either passes or is explicitly flagged as a blocker for manual review. Summarize all fixes in a short change log ready for human code review and security checks.
### Conditions and limits
- **Execution depends on your tool:** In a coding agent with local file and shell access (such as Claude Code), the model can actually run tests and iterate through fixes. In a regular web chat, the same instructions will only return code, a test checklist, and a template for logging fixes—it cannot run your local test suite on its own.
- **Human review is still mandatory:** The workflow is designed to hand off clean diffs and fix logs to a developer, not to replace manual code review or security checks.
- **Best fit:** Small to medium scoped tasks. Large architecture changes still need manual decomposition first.
### Optional files
Disclosure: I help run HCAI Router. If you want the standalone instruction files (SKILL.md, AGENTS.md, quickstart prompt, and a 2-page PDF reference card), they are packaged here: https://drive.google.com/file/d/1z_sflUL0GWgTTU1FxU1J75bWrPzI7FJ9/view?usp=drive_link
though everything needed to try the workflow is already in the prompt above.
When you use a coding agent on real repositories, what guardrails or logging rules have actually helped you trust its bug fixes before merging?
