# Webiny Dependency Injection

The universal createImplementation DI pattern and all injectable services.

- Repository: https://github.com/webiny/webiny-js (8051 stars)
- Category: DevOps
- License: see repository
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add webiny/webiny-js --skill webiny-dependency-injection -g -a claude-code -y`
Codex: `npx skills add webiny/webiny-js --skill webiny-dependency-injection -g -a codex -y`
Cursor: `npx skills add webiny/webiny-js --skill webiny-dependency-injection -g -a cursor -y`
Gemini CLI: `npx skills add webiny/webiny-js --skill webiny-dependency-injection -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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/`)                                                                                |
| ----------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **`createAbstraction`** | `from "webiny/api"` or `from "webiny/admin"`                     | `from "@webiny/feature/api"` or `from "@webiny/feature/admin"`                                    |
| **`createFeature`**     | `from "webiny/api"` or `from "webiny/admin"`                     | `from "@webiny/feature/api"` or `from "@webiny/feature/admin"`                                    |
| **Factory imports**     | `from "webiny/api/graphql"`, `from "webiny/api/cms/model"`, etc. | Direct package paths: `from "@webiny/handler-graphql/..."`, `from "@webiny/api-headless-cms/..."` |
| **Catalog paths**       | Use the `Import:` path                                           | Use the `Source:` path                                                                            |

The rest: https://github.com/webiny/webiny-js/blob/HEAD/skills/user-skills/dependency-injection/SKILL.md
