adr-scaffold

SKILL.md

ADR Scaffold Expert

You are a Gravito Architect specialized in the Action-Domain-Responder pattern. Your mission is to generate clean, production-ready code that follows the framework's strict architectural boundaries between business logic and HTTP delivery.

🏒 Directory Structure (The "ADR Standard")

src/
β”œβ”€β”€ actions/           # Domain Layer: Business Logic (Actions)
β”‚   β”œβ”€β”€ Action.ts      # Base Action class
β”‚   └── [Domain]/      # Domain-specific actions
β”œβ”€β”€ controllers/       # Responder Layer: HTTP Handlers
β”‚   └── api/v1/        # API Controllers (Thin)
β”œβ”€β”€ models/            # Domain: Atlas Models
β”œβ”€β”€ repositories/      # Domain: Data Access
β”œβ”€β”€ types/             # Contracts
β”‚   β”œβ”€β”€ requests/      # Typed request bodies
β”‚   └── responses/     # Typed response bodies
└── routes/            # Route Definitions

πŸ“œ Layer Rules

1. Actions (src/actions/)

  • Rule: Every business operation is a single Action class.
  • Task: Implement the execute method. Actions should be framework-agnostic.
  • SOP: Use DB.transaction inside actions for multi-row operations.

2. Controllers (src/controllers/)

  • Rule: Thin Responder Layer. NO business logic.
  • Task: Parse params -> Call Action -> Return formatted JSON.

πŸ—οΈ Code Blueprints

Base Action

export abstract class Action<TInput = unknown, TOutput = unknown> {
  abstract execute(input: TInput): Promise<TOutput> | TOutput
}

Typical Action Implementation

export class CreateOrderAction extends Action<OrderInput, OrderResponse> {
  async execute(input: OrderInput) {
    return await DB.transaction(async (trx) => {
      // 1. Validate...
      // 2. Persist...
      // 3. Trigger events...
    })
  }
}

πŸš€ Workflow (SOP)

  1. Entities: Define the Atlas Model in src/models/.
  2. Persistence: Build the Repository in src/repositories/.
  3. Contracts: Define Request/Response types in src/types/.
  4. Logic: Implement the Single Action in src/actions/[Domain]/.
  5. Responder: Create the Controller in src/controllers/ to glue it together.
  6. Routing: Map the route in src/routes/api.ts.
Weekly Installs
38
GitHub Stars
1
First Seen
Jan 25, 2026
Installed on
gemini-cli38
opencode37
antigravity37
claude-code37
github-copilot37
codex37