Plan Frontend and Backend Architecture with AI
Plan full-stack architecture with an AI coding agent: define frontend and backend ownership, API contracts, trusted operations, and one verified user workflow.
Start with a workflow, not a framework template
Vaastu is a software architecture skill for AI coding agents. It helps an agent decide who owns behavior, where data is trusted, and which dependencies are allowed. The same reasoning applies to frontend-only tools, backend APIs, full-stack applications, and systems with several clients.
Begin with one user outcome and the existing repository. Record the actor, input, expected result, data owner, permissions, and failure cases. Preserve the current stack unless a requirement justifies changing it. A static page may need no backend; a full-stack framework may host both UI and trusted operations in one application.
Separate responsibilities without forcing separate services
The frontend owns presentation, interaction, form feedback, and local state. Its loader or query owner manages fetched data and reconciliation. Trusted backend operations own authorization, authoritative business rules, and writes that require protected access.
These boundaries describe responsibilities, not a required directory tree. Keep a small operation and its queries together when that is clear. Introduce another application, shared package, or independently deployed service only for a concrete consumer, runtime, security, or operational need.
Define what crosses the boundary
For a connected workflow, agree on input shape, authoritative response fields, stable errors, resource scope, and retry behavior. Static types help developers but do not validate untrusted runtime input. Client validation improves feedback; the trusted operation still enforces permissions and invariants.
Consider an illustrative order flow. The client submits item identifiers and quantities. The backend verifies the actor and resource scope, determines authoritative prices, and commits the required records atomically. The UI uses the confirmed result rather than declaring success before persistence. This is a design example, not a claim that an order system has been built or tested.
Give your agent a concrete architecture request
Install Vaastu in the project and provide the actual workflow, constraints, and acceptance criteria. This proposal-only prompt preserves the current technology choices while making the frontend, backend, and integration decisions explicit.
Read .agents/skills/vaastu/SKILL.md and inspect this repository.
Design the architecture for the workflow described below using the current stack. Identify feature ownership, UI and server state, trusted operations, input/output contracts, authorization, persistence, errors, and retry behavior where applicable.
Justify every proposed application, package, service, and layer. Keep the simplest structure that meets the requirements. Preserve existing routes, behavior, data, and permissions.
Propose one connected implementation slice and its acceptance checks. Do not modify project files yet.
Workflow: [describe the real user outcome]
Constraints: [current stack, deployment, data, and permissions]
Acceptance criteria: [observable success and failure behavior]Verify success, failure, and recovery
Once implementation is authorized, connect only the boundaries that the workflow uses. Exercise valid input, invalid input, denied access, and integration failures. For mutations where duplicates matter, define how a retry after a lost response recovers the original result.
Check ownership and dependency direction alongside behavior. For frontend changes, inspect relevant viewport, keyboard, loading, empty, and error states. For backend changes, verify transactions, permissions, and concurrency against representative persistence when affected. Report source review, mocked tests, connected execution, and deployment as separate evidence.
Apply the same decisions as the system grows
A second client may justify a portable shared contract, while its screens and session integration stay app-owned. A slow or retryable operation may justify a worker. Neither change requires rebuilding every feature around a new template.
Revisit architecture when requirements, measured load, failures, or team ownership change. Vaastu supplies the decision framework; framework-specific documentation supplies the implementation APIs. Use the relevant references instead of assuming one stack's conventions apply everywhere.
Turn system design into a reviewable architecture plan
For a system design request, ask the agent to connect requirements to a concrete request and data flow. Name the actors, application owners, API contracts, storage boundaries, and failure recovery. A short diagram can help explain which component calls which operation and where authoritative data changes.
Record the reason for each significant architecture decision, the alternatives considered, and the condition that would justify revisiting it. A modular design should make the next feature easier to change while keeping dependencies understandable. Verify that claim against the actual workflow rather than judging the plan by its number of services or folders.