mcpField
A
adr-scaffold

adr-scaffold

github.com/gravito-frameworkDevelopment240 installsUpdated 27w ago
Repository

About adr-scaffold

A coding skill that scaffolds Gravito applications around the Action-Domain-Responder pattern. It guides code organization so business operations live in Actions while HTTP controllers handle request and response duties.

Key features

  1. 01Action-Domain-Responder structure
  2. 02Single Action per business operation
  3. 03Thin HTTP controllers
  4. 04Repository and model organization
  5. 05Stepwise implementation workflow

Use cases

  1. 01Structuring a Gravito application
  2. 02Separating business logic from HTTP handling
  3. 03Implementing transactional multi-row operations
  4. 04Scaffolding API routes and controllers

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/gravito-framework/gravito --skill adr-scaffold

After installing, type/adr-scaffoldin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
.keep
references/
.keep
adr-rules.md
scripts/
.keep

Details

From the project README

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.

Comments

Markdown supported