Skip to main content
skill CX Codex

interfaces-and-autowiring — Claude Code skill: setup and guide

interfaces-and-autowiring guides Symfony dependency injection in Claude Code by binding interfaces, configuring #[Target] aliases, and decorating services cleanly.

MIT ★ 234 updated 2026-10-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill interfaces-and-autowiring -a claude-code
Open on GitHub

What interfaces-and-autowiring does

This skill structures how Claude Code handles Symfony dependency injection. It enforces targeted interfaces tailored to each consumer, autowires single implementations automatically, and resolves ambiguities across multiple implementations using named aliases with the #[Target] attribute. Code inspection relies on Read, Glob, and Grep.

Dependencies must be injected via constructors using private readonly properties. The workflow forbids container fetching and setter injection, marking classes final while handling cross-cutting concerns through #[AsDecorator]. Any wiring change expects verification against the output of debug:autowiring.

What it helps with

  • decouple services from concrete classes to simplify unit testing
  • inject the appropriate interface implementation using #[Target]
  • wrap existing services in caching or logging with #[AsDecorator]
  • pass scalars or tagged collections via #[Autowire] and #[AutowireIterator]
  • resolve Symfony autowiring failures caused by ambiguous service types

Example prompts for the agent

  • Decouple OrderProcessor from the database service using a focused interface and autowiring.
  • Pick the right MailerInterface implementation for UserNotifier using #[Target].
  • Wrap CatalogRepository with a caching decorator using #[AsDecorator] without modifying the base service.

How to install interfaces-and-autowiring

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill interfaces-and-autowiring -a claude-code

2Manually: put the files in place

~/.claude/skills/interfaces-and-autowiring/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/interfaces-and-autowiring/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about interfaces-and-autowiring

How to install interfaces-and-autowiring in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill interfaces-and-autowiring -a claude-code. Alternatively, copy the file to ~/.claude/skills/interfaces-and-autowiring/SKILL.md.

What does interfaces-and-autowiring do?

It provides execution rules for Symfony dependency injection, prioritizing constructor injection, #[Target] attribute matching, and decorator patterns over class inheritance.

Which architectural guardrails does this skill enforce?

It requires services to be final with private readonly constructor dependencies, completely barring setter injection and direct container calls.

Source text

SKILL.md · MIT
---
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`

© dev-toolings · MIT · dev-toolings/superpowers-symfony

Similar skills

All skills for Backend and APIs →

From the same set51

The whole set →
doctrine-events doctrine-events — a Claude skill for attaching side effects to Doctrine entity events in Symfony: timestamps, slugs, search index updates, notifications. CX Codex +1 ★ 234repo stars form-types-validation form-types-validation generates Symfony form types, configures DTO validation groups, handles HTTP 422 responses, and sets up multi-step flows. CX Codex +1 ★ 234repo stars tdd-with-phpunit The tdd-with-phpunit skill guides PHPUnit-driven work on Symfony features, from checking a failing test to refactoring after it passes. Use it for command, form, and external-service tests. CX Codex +1 ★ 234repo stars using-symfony-superpowers using-symfony-superpowers is a Claude Code skill that detects the Symfony version, selects a skill, and sequences steps for complex tasks. CX Codex +1 ★ 234repo stars symfony-cache Configure Symfony Cache pools, entry expiry, and tag-based invalidation with this skill. It helps when caching costly reads or preventing a burst of recomputations after a key expires. CX Codex +1 ★ 234repo stars test-doubles-mocking test-doubles-mocking — a skill for creating test doubles with PHPUnit mocks in Symfony, used to replace slow or external dependencies, verify method calls, and write simplified repository fakes in isolated unit tests. CX Codex +1 ★ 234repo stars rate-limiting rate-limiting guides Claude Code through setting up Symfony RateLimiter policies, controller attributes, and 429 responses with Retry-After headers. CX Codex +1 ★ 234repo stars api-platform-tests The api-platform-tests skill guides functional tests for Symfony API Platform resources, including response checks, filters, JSON schemas, and access control. Use it while building or changing API endpoints. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open