From paivot-graph
Architecture-as-code using C4 model and Structurizr DSL. Use when the project has `architecture.c4` enabled in settings, or when the user asks about C4 diagrams, Structurizr, architecture boundaries, or dependency rules. Teaches agents how to maintain a canonical architecture model alongside ARCHITECTURE.md, declare machine-checkable boundaries, and export diagrams.
npx claudepluginhub paivot-ai/paivot-graph --plugin paivot-graphThis skill uses the workspace's default tool permissions.
Maintain a machine-checkable C4 architecture model alongside the narrative ARCHITECTURE.md. The model is the single source of truth for boundaries, dependencies, and diagrams.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
Maintain a machine-checkable C4 architecture model alongside the narrative ARCHITECTURE.md. The model is the single source of truth for boundaries, dependencies, and diagrams.
Check the project setting before using this skill:
pvg settings architecture.c4
true -- maintain the model, enforce boundaries, generate diagramsfalse (default) -- skip entirely, use narrative ARCHITECTURE.md onlyIf the setting is not enabled and the user hasn't asked for C4, do not use this skill.
workspace.dsl # Canonical C4 model (Structurizr DSL)
docs/diagrams/ # Generated diagram sources/artifacts (Mermaid/PlantUML; SVG/PNG via downstream renderers if needed)
ARCHITECTURE.md # Narrative architecture (always exists, references model)
The workspace.dsl file is version-controlled alongside code. It is the machine-checkable twin of ARCHITECTURE.md.
workspace "Project Name" "Brief description" {
model {
user = person "User" "End user of the system"
system = softwareSystem "My System" "What it does" {
web = container "Web App" "User-facing UI" "React"
api = container "API" "Business logic" "Go"
db = container "Database" "Persistent storage" "PostgreSQL" "Database"
}
# Relationships
user -> web "Uses" "HTTPS"
web -> api "Calls" "REST/JSON"
api -> db "Reads/writes" "SQL"
}
views {
systemContext system "Context" "System context diagram" {
include *
autoLayout
}
container system "Containers" "Container diagram" {
include *
autoLayout
}
styles {
element "Person" {
shape Person
background #08427B
color #ffffff
}
element "Software System" {
background #1168BD
color #ffffff
}
element "Container" {
background #438DD5
color #ffffff
}
element "Database" {
shape Cylinder
}
}
}
}
person <name> [description] [tags]
softwareSystem <name> [description] [tags] {
container <name> [description] [technology] [tags] {
component <name> [description] [technology] [tags]
}
}
Default tags added automatically: Element, Person, Software System, Container, Component.
source -> destination "Description" "Technology" "tags"
Inside an element block, use this:
container "API" {
this -> db "Reads from" "SQL"
}
Tags enable filtering in views and applying styles:
api = container "API" "Business logic" "Go" "Critical"
# Or inside the block:
container "API" {
tags "Critical" "Backend"
properties {
owner "team-billing"
code "services/api/**"
}
}
systemContext <system-id> [key] [description] {
include *
autoLayout [tb|bt|lr|rl]
}
container <system-id> [key] [description] {
include *
exclude "element.tag==Internal"
autoLayout
}
component <container-id> [key] [description] {
include *
autoLayout
}
deployment <system-id|*> <environment> [key] [description] {
include *
autoLayout
}
styles {
element "Tag" {
shape <Box|RoundedBox|Circle|Cylinder|Person|Hexagon|Folder|Pipe|...>
background #rrggbb
color #rrggbb
border <solid|dashed|dotted>
fontSize <integer>
}
relationship "Tag" {
color #rrggbb
style <solid|dashed|dotted>
thickness <integer>
}
}
When C4 is enabled, the Architect MUST include a machine-checkable Architecture Contract section in ARCHITECTURE.md. This section is parseable YAML embedded in a fenced code block:
## Architecture Contract
```yaml
contract_version: 1
boundaries:
- id: billing.service
kind: container
code:
- services/billing/**
exposes:
- services/billing/api/**
- id: shared.domain
kind: component
code:
- libs/domain/**
dependency_rules:
allow:
- billing.service -> shared.domain
- billing.service -> shared.logging
deny:
- billing.service -> *.database_direct
notes:
- "All DB access goes through shared.persistence"
```
Rules:
id matching an element in workspace.dslcode maps boundaries to file paths (globs)exposes declares public interfaces (other boundaries may only import from these paths)dependency_rules are machine-checkable: allow is the whitelist, deny is the blacklistcontract_version on any boundary or rule changeWhen C4 is enabled:
workspace.dsl alongside ARCHITECTURE.mdworkspace.dsl elements consistent with the contract boundariesThe narrative in ARCHITECTURE.md explains why. The DSL and contract define what -- machine-checkably.
When C4 is enabled, add to every story that touches code:
Add to the story's MANDATORY SKILLS TO REVIEW section:
c4 -- for boundary checkingWhen C4 is enabled, before coding:
After coding:
allow rulesworkspace.dsl and the Architecture Contractworkspace.dsl changed: regenerate diagramsWhen C4 is enabled, add to review checklist:
workspace.dsl has a matching contract entry# Export to Mermaid (for ARCHITECTURE.md embedding and draw.io)
structurizr-cli export -workspace workspace.dsl -format mermaid -output docs/diagrams/
# Export to PlantUML
structurizr-cli export -workspace workspace.dsl -format plantuml/c4plantuml -output docs/diagrams/
Requires Java 17+. Install: brew install structurizr-cli or download from GitHub.
If Structurizr CLI is not available, agents can generate Mermaid directly from the DSL model. The C4 elements map to Mermaid C4 syntax:
C4Context
title System Context Diagram
Person(user, "User", "End user")
System(system, "My System", "What it does")
System_Ext(ext, "External System", "Third-party service")
Rel(user, system, "Uses", "HTTPS")
Rel(system, ext, "Calls", "REST")
C4Container
title Container Diagram
Person(user, "User", "End user")
System_Boundary(system, "My System") {
Container(web, "Web App", "React", "User-facing UI")
Container(api, "API", "Go", "Business logic")
ContainerDb(db, "Database", "PostgreSQL", "Storage")
}
Rel(user, web, "Uses", "HTTPS")
Rel(web, api, "Calls", "REST/JSON")
Rel(api, db, "Reads/writes", "SQL")
This is the fallback path. Agents already know Mermaid -- this just standardizes the C4 dialect.
contract_version in the YAML blockarchitecture.c4 is false