ALD Workflow

ALD is a tight loop: define contracts → generate tests → approve intent → generate implementations → refactor under constraints.

The Six-Step Workflow

  1. Architect defines contracts DTOs + role-based interfaces, scoped to a single responsibility.
    • Define DTOs that represent domain concepts (not database tables)
    • Design interfaces with single responsibilities
    • Name by what the interface does, not where it lives
    • Document assumptions and invariants
  2. AI proposes contract tests Happy paths, edge cases, negative cases; assumptions documented.
    • Generate tests that exercise all methods
    • Include happy paths and expected edge cases
    • Test error conditions and invalid inputs
    • Document assumptions in test names and comments
  3. Architect approves behavior Review tests to confirm the system's intent and constraints.
    • Read tests as specifications
    • Verify all scenarios are covered
    • Check that error handling matches expectations
    • Approve or request changes before implementation
  4. AI generates implementations Concrete classes, dependency injection, no I/O in core logic.
    • Implement interfaces with clean, readable code
    • Use dependency injection for all dependencies
    • Keep I/O at the edges (no database/HTTP in core)
    • Follow SOLID principles
  5. Refactor & harden Improve SOLID, pattern fit, readability; keep contracts stable.
    • Improve code clarity without changing behavior
    • Strengthen SOLID adherence
    • Verify pattern usage is appropriate
    • Keep public contracts unchanged
  6. Lock the contract Interfaces + tests become the stable boundary; evolve through additive change.
    • Treat interfaces as immutable once approved
    • Add new methods rather than changing existing ones
    • Version interfaces if breaking changes are required
    • Implementation can change freely as long as tests pass

The ALD Loop

Key insight: The workflow ensures that intent (tests) is approved before implementation (code). This prevents AI from "inventing" behavior that wasn't specified.

Workflow Principles

Contracts first, always

Never write implementation before defining the interface and tests.

Tests = approval gate

Architect must approve tests before implementation proceeds.

Implementations are disposable

As long as tests pass, implementation can be rewritten freely.

Refactoring preserves contracts

Public interfaces stay stable; internal structure can evolve.