/api-architect
The hub skill for all API/backend architecture in Webiny. Covers architecture overview, Services vs UseCases, feature naming and organization, feature structure templates, DI decision tree, anti-patterns, createFeature, createAbstraction, container registration, domain errors,
Claude Code
$ npx -y skills add webiny/webiny-js --skill api-architect --agent claude-code
Codex
$ npx skills add webiny/webiny-js --skill api-architect -a codex -y
Cursor
$ npx skills add webiny/webiny-js --skill api-architect -a cursor -y
Gemini CLI
$ npx skills add webiny/webiny-js --skill api-architect -a gemini-cli -y
GitHub Copilot
$ npx skills add webiny/webiny-js --skill api-architect -a github-copilot -y
OpenCode
$ npx skills add webiny/webiny-js --skill api-architect -a opencode -y
Windsurf
$ npx skills add webiny/webiny-js --skill api-architect -a windsurf -y
SKILL.md
api-architect.SKILL.mdname: webiny-api-architect
description: >
The hub skill for all API/backend architecture in Webiny. Covers architecture overview,
Services vs UseCases, feature naming and organization, feature structure templates,
DI decision tree, anti-patterns, createFeature, createAbstraction, container registration,
domain errors, entity and value object patterns, naming conventions, scoping rules, and code conventions.
Use this skill for ANY backend API work — it references sub-skills for deep implementation details.
API Architecture Patterns
TL;DR
API extensions use `createFeature` to register features into the DI container. Each feature is a vertical slice with abstractions, implementations, and a `feature.ts` registration file. The key abstractions are **Services** (multi-method, singleton) and **UseCases** (single-method orchestrators, transient). Repositories handle persistence via CMS. Features are named by **business capability**, files inside by **technical responsibility**.
Working Context
This skill applies to both **extension developers** (working in `extensions/`) and **core developers** (working in `packages/`). The architecture patterns are identical — only imports and registration differ.
| | Extensions (`extensions/`) | Core (`packages/`) | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | | **Imports** | `webiny/api`, `webiny/api/cms/model`, etc. | `@webiny/feature/api`, `@webiny/api-headless-cms/...`, etc. | | **Catalog paths** | Use the `Import:` path | Use the `Source:` path | | **Entry point** | `export default createFeature(...)` in a file targeted by `<Api.Extension src={...}>` | `createFeature` registered by the package initializer | | **GraphQL schemas** | `export default GraphQLSchemaFactory.createImplementation(...)` — registered via `container.register()` inside the entry point's `createFeature` | Same pattern, but imported from `@webiny/handler-graphql` |
Detect which context you're in by checking the file path: `extensions/` → extension mode, `packages/` → core mode.
Architecture Overview
Extension (root) ── registers ──> Features + GraphQL Schemas + Models
Feature ── registers ──> UseCase | Service | EventHandler + Repository
UseCase ── depends on ──> Service | Repository (+ EventPublisher)
Repository ── depends on ──> CMS Use Cases (GetModel, CreateEntry, etc.)
Service ── depends on ──> external APIs, other Services- **Extension**: Top-level entry point. Registers all features, GraphQL schemas, and CMS models.
- **Feature**: A vertical slice. Registers its use cases, services, repositories, and event handlers.
- **UseCase**: Single-method orchestrator (`execute()`). Coordinates services, repositories, and events. Transient scope.
- **Service**: Multi-method abstraction for external API calls or cohesive domain logic. Singleton scope.
- **Repository**: Persistence layer using CMS as storage. Singleton scope.
- **EventHandler**: Thin orchestrator reacting to domain events. Delegates to services/use cases.
- **GraphQL Schema**: Defines types, inputs, queries, and mutations. Resolvers delegate to use cases.
- **CMS Model**: Defines the data schema stored in headless CMS.
---
Services vs UseCases
Services
Multi-method abstractions for **external API calls** or **cohesive domain logic**. A service groups related operations that belong together.
// abstractions.ts
export interface ILingotekService {
translate(documentId: string, targetLocale: string): Promise<Result<void, Error>>;
getTranslationStatus(documentId: string): Promise<Result<TranslationStatus, Error>>;
deleteProject(projectId: string): Promise<Result<void, Error>>;
}
export const LingotekService = createAbstraction<ILingotekService>("MyExt/LingotekService");
export namespace LingotekService {
export type Interface = ILingotekService;
}- Registered in **singleton scope** (`.inSingletonScope()`)
- Located in: `features/{serviceName}/` or `features/services/{serviceName}/`
- One service per external system or cohesive domain area
- **If async bootstrap is needed** (loading settings from CMS, fetching remote config): use the **ServiceProvider pattern** — a provider abstraction with `async getService()` that lazily initializes and caches the service. Consumers inject the provider, not the service directly. See the ServiceProvider section below.
UseCases
Single-method orchestrators with an `execute()` method. They coordinate services, repositories, and events.
export interface ISyncProjectUseCase {
execute(input: SyncProjectInput): Promise<Result<Project, SyncProjectError>>;
}- Registered in **transient scope** (default)
- Located in: `features/{ActionEntity}/`
- One use case per business operation
When to Create a UseCase
- GraphQL mutations need the same logic as event handlers
- Need to coordinate multiple services or repositories
- Business logic must be reusable across entry points (GraphQL, events, CLI)
When NOT to Create a UseCase
- Simple event handler that calls one service method — inject the service directly
- Simple read queries — inject the service or repository directly into the GraphQL resolver
- Logic that only exists in one place and is unlikely to be reused
Serv
Read more
name: webiny-api-architect description: > The hub skill for all API/backend architecture in Webiny. Covers architecture overview, Services vs UseCases, feature naming and organization, feature structure templates, DI decision tree, anti-patterns, createFeature, createAbstraction, container registration, domain errors, entity and value object patterns, naming conventions, scoping rules, and code conventions. Use this skill for ANY backend API work — it references sub-skills for deep implementation details.
API Architecture Patterns
TL;DR
API extensions use `createFeature` to register features into the DI container. Each feature is a vertical slice with abstractions, implementations, and a `feature.ts` registration file. The key abstractions are **Services** (multi-method, singleton) and **UseCases** (single-method orchestrators, transient). Repositories handle persistence via CMS. Features are named by **business capability**, files inside by **technical responsibility**.
Working Context
This skill applies to both **extension developers** (working in `extensions/`) and **core developers** (working in `packages/`). The architecture patterns are identical — only imports and registration differ.
| | Extensions (`extensions/`) | Core (`packages/`) | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | | **Imports** | `webiny/api`, `webiny/api/cms/model`, etc. | `@webiny/feature/api`, `@webiny/api-headless-cms/...`, etc. | | **Catalog paths** | Use the `Import:` path | Use the `Source:` path | | **Entry point** | `export default createFeature(...)` in a file targeted by `<Api.Extension src={...}>` | `createFeature` registered by the package initializer | | **GraphQL schemas** | `export default GraphQLSchemaFactory.createImplementation(...)` — registered via `container.register()` inside the entry point's `createFeature` | Same pattern, but imported from `@webiny/handler-graphql` |
Detect which context you're in by checking the file path: `extensions/` → extension mode, `packages/` → core mode.
Architecture Overview
Extension (root) ── registers ──> Features + GraphQL Schemas + Models
Feature ── registers ──> UseCase | Service | EventHandler + Repository
UseCase ── depends on ──> Service | Repository (+ EventPublisher)
Repository ── depends on ──> CMS Use Cases (GetModel, CreateEntry, etc.)
Service ── depends on ──> external APIs, other Services- **Extension**: Top-level entry point. Registers all features, GraphQL schemas, and CMS models.
- **Feature**: A vertical slice. Registers its use cases, services, repositories, and event handlers.
- **UseCase**: Single-method orchestrator (`execute()`). Coordinates services, repositories, and events. Transient scope.
- **Service**: Multi-method abstraction for external API calls or cohesive domain logic. Singleton scope.
- **Repository**: Persistence layer using CMS as storage. Singleton scope.
- **EventHandler**: Thin orchestrator reacting to domain events. Delegates to services/use cases.
- **GraphQL Schema**: Defines types, inputs, queries, and mutations. Resolvers delegate to use cases.
- **CMS Model**: Defines the data schema stored in headless CMS.
---
Services vs UseCases
Services
Multi-method abstractions for **external API calls** or **cohesive domain logic**. A service groups related operations that belong together.
// abstractions.ts
export interface ILingotekService {
translate(documentId: string, targetLocale: string): Promise<Result<void, Error>>;
getTranslationStatus(documentId: string): Promise<Result<TranslationStatus, Error>>;
deleteProject(projectId: string): Promise<Result<void, Error>>;
}
export const LingotekService = createAbstraction<ILingotekService>("MyExt/LingotekService");
export namespace LingotekService {
export type Interface = ILingotekService;
}- Registered in **singleton scope** (`.inSingletonScope()`)
- Located in: `features/{serviceName}/` or `features/services/{serviceName}/`
- One service per external system or cohesive domain area
- **If async bootstrap is needed** (loading settings from CMS, fetching remote config): use the **ServiceProvider pattern** — a provider abstraction with `async getService()` that lazily initializes and caches the service. Consumers inject the provider, not the service directly. See the ServiceProvider section below.
UseCases
Single-method orchestrators with an `execute()` method. They coordinate services, repositories, and events.
export interface ISyncProjectUseCase {
execute(input: SyncProjectInput): Promise<Result<Project, SyncProjectError>>;
}- Registered in **transient scope** (default)
- Located in: `features/{ActionEntity}/`
- One use case per business operation
When to Create a UseCase
- GraphQL mutations need the same logic as event handlers
- Need to coordinate multiple services or repositories
- Business logic must be reusable across entry points (GraphQL, events, CLI)
When NOT to Create a UseCase
- Simple event handler that calls one service method — inject the service directly
- Simple read queries — inject the service or repository directly into the GraphQL resolver
- Logic that only exists in one place and is unlikely to be reused
Serv
Open-source content platform. Self-hosted on AWS serverless. Built as a TypeScript framework you extend with code, not a closed product you configure through a UI. Runs on Lambda, DynamoDB, S3, and CloudFront inside your own AWS account. Scales automatically.
Other skills on webiny-js.
More skills from other plugins.
prompt-lookup
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use…
ppt-master
AI-driven presentation workflow for generating editable PPTX decks and slides, reconstructing page visuals, creating reusable…
morph-ppt
Use this skill when the user wants a .pptx with smooth cross-slide animation — PowerPoint Morph transitions, Keynote-style…
frontend-slides
Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to…
Questions about api-architect.
- Which coding agents can use api-architect?
- api-architect installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

