Engineering with AI
An Architect’s Framework to Build Applications with AI Tooling
Artificial Intelligence is rapidly becoming a core tool in the software engineering workflow. For architects and senior engineers, AI is no longer just a code generator. It is a design assistant, reviewer, documentation engine, and even a component factory.
Used correctly, AI can accelerate the entire delivery lifecycle — from vague ideas to production-ready systems — while still maintaining architectural rigor.
This article presents a practical, repeatable framework for how an architect or engineer can use AI to build an application from the ground up based on my experience.
The Architect’s AI-Driven Delivery Framework
At a high level, the workflow looks like this:
- Requirement discovery and refinement
- High-level architecture definition
- Architectural decision making (ADRs)
- Contract and interface definition
- Diagram generation and validation
- Guided development with architectural constraints
- Full component generation with AI
- Test generation and verification
Each phase uses AI in a specific, controlled manner.
1) Requirement Gathering and Refinement
Most projects do not begin with clean, structured requirements. They usually start with:
- Vague product ideas
- Partial user stories
- Business expectations without technical clarity
This is where AI becomes extremely valuable.
Process
- Provide the initial problem statement to an AI tool.
- Ask it to:
- Extract user stories
- Identify actors
- Define functional and non-functional requirements
- Iterate multiple times to refine edge cases, clarify assumptions and identify missing constraints
Outcome
After a few iterations, you should have:
- Clear functional requirements
- Non-functional requirements (NFRs)
- High-level product components
- Major user journeys
At this stage, the architect’s role is to validate feasibility, constraints, and trade-offs rather than blindly accepting AI output.
2) Identify High-Level Architectural Components
Once the requirements are stable, define:
- Core system components
- Responsibilities of each component
- Communication patterns
- Bounded contexts
Architectural Responsibilities
The architect should:
- Apply domain-driven design principles
- Separate concerns into clear services or modules
- Define system boundaries
- Avoid premature technical decisions
AI can assist by:
- Proposing component breakdowns
- Suggesting architectural patterns
- Highlighting coupling risks
However, final decisions must be guided by architectural principles, not convenience.
3) Make Explicit Architectural Decisions (ADRs)
Every system contains trade-offs. These decisions should be:
- Documented
- Justified
- Traceable
Examples:
- Kafka vs RabbitMQ
- REST vs gRPC
- Monolith vs microservices
- Event-driven vs request-driven design
AI’s Role in ADRs
AI can:
- Generate ADR templates
- Compare options with pros and cons
- Highlight operational implications
- Suggest scalability or cost trade-offs
The architect should:
- Validate assumptions
- Align with business constraints
- Finalise the ADR
4) Validate Components Against SOLID Principles
Before development begins, each component should be reviewed against core engineering principles:
- Single Responsibility
- Open/Closed
- Liskov Substitution
- Interface Segregation
- Dependency Inversion
AI can:
- Review class or component designs
- Suggest refactors
- Identify violations of SOLID principles
This ensures the system is maintainable and extensible before coding begins.
5) Define Contracts Between Components
For any components communicating over APIs:
- Define clear API contracts
- Establish schemas
- Version interfaces
This prevents:
- Hidden coupling
- Integration surprises
- Breaking changes
AI Assistance
AI can:
- Generate OpenAPI specifications
- Produce request/response models
- Suggest error-handling patterns
- Create example payloads
This is especially valuable in distributed or event-driven systems.
6) Decide the Technology Stack
Each component may require a different stack based on:
- Performance requirements
- Team expertise
- Operational constraints
- Integration needs
Examples:
- TypeScript for frontend
- Quarkus or Spring Boot for backend
- Kafka for event streaming
- PostgreSQL for transactional storage
AI can:
- Suggest appropriate stacks
- Compare technology trade-offs
- Estimate operational complexity
The architect must ensure alignment with:
- Platform standards
- Team capabilities
- Long-term maintenance strategy
7) Use AI for Diagrams and Technical Artifacts
Once architecture is defined, AI becomes a powerful documentation generator.
AI-Generated Artefacts
You can use AI to produce:
- C4 container diagrams
- Component diagrams
- Sequence diagrams
- Deployment diagrams
- OpenAPI specifications
This reduces:
- Manual diagram effort
- Documentation drift
- Inconsistent technical descriptions
8) Guided Development with Architectural Constraints
During implementation, the architect should NOT simply ask AI:
“Generate the entire application.”
Instead, guide development using constraints and principles.
Recommended Approach
For each component:
Get Charith Fernando’s stories in your inbox
Join Medium for free to get updates from this writer.
Provide:
- Clear responsibility
- Interface definitions
- Architectural constraints
Instruct AI to:
- Generate the component
- Follow specific patterns
- Respect defined contracts
Example constraints:
- Hexagonal architecture
- Stateless services
- Domain-driven design boundaries
- Event-driven communication
This ensures consistency across the system.
9) AI as a Deterministic Component Generator
Once the architecture, contracts, and constraints are defined, AI moves beyond being a coding assistant.
It becomes a deterministic component generator.
In this model:
- Architecture defines the system shape
- Contracts define component boundaries
- Tests define behaviour
- AI generates the implementation
Preconditions for Full Component Generation
1. Clear Architectural Boundaries
From the C4 model:
- Containers are defined
- Components have clear responsibilities
- Communication paths are known
Without this clarity, AI will produce tightly coupled systems.
2. Explicit Contracts
Each component must have:
- OpenAPI specifications (for REST)
- Event schemas (for messaging)
- DTO definitions
- Versioning strategy
This prevents AI from “guessing” interfaces.
3. Enforced Architectural Principles
Before generation, define:
- Architectural style (hexagonal, layered, clean)
- Dependency direction
- Error-handling patterns
- Logging and observability standards
- Package or module structure
4. Mandatory Unit Tests as a Validation Layer
If AI generates:
- A component
- Along with meaningful unit tests
- Covering domain logic and edge cases
Then tests become:
- A validation mechanism
- A behavioural contract
- A safety net for integration
In this model:
- AI writes the component
- AI writes the tests
If tests pass and quality gates are met, the component is considered valid.
The Architect’s Role in an AI-Driven Workflow
The architect or engineers are no longer:
- Designing every class
- Reviewing every line of code
Instead, they focuses on:
System Shape
- C4 container structure
- Bounded contexts
- Data ownership
Contracts and Interfaces
- OpenAPI definitions
- Event schemas
- Versioning strategies
Architectural Constraints
- Technology stack
- Design patterns
- Observability standards
- Security models
Quality Gates
- Unit test coverage thresholds
- Static analysis rules
- Architecture tests
- Contract tests
With these in place, AI becomes a repeatable component factory.
The Component Factory Workflow
- Define architecture
- Define contracts
- Define constraints
- Generate components with AI
- Validate in CI
Example prompt:
Generate a Quarkus service for the Payment component.
Follow hexagonal architecture.
Implement the OpenAPI spec below.
Include unit tests for all domain logic.
Generate test data for contracts and isolate the repository layer to be implemented as the next step.
If the component passes CI, it becomes part of the system.
Then you could continue with the next steps.
A Simple Repeatable Template
You can apply this to almost any project:
- Refine requirements with AI
- Define high-level architecture
- Write ADRs for key decisions
- Define service contracts
- Generate diagrams
- Implement components with constraints
- Generate full components using AI
- Validate through tests and CI
Final Thoughts
For architects, AI is not just a coding tool — it is a system design accelerator and a component factory.
When used within a structured framework, it:
- Reduces design time
- Improves documentation quality
- Enforces engineering principles
- Enables rapid, consistent component generation
- Speeds up delivery without sacrificing rigor
The architect’s role evolves to:
“Define system shape, contracts, and quality gates — then guide AI to implement it.”
That is the real power of engineering with AI.
Ultimately, when containers and components have clear responsibilities and well-defined boundaries, AI changes how we think about implementation. Components become replaceable units rather than permanent artifacts. We can generate fine-grained components, validate them through tests, and if one is not fit for purpose, we build a better one. The architecture evolves through iteration, not large rewrites.
Although this article refers to architects, that is simply the perspective it was written from. In practice, the same framework can be used by anyone involved in building software — architects, engineering leads, product leads, or individual engineers. The principles remain the same: define clear boundaries, establish contracts, and let AI accelerate the path from idea to working components.








