Skip to content
Development
Skill

/interfaces-and-autowiring

Master Symfony Dependency Injection with autowiring, #[Target] interface binding, decoration, and tagged services

From plugin
superpowers-symfony
23344 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill interfaces-and-autowiring --agent claude-code

SKILL.md

interfaces-and-autowiring.SKILL.md
name: interfaces-and-autowiring
description: "Master Symfony Dependency Injection with autowiring, #[Target] interface binding, decoration, and tagged services"
capabilities: [read, search]
tags: [architecture]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep

Interfaces And Autowiring (Symfony)

Use when

  • A service depends on a concrete class and must be swappable or replaced in tests.
  • Several implementations of one interface exist and the right one must be injected.
  • Adding cross-cutting behavior (logging, caching, retries) around an existing service.
  • Injecting scalars, parameters, env vars, or every service carrying a tag.
  • Autowiring fails with "cannot autowire" or an ambiguous type.

Default workflow

1. Extract a focused interface for what the consumer actually needs. 2. Let autowiring bind it when there is a single implementation. 3. With several implementations, pick one per consumer through a named alias and `#[Target]`. 4. Add behavior around a service with `#[AsDecorator]` instead of editing or extending it. 5. Inject scalars with `#[Autowire]` and tagged collections with `#[AutowireIterator]`. 6. Confirm the result with `debug:autowiring` for each type involved.

Guardrails

  • Constructor injection with `private readonly` dependencies; no setter injection, no container access.
  • Keep interfaces small: one consumer need per interface.
  • Make services `final` by default and decorate them rather than extend them.
  • Use lazy services or service closures only for expensive dependencies that some paths skip.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • Interfaces and the bindings or aliases that select each implementation.
  • Decorators or tagged collections, with their priority.
  • The `debug:autowiring` output for the types involved.

References

  • `reference.md`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

23344 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
233
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about interfaces-and-autowiring.

Which coding agents can use interfaces-and-autowiring?
interfaces-and-autowiring 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.