/ 目錄 / 演練場 / symfony-hexagonal-skill
● 社群 aligundogdu ⚡ 即開即用

symfony-hexagonal-skill

作者 aligundogdu · aligundogdu/symfony-hexagonal-skill

Enforces hexagonal architecture in Symfony projects — 10 auto-triggered skills plus 2 review agents that stop you from leaking infrastructure into domain.

A Claude Code plugin for Symfony developers who actually want to keep ports & adapters clean. Auto-triggers on Symfony code patterns to guide domain/application/infrastructure separation. Includes review agents that catch leaks (Doctrine entities imported into domain, controllers calling repositories directly).

為什麼要用

核心特性

即時演示

實際使用效果

symfony-hexagonal-skill.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "symfony-hexagonal-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/aligundogdu/symfony-hexagonal-skill",
        "~/.claude/skills/symfony-hexagonal-skill"
      ],
      "_inferred": true
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "symfony-hexagonal-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/aligundogdu/symfony-hexagonal-skill",
        "~/.claude/skills/symfony-hexagonal-skill"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "symfony-hexagonal-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/aligundogdu/symfony-hexagonal-skill",
        "~/.claude/skills/symfony-hexagonal-skill"
      ],
      "_inferred": true
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "symfony-hexagonal-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/aligundogdu/symfony-hexagonal-skill",
        "~/.claude/skills/symfony-hexagonal-skill"
      ],
      "_inferred": true
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "symfony-hexagonal-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/aligundogdu/symfony-hexagonal-skill",
        "~/.claude/skills/symfony-hexagonal-skill"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "symfony-hexagonal-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/aligundogdu/symfony-hexagonal-skill",
          "~/.claude/skills/symfony-hexagonal-skill"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add symfony-hexagonal-skill -- git clone https://github.com/aligundogdu/symfony-hexagonal-skill ~/.claude/skills/symfony-hexagonal-skill

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: symfony-hexagonal-skill

Scaffold a new bounded context with hexagonal layers

👤 Symfony devs building non-trivial domain logic ⏱ ~60 min advanced

何時使用: You're starting a new feature and want the layering right from day one.

前置條件
  • Symfony 6.x+ project — composer create-project symfony/skeleton
  • Skill installed — git clone https://github.com/aligundogdu/symfony-hexagonal-skill ~/.claude/skills/symfony-hexagonal-skill
步驟
  1. Name the context
    Use symfony-hexagonal-skill. Scaffold a 'Billing' bounded context with Invoice aggregate, issue/void commands, and a query for open invoices.✓ 已複製
    → src/Billing/Domain, Application, Infrastructure folders with proper separation
  2. Wire the infrastructure
    Add a Doctrine adapter for InvoiceRepository behind the domain port.✓ 已複製
    → Interface in Domain, implementation in Infrastructure, services.yaml binding
  3. Expose via controller
    Add an HTTP adapter with a POST /invoices endpoint that dispatches the IssueInvoice command.✓ 已複製
    → Controller calls bus, not repository directly

結果: A clean bounded context that won't turn into spaghetti in 6 months.

注意事項
  • Domain depending on Doctrine annotations — Use XML / attribute mapping in Infrastructure, not on domain entities
搭配使用: filesystem

Review a PR for hexagonal layering violations

👤 Tech leads on Symfony teams ⏱ ~20 min intermediate

何時使用: Reviewing a PR and you want an automated first-pass on layering.

步驟
  1. Run the review agent
    Use symfony-hexagonal-skill review agent on this diff. Flag any Doctrine / Symfony FW imports in Domain/, any controller->repository direct calls, any ORM leakage into responses.✓ 已複製
    → Concrete findings with file+line
  2. Suggest fixes
    For each finding, propose the minimal refactor.✓ 已複製
    → Diffs introducing a port or DTO

結果: A PR that doesn't silently degrade the architecture.

搭配使用: github

Progressively refactor an existing Symfony app toward hexagonal

👤 Teams with a legacy Symfony project ⏱ ~120 min advanced

何時使用: Big-bang rewrite is off the table; you want incremental cleanup.

步驟
  1. Identify a seam
    Use symfony-hexagonal-skill. Look at src/Module/Orders — what's the smallest slice I can lift into a clean domain?✓ 已複製
    → Specific class identified with extraction plan
  2. Extract incrementally
    Walk me through the extraction in 3 PR-sized steps.✓ 已複製
    → Staged plan with tests preserved at each step

結果: A legacy codebase getting better, one PR at a time.

注意事項
  • Extracting too much in one step — PR-sized slices only; the plugin's review agent helps gate each step
搭配使用: git

組合

與其他 MCP 搭配,撬動十倍槓桿

symfony-hexagonal-skill + github

Gate PRs on layering review before merge

Run the hex review on the open PR in this repo and post findings as comments.✓ 已複製
symfony-hexagonal-skill + filesystem

Apply scaffolds into the actual repo

Apply the context scaffold to my project under src/.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
context_scaffold context name, aggregates New bounded context 0
port_adapter_pair port interface name, adapter type Adding infrastructure 0
layering_review diff or directory Pre-merge 0
refactor_plan legacy module Starting a cleanup 0

成本與限制

運行它的成本

API 配額
None
每次呼叫 Token 數
Moderate — reviews scan files
費用
Free
提示
Scope reviews to the diff, not whole repos, to save tokens.

安全

權限、密鑰、影響範圍

憑證儲存: None
資料出站: None from skill

故障排查

常見錯誤與修復

Review agent misses violations

Ensure the full diff is in context; very large diffs may need chunking

Scaffold produces old Symfony 5 style

Mention your Symfony version explicitly — 6 vs 7 conventions differ

替代方案

symfony-hexagonal-skill 對比其他方案

替代方案何時用它替代權衡
Deptrac static analysisYou want rule-based static enforcement of layeringNo refactor help; purely gates violations
craftcms-claude-skillYou're on Craft CMS, not SymfonyDifferent framework

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills