AI-Assisted Web Development: A Three-Stage Workflow in Practice
This article describes a practical three-stage workflow for integrating AI coding tools into web management system development. The pipeline separates requirements and design, code generation, and test verification so that assistants handle structured and repetitive work while human developers own business rules, design review, and final quality decisions. It covers the pipeline design, two code generation modes, resumable execution, self-looping tests with quality gates, and the project structure needed for adoption.
Background and Problem Definition
Small teams building web management systems often face a structural contradiction: they have limited developers, while business rules change frequently as market conditions shift. Fast feature iterations and dense requirement changes make the traditional “hand-written code plus manual testing” model difficult to sustain. The problem shows up in three areas:
- High share of repetitive work: CRUD endpoints, form validation, permission menus, database scripts, and other template-like code consume significant time.
- Unstable test coverage: Manual testing relies on experience. Exception paths and boundary conditions are easy to miss, and regression cost grows over time.
- Frequent context switching: Requirement understanding, coding, debugging, and verification alternate constantly, making it hard for developers to maintain flow.
A practical response is to split development into clearly defined stages. AI coding tools take on structured, repetitive generation and verification work, while human developers focus on business rule definition, design review, and final quality confirmation. This article discusses the design motivation, execution details, and engineering considerations of a three-stage pipeline.
Pipeline Overview
The overall process can be abstracted as three connected stages:
Requirements & Design → Coding Implementation → Test & Verification↓ ↓ ↓Documentation first Code generation Self-looping testsCheckpoint/resume Quality gatesHuman confirmation Root-cause knowledge base
The stages are not a one-way waterfall. They form a closed loop with feedback: problems exposed during testing trigger design clarification or code fixes, and the fixes re-enter verification until the exit conditions are met. The key value of this structure is the separation of judgment from execution — business rules are defined and numbered by humans, while tools generate, check, and iterate according to those rules.
Stage 1: Requirements and Design — Documentation First
The goal of the first stage is not to write code, but to produce a complete design document that can support later review and testing. The document should cover at least the following:
- Requirement specification: functional goals, role definitions, and business processes.
- Use-case specification: step descriptions for the main success scenario and extension scenarios.
- Database design: table structures, field types, constraints, and index strategy.
- API design: paths, methods, request/response structures, and error code conventions.
- Menu and permission design: function entries and role authorization matrix.
One key practice is numbering business rules. Each business constraint is defined as a referenceable identifier, for example:
BR-001: An order amount over the threshold must trigger second-level approval.BR-002: After a user's role changes, cached permissions must be invalidated on the next request.BR-003: The number of failed login attempts for the same account within one calendar day must not exceed N.
Numbering creates traceability. Code review can directly ask whether a change satisfies BR-002. Test cases can be organized by rule number. Defect reports can point to the specific rule that was violated. Compared with natural-language descriptions, numbered rules significantly reduce communication ambiguity between stages.
AI tools can generate an initial draft of the design document from requirement descriptions, and then human reviewers correct and refine it. The review step cannot be skipped. Ambiguity that is not resolved in this stage will be amplified into rework during coding and testing.
Stage 2: Coding Implementation — Two Modes and Resumable Progress
The second stage uses the design document as its sole input and produces frontend source code, backend source code, and database scripts. To fit different development scenarios, the workflow distinguishes two modes:
Creation Mode — new modules. Generate a complete module from scratch in a fixed sequence, for example:
entity layer → data access layer → service layer → API layer → frontend pages → integration scripts
Step-by-step decomposition makes each output independently checkable. It avoids the problem of generating a large amount of code at once and then struggling to locate defects.
Modification Mode — existing changes. For incremental modifications to an existing module, the tool first analyzes the affected file scope and then applies minimal changes. This mode is especially important for small teams, because most post-launch work is modification rather than greenfield development. Blind rewrites create unnecessary regression risk.
Both modes support resumable progress. Execution state is stored in a structured format, so after an interruption — whether paused intentionally or caused by an error — work can continue from the last completed step without regenerating everything. A common implementation is to maintain a progress manifest that records the input summary, output file path, and completion status for each step. When resuming, the workflow first checks whether the inputs have changed, then decides whether to skip or redo the step.
Human confirmation checkpoints remain in place during coding. Key files — especially those involving permissions, amount calculations, or data deletion logic — must be reviewed by a human before being written into the codebase. The tool’s role is to improve efficiency, not to replace responsibility.
Stage 3: Test and Verification — Self-Loop and Quality Gates
The third stage is the most automated part of the workflow and often delivers the greatest benefit. Its core mechanism is a self-looping test cycle:
Run tests → Failed? → 5-Why root-cause analysis → Generate fix → Re-run tests → Passed? → Next quality gate
The “5-Why” step means asking why a failure happened repeatedly until the root cause is found, rather than stopping at the surface symptom. For example, if a test fails because of a null pointer exception, the chain might be:
- Why is the value null? → The upstream query returned no row.
- Why did the query return no row? → A boundary condition was not handled.
- Why was the boundary condition not handled? → The design document did not cover that boundary.
These questioning chains are recorded and gradually accumulated into a team knowledge base. Later, similar issues can be looked up directly.
The quality gate uses a four-layer progressive structure. Failure at any layer stops the flow and returns to the fix loop:
- Compilation check: backend code compiles successfully, ensuring syntax and dependencies are complete.
- Unit and integration tests: all automated test suites pass.
- Frontend type checks: the type system reports no errors, catching interface contract mismatches.
- Frontend production build: a production build succeeds, ensuring the output is deployable.
Test case design follows a three-coverage principle: normal scenarios, exception scenarios, and boundary scenarios. Boundary cases are the easiest for manual testing to miss, so the workflow sets a hard rule: when missing boundary tests are detected, the loop pauses and requires supplementation, rather than continuing with a coverage gap. This converts test completeness from a subjective judgment into an executable process condition.
Workflow Directory Structure
A key part of engineering adoption is standardizing rule files and output directories. A typical structure looks like this:
project/├── rules/ # Rule definitions: business rule IDs, coding standards│ ├── br-rules.md│ └── coding-standards.md├── design/ # Stage 1 outputs│ ├── requirements.md│ ├── use-cases.md│ ├── db-schema.md│ └── api-spec.md├── pipeline/ # Pipeline state│ ├── progress.json # Checkpoint/resume progress record│ └── qa-log/ # 5-Why chains and test records├── src/ # Stage 2 outputs: frontend/backend source└── scripts/ # Database scripts and build scripts
AI tools can generate the initial directory structure and rule files, but human ownership of the rules and manual test oversight must remain. The rule files act as the contract for the whole pipeline. If the rules themselves are wrong, all subsequent automation will amplify the error.
Applicability Boundaries and Practical Advice
This workflow is not universal. Its benefits and constraints are summarized below:
- Good fit: projects with clear business rules, management-system-oriented products, frequent iterations, and controllable change scope per iteration.
- Not a good fit: interaction-heavy innovation, algorithm-intensive modules, or exploratory requirements without verifiable acceptance criteria.
- Necessary precondition: design document quality sets the upper bound, so human review cannot be skipped. Quality gate thresholds should be adjusted as the project matures.
- Risk control: high-risk changes should retain mandatory human review. The root-cause knowledge base needs periodic cleanup to avoid noise accumulation.
In summary, the essence of the three-stage pipeline is using structured process to buy determinism: give repetitive work to tools, and keep judgment with people. For small teams with limited staffing, this division of labor can improve delivery cadence and the quality floor without significantly increasing management overhead.
