Canonical page: https://get-vaastu.vercel.app/docs

# Architecture Specifications & Agent Protocol

Use Vaastu to plan and review software architecture across frontend, backend, and full-stack projects. Adapt ownership, dependencies, trusted operations, and verification to the actual requirements and current stack.

## Use Vaastu for small and large projects

Use the same skill for small and large projects. Scale planning and verification to the task and its risks.

1. Install from your project root and select your coding agent.
2. Describe the outcome, existing code, constraints, scope and acceptance criteria. Ask the agent to read the installed SKILL.md.
3. Use the short prompt for focused work or the full-project template for substantial builds. Say whether you want a proposal or implementation.

### npm

```sh
npx skills add KOUSHIKG04/scalable-architecture-skill --skill vaastu
```

### pnpm

```sh
pnpm dlx skills add KOUSHIKG04/scalable-architecture-skill --skill vaastu
```

### bun

```sh
bunx skills add KOUSHIKG04/scalable-architecture-skill --skill vaastu
```

### yarn

```sh
yarn dlx skills add KOUSHIKG04/scalable-architecture-skill --skill vaastu
```

Yarn requires version 2 or later for yarn dlx. With Yarn Classic (1.x), use the npm / npx command.

### Small project: a personal expense tracker

One existing web app, browser-local persistence and a focused workflow. Keep the structure local; add no backend or workspace packages without a requirement.

```text
Read .agents/skills/vaastu/SKILL.md and apply the relevant guidance to this existing web app.

Implement a personal expense tracker with add, edit and delete actions, a running total, and browser-local persistence. Reuse the current UI and project structure. No accounts, backend service or multi-app workspace are needed for this task.

Acceptance criteria: reject invalid or non-positive amounts; totals update after each change; saved expenses survive a page reload; existing routes and unrelated behavior remain intact.

Inspect the code, state a brief plan, and implement the scoped workflow. Verify the acceptance criteria with appropriate checks and report anything you could not exercise.
```

Inspect, briefly plan, implement and verify. This example needs no separate architecture proposal or feature specification.

### Backend-only project: a protected record update

One existing backend, a protected resource, and a focused mutation. Keep the current runtime and persistence; no frontend or new service is required.

```text
Read the installed Vaastu SKILL.md and inspect this backend repository.

Implement the record-update workflow described in the requirements using the existing transport and persistence. Validate input, verify identity and resource scope, allow only permitted fields, and preserve the relevant domain invariant under concurrent updates.

Keep transport adaptation separate from reusable business behavior without adding unnecessary layers. Define stable errors and retry behavior where duplicate execution matters.

Acceptance criteria: permitted updates persist; malformed input, protected-field edits, and unauthorized resource access are rejected; existing contracts and unrelated behavior remain intact.

State a brief plan, implement within this scope, and run relevant request, domain, permission, and persistence checks. Report unexecuted cases explicitly.
```

Use the actual resource, permissions, and invariant from the project requirements. Verify trusted behavior directly; a UI and separate backend deployment are unnecessary.

### Large project: a multi-tenant order platform

Customer and operations experiences share durable orders and tenant permissions. Use documented requirements and the full-project template; justify each application, package and service.

```text
Read .agents/skills/vaastu/SKILL.md and REQUIREMENTS.md. Use the full-project implementation template and relevant supporting resources for this task.

Build the must-have scope in REQUIREMENTS.md for a multi-tenant order platform with customer and operations experiences. Customers create and view their own tenant’s orders. Authorized operations users update order status within their assigned tenant. Persist orders on the trusted backend and reject unauthorized or cross-tenant reads and writes.

Inspect the repository and present the simplest justified architecture and dependency-ordered plan before substantial edits. This request authorizes implementation of the documented must-have scope. Implement one connected create-order workflow first, verify it, and then complete the remaining dependency-ready must-have workflows.

Record significant decisions and relevant measurable requirements, with their sources and owners. Use feature acceptance criteria and the Definition of Done. Verify applicable contracts, permissions, data/retry behavior, dependencies and integrations. For a release, assess the relevant CI, migrations, recovery and operational checks.

Do not add speculative services or implement later features. Preserve existing behavior outside scope, and distinguish implemented, tested, deployed and operationally verified work. Report missing requirements or blocked integrations explicitly.
```

