Symfony Hexagonal Architecture - Claude Code Plugin
A Claude Code plugin that enforces hexagonal architecture (ports & adapters) in Symfony projects. Works with both new projects (full scaffolding) and existing projects (progressive, module-by-module refactoring).
- Version-aware: supports Symfony 6.4 LTS, 7.4 LTS and 8.x. The plugin detects your installed Symfony / PHP / Doctrine / PHPUnit versions and generates code that runs on them, with fallbacks for older versions.
- Zero commands to learn: skills and agents activate automatically from the conversation.
Table of Contents
Compatibility
| Symfony 6.4 LTS | Symfony 7.4 LTS | Symfony 8.x |
|---|
| PHP | 8.1+ (8.2+ for readonly classes) | 8.2+ | 8.4+ |
| Doctrine ORM / DBAL | 2.x-3.x / 3.x-4.x | 3.x / 4.x | 3.4+ / 4.x |
| PHPUnit | 10-11 | 11-12 | 12-13 |
| Status | supported (bugfix support ends Nov 2026) | recommended | supported |
How it works:
- On session start (plugin install), a hook prints a Detected Stack block read from
composer.lock. Non-Symfony projects get nothing, so the plugin never affects other repositories.
- Generated code defaults to APIs available on all supported versions (PHP 8.2 + Symfony 6.4).
- Newer features (
DeduplicateStamp 7.3+, #[ExtendsValidationFor] 7.4+, PHP 8.4 private(set), Doctrine ORM 3.7 OffsetPaginator, ...) are used only when your versions allow them, with the fallback documented next to each one.
- APIs removed in Symfony 8 (
Request::get(), constraint option arrays, XML service config, Doctrine annotations) are never generated, and the agents flag them in existing code.
The full matrix lives in skills/symfony-hexagonal-architecture/references/version-compatibility.md.
Installation
Requires Claude Code. Pick one option.
Option 1: Plugin (recommended, 2 commands)
Inside Claude Code:
/plugin marketplace add aligundogdu/symfony-hexagonal-skill
/plugin install symfony-hexagonal@symfony-hexagonal-skill
Or from your shell:
claude plugin marketplace add aligundogdu/symfony-hexagonal-skill
claude plugin install symfony-hexagonal@symfony-hexagonal-skill # --scope user (default) | project | local
This installs all skills, both agents and the SessionStart hook that loads the architecture rules (only in Symfony projects). Restart the session afterwards.
Update later with /plugin marketplace update symfony-hexagonal-skill (or claude plugin update symfony-hexagonal@symfony-hexagonal-skill).
Option 2: Plugin for the whole team (auto-enabled per project)
Commit this to your Symfony project's .claude/settings.json:
{
"extraKnownMarketplaces": {
"symfony-hexagonal-skill": {
"source": { "source": "github", "repo": "aligundogdu/symfony-hexagonal-skill" }
}
},
"enabledPlugins": {
"symfony-hexagonal@symfony-hexagonal-skill": true
}
}
When teammates open the project and trust the folder, Claude Code offers to install the marketplace and plugin. If a teammate sees "enabled in project settings but isn't installed", they run the two commands from Option 1 once.
Option 3: Copy into a project (no plugin system)
git clone https://github.com/aligundogdu/symfony-hexagonal-skill.git /tmp/hex-skill
mkdir -p your-project/.claude/skills your-project/.claude/agents
cp -r /tmp/hex-skill/skills/* your-project/.claude/skills/
cp -r /tmp/hex-skill/agents/* your-project/.claude/agents/
# The rules are normally injected by the plugin hook; without the plugin, append them to CLAUDE.md
cat /tmp/hex-skill/rules/hexagonal-rules.md >> your-project/CLAUDE.md
rm -rf /tmp/hex-skill
Commit .claude/skills/ and .claude/agents/ to share them with the team.
Option 4: Symlink (develop the plugin / multi-project)
git clone https://github.com/aligundogdu/symfony-hexagonal-skill.git ~/symfony-hexagonal-skill
# In each Symfony project
mkdir -p .claude
ln -s ~/symfony-hexagonal-skill/skills .claude/skills
ln -s ~/symfony-hexagonal-skill/agents .claude/agents
echo '@~/symfony-hexagonal-skill/rules/hexagonal-rules.md' >> CLAUDE.md # CLAUDE.md import
# Or load the checkout as a plugin for one session (includes the hook):
claude --plugin-dir ~/symfony-hexagonal-skill
Verify Installation
In your Symfony project, start Claude Code and ask: