A Three-Stage AI-Assisted Pipeline for Web Administration System Development

    This article presents a practical three-stage workflow for using AI coding tools to build web administration systems: document requirements and design first, generate code in controlled steps, and validate the result through automated testing and quality gates. It explains how numbered business rules, incremental code generation, resumable workflows, root-cause analysis, and human review can help small development teams improve both efficiency and software quality.

    1. Background: Development Challenges for Small Teams

    Web administration systems—including back-office operations platforms, internal approval systems, and data management dashboards—are among the most common deliverables for small and mid-sized software teams. These systems typically involve:

    • Rapidly changing business requirements: Logic may need to be revised soon after a feature is released.
    • Limited staffing: One person may be responsible for frontend and backend development, database design, and testing.
    • Manual testing: Without an automation infrastructure, regression testing relies on manual checks, which are time-consuming and prone to missing edge cases.
    • Weak knowledge retention: When design and implementation become disconnected, requirement documents lose their value and maintenance costs continue to rise.

    The underlying issue is that repetitive work consumes time that should be spent on business decisions. A practical solution is to redefine the division of labor between people and tools: developers remain responsible for requirement judgment, architectural trade-offs, and final acceptance, while intelligent coding tools handle mechanical tasks such as documentation, code generation, and test execution.

    This article describes a practical three-stage pipeline based on that approach.

    2. The Overall Approach: A Three-Stage Pipeline

    1. Requirements and Design → Coding and Implementation → Testing and Validation
    2. ↓ ↓ ↓
    3. Documentation first Code generation Self-correcting tests
    4. Numbered business rules + Resumable workflow + Multi-layer quality gates
    5. Human approval

    The three stages are not executed as a one-time linear process. Each stage ends with a human approval checkpoint. Developers review the output before the workflow moves forward. This human-in-the-loop model improves efficiency while preserving a basic quality boundary.

    3. Stage One: Requirements and Design—Documentation First

    Many projects fail when developers ask AI to “generate the system” from a single sentence. In practice, the quality of the design documentation sets the upper limit for the quality of the generated code.

    The output of this stage should include five categories of documentation:

    1. Software requirements specification: Defines the functional scope, roles, core workflows, and constraints.
    2. Use case specifications: Describes the operation path, preconditions, and expected results for each feature.
    3. Database design: Defines table structures, field meanings, indexes, and foreign-key relationships.
    4. API design: Specifies endpoint paths, request and response structures, and error-code conventions.
    5. Menu and permission design: Defines the authorization matrix across roles, menus, and button-level actions.

    A particularly useful technique is to assign IDs to business rules. Extract business constraints into numbered rules, for example:

    1. BR-001: Orders over 10,000 currency units require manager approval.
    2. BR-002: Canceled orders cannot be paid again.

    Numbered business rules become anchors throughout the workflow. During implementation, key logic in the generated code should be annotated with the corresponding rule ID. During testing, each rule ID should be used to construct verification cases.

    This approach provides several benefits:

    • Traceability: Every relevant line of code and test case can be traced back to a specific business requirement.
    • Reviewability: Developers can review rules one by one instead of reading the entire codebase without a clear focus.
    • Regression support: When a rule changes, the affected code and test cases can be identified precisely.

    4. Stage Two: Coding and Implementation—Two Modes and Resumable Workflows

    Using the design documents from Stage One as input, an intelligent coding tool can generate frontend and backend source code as well as database scripts. In practice, the workflow should distinguish between two modes.

    1. Creation Mode

    Creation Mode is intended for new features built from scratch. The generation process is divided into steps:

    1. Step 1: Generate database scripts
    2. Step 2: Generate backend entities and the data access layer
    3. Step 3: Generate the business logic layer with business rule annotations
    4. Step 4: Generate the API layer
    5. Step 5: Generate frontend pages and routes
    6. Step 6: Generate menu and permission configuration

    The purpose of step-by-step generation is to control the size of each change. Every output can be reviewed independently, and if an error occurs, only the relevant part needs to be rolled back instead of rebuilding the entire module.

    2. Modification Mode

    Modification Mode is intended for changes to an existing system. Full regeneration should be avoided because it may destabilize working code. Instead, the tool should first analyze the impact of the requested change and produce a list of affected files. It can then apply incremental updates.

    The key constraint is to modify only the files on the affected-file list and leave all other code unchanged.

    3. Resumable Generation

    Long generation tasks may stop because of network interruptions, context limits, or other execution issues. To avoid restarting from the beginning, the workflow should support persistent progress tracking. The system records completed steps and their outputs, allowing generation to resume from the last checkpoint rather than consuming resources on repeated work.

    5. Stage Three: Testing and Validation—Self-Correction and Quality Gates

    1. Self-Correcting Tests

    The core testing mechanism is an automated cycle of failure, analysis, repair, and retesting:

    1. Run tests → Failure → 5 Whys root-cause analysis → Generate a patch → Run tests again

    The 5 Whys method is especially important. Directly changing the line that produced an error often treats only the symptom. Repeatedly asking why can reveal the actual root cause:

    1. Why is the field empty?
    2. → The service layer does not validate it.
    3. → The entry-point parameters are not being intercepted or validated.

    Root-cause analysis reduces the chance of the same issue recurring. The loop should still have a maximum number of iterations. Once that threshold is exceeded, the task should be handed over for human intervention to prevent an endless cycle.

    2. Four Layers of Quality Gates

    Automatically generated code should pass multiple checks before it reaches final human review:

    1. Compilation gate: The project compiles successfully without syntax errors.
    2. Static analysis gate: The code follows applicable standards and does not contain obvious code smells.
    3. Unit testing gate: Core business rules, identified by their BR IDs, are covered individually.
    4. Integration validation gate: Critical workflows can run successfully from end to end.

    3. Human Approval

    Human review remains necessary for checking edge cases and examining security-sensitive logic, especially permission controls. AI can significantly reduce mechanical work, but people remain ultimately responsible for business correctness.

    6. Conclusion

    The value of this three-stage pipeline is not simply that AI can write code faster. Its real value is that it establishes a clear human-machine collaboration model:

    • Documentation first makes knowledge easier to preserve.
    • Numbered business rules make logic traceable.
    • Step-by-step generation keeps changes under control.
    • Self-correcting tests provide a repeatable quality process.

    For teams with limited resources, this workflow offers a practical way to balance development efficiency with software quality.