Skills

Webiny Dependency Injection

The universal createImplementation DI pattern and all injectable services.

Install

npx skills add webiny/webiny-js --skill webiny-dependency-injection -g -a claude-code -y
Repository
webiny/webiny-js8.1k
Category
DevOps
Updated
5d ago
License
See repository
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

The universal createImplementation DI pattern and all injectable services. Use this skill when the developer is writing any Webiny extension and needs to understand dependency injection, constructor injection, how to access Logger/BuildParams/IdentityContext, how to inject CMS use-cases (list/get/create/update/delete entries), or how the dependencies array works. This is the connective tissue across all extension types -- API, Admin, CLI, and Infrastructure.

Dependency Injection Patterns

TL;DR

Every Webiny extension type uses the same DI pattern: define a class implementing *.Interface, declare dependencies in the constructor, and export via *.createImplementation({ implementation, dependencies }). The DI container automatically provides the required services, ensures type safety, and validates at compile time. This pattern is the connective tissue across all extension types -- API, Admin, CLI, and Infrastructure.

Working Context

This skill applies to both extension developers (working in extensions/) and core developers (working in packages/). The DI pattern is universal, only the import paths differ.

Extensions (extensions/)Core (packages/)
createAbstractionfrom "webiny/api" or from "webiny/admin"from "@webiny/feature/api" or from "@webiny/feature/admin"
createFeaturefrom "webiny/api" or from "webiny/admin"from "@webiny/feature/api" or from "@webiny/feature/admin"
Factory importsfrom "webiny/api/graphql", from "webiny/api/cms/model", etc.Direct package paths: from "@webiny/handler-graphql/...", from "@webiny/api-headless-cms/..."
Catalog pathsUse the Import: pathUse the Source: path
Read the whole SKILL.md on GitHub

More in DevOps