Define architecture

From onfire7777/universal-ai-skills-library · View interactive version

Define architecture is an AI agent skill from the GitHub repository onfire7777/universal-ai-skills-library. Generates folder structures, module contracts, middleware pipelines, and frontend/backend boundaries for TypeScript full-stack applications. Use when starting a project, setting up project structure, organizing a monorepo, configuring middleware, defining folder layout, designing backend modules, es

How to use this skill

Skill file

Define Architecture

Define durable, easy-to-change architecture defaults for TypeScript apps.

How to use this skill

  1. Determine context:
  1. Produce an architecture brief using Output template.
  2. Run Validation loop before finalizing.

Load references only when needed:

Architecture setup workflow

  1. Define constraints first:
  1. Choose repo shape:
  1. Define backend module contracts:
  1. Define request context and middleware:

```ts

import { AsyncLocalStorage } from "node:async_hooks";

type RequestContext = { tenantId: string; userId: string; traceId: string };

const store = new AsyncLocalStorage<RequestContext>();

export const getContext = () => store.getStore()!;

export const runWithContext = (ctx: RequestContext, fn: () => void) => store.run(ctx, fn);

```

  1. Define frontend boundaries:
  1. Define testing and release expectations:

Adoption workflow (existing codebase)

  1. Map current architecture and pain points.
  2. Select the smallest set of changes that enforce clear module boundaries.
  3. Migrate one vertical slice first.
  4. Add guardrails (lint/type/test checks) to prevent regression.
  5. Roll out module-by-module.

Stack defaults

Use references/stack-defaults.md as the default baseline. Deviate only when constraints require it.

Validation loop

Run this loop before finalizing architecture decisions:

  1. Verify consistency:
  1. Verify quality gates:
  1. Verify operability:
  1. If any check fails:

Output template

Use this structure for architecture recommendations:

# Architecture brief

## Context and constraints
## Repo shape
## Backend module contracts
## Request context and middleware policy
## Frontend boundaries
## Testing strategy
## Rollout and rollback plan
## Open risks and follow-ups

Skill handoffs

Gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.