webiny-api-architect
できること
このスキルは、Webiny APIでバックエンドのコードを作るための主要なルールをAIに与えます。Webinyプロジェクトにビジネスロジックを加える拡張を書く開発者向けです。
使う場面
- ✓Webiny API向けのバックエンドの機能や拡張を作るとき。
- ✓あるロジックについて、サービスとユースケースのどちらにするかを決める必要があるとき。
- ✓新しいバックエンドの機能を、適切なフォルダと登録に整理したいとき。
スキルのリンク
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/api-architect/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“プロジェクトのアーキテクチャのルールに従い、送料を計算するWebinyのバックエンドの機能を作ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、サービスとユースケースの違い、機能がビジネス上の目的によってどう名付けられるか、依存性のコンテナーにどう登録されるかを説明します。避けるべきよくある間違いも挙げています。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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}/orfeatures/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 inje
よくある質問
サービスとユースケースの違いは何ですか?
サービスは複数のメソッドを持ち共有されるもので、ユースケースは一つの操作のための一つのメソッドを持ちます。
機能はどのように名付けられますか?
機能はビジネス上の能力によって名付けられ、その中のファイルは技術的な役割によって名付けられます。
管理画面の側も扱いますか?
いいえ。管理画面のパターンは、別のWebiny管理画面のスキルが扱います。
詳細
作者による元の説明
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 patterns, naming conventions, scoping rules, and code conventions. Use this skill for ANY backend API work — it references sub-skills for deep implementation details.
repo: webiny/webiny-js
人気
- GitHubのスター
- 8.1k
- ランキング
- #12583
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
prd-to-plan
8.1k製品要件書を、それぞれ端から端まで成立する小さなスライスの段階的な計画に変え、Markdownファイルとして保存するよう、エージェントを支援します。
webiny-admin-architect
8.1kビジネスロジックの層とプレゼンターのパターンを使い、Webinyプラットフォームの管理画面を作る方法をエージェントに教えます。
webiny-admin-permissions
8.1k自動生成される権限フォームや、表示・非表示のチェックを含め、Webinyの管理画面に権限の制御を追加するよう、エージェントに教えます。
webiny-form-model
8.1kビルダーで宣言的にフィールドを定義し、レイアウト、検証、条件付きのルールを使って、Webinyのフォームを作るよう、エージェントに教えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。