First fill REQUIREMENTS.md with must-have workflows, roles, stack constraints, workload and applicable performance, recovery and release criteria. Keep unknown targets explicit.

## Frontend, backend, and full-stack projects

Vaastu is a universal architecture decision framework. Apply it to the project's existing language, frameworks, runtimes, and deployment constraints. The examples illustrate responsibilities; they do not require a particular stack or a separate service for each layer.

### Frontend-only work

Keep screens, interactions, form behavior, and local state with the owning feature. Reuse the existing UI system and data path. A browser-local tool or static site needs no API or database just to follow the framework.

- Assign local, URL, draft, session, and fetched state one owner where each applies.
- Exercise loading, empty, invalid, error, keyboard, and relevant viewport states.
- Measure performance against the actual problem; verify native behavior on the target runtime when affected.

- [Frontend architecture](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/frontend-architecture.md)

### Backend-only work

Keep transport adapters thin and trusted operations owned by their feature. Define validation, identity, resource scope, domain rules, persistence, integrations, and stable outcomes without requiring a UI or a controller/service/repository hierarchy.

- Authorize reads and writes at trusted boundaries and reject protected-field edits.
- Use transactions, constraints, or conditional writes for affected invariants and concurrency.
- Define safe retries, timeouts, duplicate handling, and observable recovery for integrations or jobs.

- [Backend architecture](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/backend-architecture.md)

### Full-stack and multi-client work

A full-stack framework can keep UI and backend operations inside one application. Separate client and trusted responsibilities without forcing separate deployments. Add services or shared packages only when real consumers or operational requirements justify them.

- Define portable inputs, authoritative outputs, errors, serialization, and retry behavior.
- Reconcile affected data after mutations and isolate caches and pending requests when identity or resource scope changes.
- Keep privileged modules and credentials out of client bundles; check compatibility with supported older clients.

- [Frontend-backend integration](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/frontend-backend-integration.md)
- [Create-order walkthrough](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/examples/create-order.md)

### Prove one connected workflow

For a workflow that needs both UI and persistence, trace the path below. Omit layers that do not apply to the task.

1. Capture user input in the owning feature and provide immediate feedback.
2. Validate at the trusted boundary and verify identity and resource access.
3. Apply authoritative domain rules and commit required changes atomically.
4. Return a stable result or safe error, with retry behavior defined.
5. Reconcile the owning UI/query state and preserve recoverable user input.
6. Verify success, denied access, failure, and recovery with environment-specific evidence.

This is an illustrative flow, not evidence that a particular system has been implemented, load-tested, or deployed.

- [Plan frontend and backend architecture](/guides/frontend-backend-architecture)
- [Install and use the skill](/guides/install-architecture-skill)
- [Frontend feature and state architecture](/guides/frontend-architecture)
- [Backend operations and data consistency](/guides/backend-architecture)

## Untangle an existing codebase

Use Vaastu's ownership and dependency rules to repair an existing workflow whose responsibilities are unclear. Identify the behavior to preserve and work within the current stack.

### Describe the workflow

Record the input, permitted actor, affected data, expected result, and failure behavior. Establish the relevant baseline checks and preserve drafts, navigation, and resource cleanup where applicable.

### Locate the responsible owners

Trace feature behavior, state, trusted access, persistence, and consumers. Use file evidence to identify the boundary problem and select the smallest ownership repair. Record significant decisions and alternatives.

### Verify the original behavior

Implement within the authorized scope and check the affected consumers, imports, permissions, and persistence. Finish when the agreed workflow checks pass, and report remaining blockers or untested cases.

These responsibilities do not require a separate layer or service for each step. Preserve the current architecture where it meets the requirements, and keep unrelated cleanup outside the scoped repair.

```text
Read the installed Vaastu SKILL.md and references/codebase-untangling.md.

Review [workflow] using this project's existing stack. Do not change files yet.
Trace input, feature behavior, state ownership, trusted access, persistence,
and the result consumed by the UI or caller, where applicable.
For each boundary problem, give file evidence, the affected behavior,
the owning module, and the smallest repair with acceptance checks.
Preserve routes, contracts, data, permissions, drafts, and lifecycle cleanup.
Record significant ownership decisions and distinguish verified facts from unknowns.
```

[Read the untangling example](/guides/review-existing-architecture#untangle-coupled-code)

[Skill reference](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/codebase-untangling.md)

## Agent Protocol Prompt

Give your coding agent the project requirements and ask it to read SKILL.md. Use a short prompt for focused work, or the optional full-project template for substantial architecture and implementation.

### Which prompt should I use?

Use the short prompt for focused changes. For a substantial build, use the full-project template with requirements, implementation scope and acceptance criteria.

```text
Read .agents/skills/vaastu/SKILL.md
and use it as the architecture decision framework for this project.

Use its references, examples, and templates when relevant.
Do not blindly copy an example architecture.

First analyze the project requirements and existing repository.

Before substantial implementation, define:
- requirements and assumptions
- system architecture
- application/runtime boundaries
- repository architecture
- feature/module ownership
- backend/API responsibilities
- database and data ownership
- shared-code strategy
- dependency rules
- state ownership
- authentication and authorization boundaries
- testing and architecture validation
- scalability triggers
- first end-to-end vertical slice
- implementation order

Apply this framework to the project's existing language, frameworks, runtimes, and deployment model. Keep frontend and backend in one application when that meets the requirements. Omit layers the workflow does not use.

For focused work, apply only relevant decisions; do not require a full-system proposal. Follow the current request's implementation scope. Stop at the proposal when only a proposal was requested.
```

### Full-project implementation prompt

The optional template adds a project brief and delivery criteria for substantial work. Fill it in or reference your existing requirements.

[Read and copy the full-project template](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/templates/PROJECT_IMPLEMENTATION_PROMPT.md)

## The 5-Step Execution Lifecycle

Inspect, plan, review within scope, then implement and verify one workflow at a time.

### Ingests Framework Heuristics

Read SKILL.md and only the supporting resources relevant to the task.

### Inspects Constraints & Context

Inspect existing behavior, runtimes, data stores and constraints before proposing changes.

### Emits Architecture Proposal

For substantial work, explain boundaries, ownership, data and the first implementation slice.

### Human Review & Confirmation

Stop at the proposal if that is the requested scope. Otherwise continue within existing implementation authorization; clarify material departures.

### Execution

Build and verify each dependency-ready workflow before expanding.

## The 14 Architecture Decisions

For substantial architecture work, evaluate the relevant concerns below. For a focused change, apply the affected decisions instead of requiring a full-system document.

### System Boundaries

Category: Boundaries

Client, server, worker, or application boundaries justified by the workflow and deployment needs.

Failure risk: Unclear ownership or speculative service boundaries that add coordination without solving a requirement.

### Runtime Isolation

Category: Boundaries

Browser, native, server, worker, command-line, and managed runtimes present in the project.

Failure risk: Platform-specific dependencies crossing incompatible runtime or client/server boundaries.

### Feature Ownership

Category: Boundaries

Each capability owns the UI, commands, queries, and state its workflow actually needs.

Failure risk: Unrelated behavior collecting in global folders or features depending on each other's internals.

### Database & Schemas

Category: Data & State

Authoritative data ownership, scoped access, transaction boundaries, constraints, and reproducible persistence changes.

Failure risk: Privileged data access escaping trusted boundaries or multi-step writes leaving inconsistent records.

### State Ownership

Category: Data & State

Server state vs client cache vs URL state vs local component state.

Failure risk: Global stores bloating with stale server data and duplicated entity caches.

### Dependency Rules

Category: Governance

Unidirectional: Feature → Shared Core; Never Feature A → Feature B internal.

Failure risk: Circular imports and tangled dependency graphs that break builds and tests.

### Shared Code Strategy

Category: Governance

Only truly generic utilities belong in shared; domain logic stays in features.

Failure risk: Bloated utils/helpers.ts dumping ground containing thousands of lines.

### Authentication & Authz

Category: Governance

Verified identity, operation-specific permissions, resource scope, and session handling at trusted boundaries.

Failure risk: Navigation-only protection, client-supplied authority, or inconsistent resource access checks.

### Error Handling

Category: Governance

Structured error models, API status mapping, user-facing vs logged details.

Failure risk: Silent failures, unhandled promise rejections, or leaked sensitive stack traces.

### Scalability Triggers

Category: Execution

Requirements, measurements, and revisit conditions for caches, jobs, replicas, or independent services.

Failure risk: Adding infrastructure for hypothetical scale or ignoring measured resource contention.

### First Vertical Slice

Category: Execution

One real outcome through the boundaries it needs, including failures and recovery.

Failure risk: Disconnected mocks passing checks while required integrations or trusted behavior remain unverified.

### Implementation Order

Category: Execution

Dependency-ready implementation order based on the workflow, current system, and acceptance criteria.

Failure risk: Expanding foundations or features before proving the contracts and behavior the next slice needs.

### Contract Validation

Category: Data & State

Runtime validation of untrusted inputs and integration responses where malformed data violates assumptions.

Failure risk: Treating static types as runtime validation or accepting unchecked external values.

### Testing Boundaries

Category: Execution

Appropriate domain, contract, permission, persistence, client, and connected-flow checks with explicit evidence.

Failure risk: Equating mocked checks or source inspection with verified browser, database, hosted, or production behavior.

## Decision System vs. Folder Template

Choose boundaries from requirements rather than copying a directory tree.

### Why Templates Fail

Fixed folder templates can create empty layers, ignore runtime needs and hide ownership or dependency problems.

### How Heuristics Succeed

Start from real requirements, keep domain logic independent of UI, expose deliberate public APIs and verify connected workflows.

### Enforceable Boundary Rule Example

```ts
import { UserProfileBadge } from "@/features/users";
```

## The 6 Architectural Domains

Six areas organize the detailed reference guidance.

### 1. System & Runtime Architecture

Identify real client, server, worker, command-line, or managed execution boundaries. Keep platform-specific dependencies inside compatible runtimes.

### 2. Feature & Module Encapsulation

Group behavior by its owning capability and expose deliberate public entry points. A feature contains only the UI, commands, queries, or state its workflow needs; no fixed set of files or export convention is required.

### 3. Backend & API Boundaries

Choose a transport that fits the project. Keep adapters thin, validate untrusted inputs, enforce authorization at trusted operations, and keep privileged persistence access out of client code.

### 4. Data Ownership & Storage

Identifies authoritative data owners, cache invalidation, and migration ownership so each domain entity has a deliberate source of truth.

### 5. Dependency & Shared Code

Keep dependencies acyclic and ownership explicit. Shared packages do not import applications. Reusable domain capabilities may be shared when real consumers justify them.

### 6. Scalability Triggers

Use requirements and measured pressure to decide when caching, jobs, replicas, or service extraction are justified. Name evidence and revisit conditions instead of inventing universal thresholds.

## The Human Review Protocol

Review consequential boundary, state and contract changes in proportion to the task. Follow the current request’s authorization and keep unresolved acceptance criteria visible.

### Gate 1: Boundary & Runtime Check

Do module and runtime boundaries match actual workflows? Remove unjustified services and layers.

### Gate 2: State & Contract Verification

Does each state value have an owner? Verify untrusted input, permissions and resource scope at trusted boundaries.

### Gate 3: Vertical Slice Viability

Can one real workflow be exercised across the boundaries it needs before the structure expands?

## Feature completion and architecture evolution

Keep three phases: discovery, foundations and a first slice, then incremental delivery. Apply release checks to the actual risks; small changes need no extra paperwork.

#### Measurable requirements

Record relevant workload, latency, availability, privacy, budget and recovery targets, with an owner and verification method. Mark unknowns.

#### Significant decision records

Use ADRs or the existing decision log for consequential choices. Record alternatives, consequences and revisit conditions; preserve history when superseding decisions.

#### Feature Definition of Done

Verify acceptance, permissions, data changes, integrations and dependency boundaries. Record passed, failed, not-run or not-applicable checks with environment and evidence.

#### Security and data lifecycle

Test affected trust boundaries and denied access, including cross-tenant cases when relevant. Address secrets, retention/deletion and audit events; this is not compliance certification.

#### Release and operations

For releases, assess CI, configuration, migrations, recovery and smoke checks. Give important failures useful health/error signals and an owner. Separate implemented, tested, deployed and operationally accepted.

- [Feature delivery and evolution](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/feature-delivery.md)
- [Security and data lifecycle](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/security-checklist.md)
- [Deployment readiness](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/references/deployment-readiness.md)
- [Architecture decision record template](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/templates/ADR.md)
- [Feature specification template](https://github.com/KOUSHIKG04/scalable-architecture-skill/blob/main/skills/vaastu/templates/FEATURE_SPEC.md)

## Agent Configuration Snippets

Install for a supported agent and use the skill location reported by the installer. These prompts request relevant architecture guidance without assuming that every agent has the same discovery or configuration behavior.

### Codex

For a standard project-local installation, verify .agents/skills/vaastu/SKILL.md. Invoke the installed skill explicitly or ask Codex to read it; automatic matching depends on the skill description and invocation settings.

Use $vaastu to inspect this project's requirements and existing architecture. Apply only relevant guidance, preserve behavior outside scope, and verify the affected workflow.

### Claude Code

After installation, use the skill path reported by the installer in your prompt or the agent's supported project-instruction mechanism.

Read the installed Vaastu SKILL.md and the supporting references relevant to this task. Apply its architecture decisions to the existing stack and project requirements. Preserve current behavior and work within the requested scope.

### Cursor

After installation, use the skill path reported by the installer in your prompt or the agent's supported project-instruction mechanism.

Read the installed Vaastu SKILL.md and the supporting references relevant to this task. Apply its architecture decisions to the existing stack and project requirements. Preserve current behavior and work within the requested scope.

### Windsurf

After installation, use the skill path reported by the installer in your prompt or the agent's supported project-instruction mechanism.

Read the installed Vaastu SKILL.md and the supporting references relevant to this task. Apply its architecture decisions to the existing stack and project requirements. Preserve current behavior and work within the requested scope.

### GitHub Copilot

After installation, use the skill path reported by the installer in your prompt or the agent's supported project-instruction mechanism.

Read the installed Vaastu SKILL.md and the supporting references relevant to this task. Apply its architecture decisions to the existing stack and project requirements. Preserve current behavior and work within the requested scope.

## Agent discovery, reading, and use

Public documentation helps an agent understand Vaastu when it retrieves the site or repository. Finding the skill, recommending it, installing it, and selecting it for a task are separate steps.

### Finding and recommending the skill

An agent with web search or a skill-directory tool may find Vaastu for a relevant request. Inclusion depends on that agent's tools, retrieval sources, and the task. SEO, structured data, and crawler access do not guarantee a recommendation.

### Reading the public documentation

The Markdown pages, documentation index, and combined text expose the same public guidance in text form. Agents can use these endpoints when their tools support them; no universal requirement makes every coding agent read llms.txt or ai.txt.

### Using an installed skill

Install the skill through a supported workflow, verify its reported location, and ask the agent to read SKILL.md. Automatic selection depends on the host's discovery and invocation rules. Reading a webpage alone does not install the skill or grant it authority over project instructions.

- [Documentation as Markdown](/docs.md)
- [Agent documentation index](/llms.txt)
- [Combined public documentation](/llms-full.txt)
- [Installation guide](/guides/install-architecture-skill)
