Summary

A practitioner’s writeup on building a Claude Code Skill that analyzes Terraform infrastructure code and generates or updates valid Excalidraw JSON diagrams automatically. The author chose Skills (markdown knowledge files) over ad-hoc prompts, plugins, MCP servers, or hooks as the simplest feasible implementation for experimenting with diagram quality before investing in more complex tooling. The skill generates elbow arrows and proper labels for GCP infrastructure components.

作者為解決「架構圖永遠過時」的問題,建立了一個 Claude Code Skill,可分析 Terraform 程式碼並自動生成或更新 Excalidraw JSON 圖表。選擇 Skill(markdown 知識檔案)作為最簡可行方案,在投入更複雜工具前先驗證品質與可行性。

Key Points

  • Problem: Mermaid gets cluttered with 15+ resources; manual Excalidraw is always outdated; need auto-generation from codebase analysis
  • Solution: Claude Code Skill (markdown file teaching Claude the Excalidraw JSON format) — no scripts, no servers
  • Skill allows both generation and update — Claude understands the old diagram and compares against current codebase
  • Implementation options considered in order of complexity: ad-hoc prompts → Skills → plugin with slash command → MCP server → hooks
  • Skills chosen as lowest-effort starting point; more complex options available if quality/feasibility is validated
  • Source: GitHub at github.com/ooiyeefei/ccc

Insights

The approach of using progressive implementation complexity (Skills first, then plugins/MCP) is a sound engineering heuristic: validate the output quality of the simplest implementation before committing to infrastructure. The ability to update an existing diagram by comparing old diagram context against new codebase is a non-obvious Skill capability — most people think of Skills as generators, not diff-aware updaters. This pattern generalizes to any documentation that needs to stay synchronized with evolving code.

Connections

Raw Excerpt

“Most importantly, as I continue working on the project, Claude Code can update the diagram, by understanding the up-to-date codebase, comparing against the old diagram which give useful contexts sometimes.”