python-factory-plugin/skills/generate-diagrams/SKILL.md
Generate or update architecture diagrams using Python diagrams PNGs or inline SVG inside HTML artifacts.
npx skillsauth add ghiret/python-template generate-diagramsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You act as a Visualization Engineer. Your job is to create and update architecture diagrams based on findings from /review-docs.
Tooling: Choose the right output path:
diagrams PNGs for complex provider-icon topologies, cloud architecture, or diagrams with more than about 30 nodes.Use SVG-in-HTML when:
.html fileUse Python diagrams PNG when:
Skip this step if using SVG-in-HTML.
dot -V to check for Graphviz. If missing, warn and stop.uv run python -c "import diagrams" to check for the diagrams library. If missing, run uv add diagrams.Find the Documentation Drift Report in the conversation history or read the latest *.html report from agent_docs/reports/drift/. Focus on items tagged with [GENERATE-DIAGRAMS].
When using SVG-in-HTML:
<section> containing an inline <svg>.viewBox, semantic labels, and accessible title/description.Skeleton:
<section class="diagram" aria-labelledby="diagram-title">
<h2 id="diagram-title">System Flow</h2>
<svg viewBox="0 0 960 420" role="img" aria-labelledby="svg-title svg-desc">
<title id="svg-title">System Flow</title>
<desc id="svg-desc">Request flow from API to worker and database.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5"
markerWidth="6" markerHeight="6" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z"></path>
</marker>
</defs>
<rect x="40" y="80" width="180" height="72" rx="8"></rect>
<text x="130" y="122" text-anchor="middle">API</text>
<line x1="220" y1="116" x2="360" y2="116" marker-end="url(#arrow)"></line>
</svg>
</section>
Guidelines:
viewBox instead of fixed pixel-only sizing.<g>) for repeated node patterns.marker arrows for flows.Scan the codebase imports to determine the tech stack:
from diagrams.aws.compute import EC2from diagrams.gcp.compute import GCEfrom diagrams.k8s.compute import Podfrom diagrams.onprem.network import NginxWhen using Python diagrams:
*.py files that import diagramsfrom diagrams import Diagram, Cluster, Edge
# Import specific providers based on Step 3
with Diagram("Architecture", filename="docs/diagrams/architecture", show=False):
with Cluster("Service Group"):
svc = ComponentType("Service Name")
other >> Edge(label="calls") >> svc
Guidelines:
Cluster() to group related services>> for flow directionEdge(label="...") for labeled connectionsgraph_attr = {"concentrate": "true"} if edges overlapshow=False (we're running headless)For Python diagrams:
uv run python <script_path>.png was generated (check file exists and size > 0)For inline SVG:
<svg> has a viewBox, title/description, and no external references."Diagrams updated:
- Updated
docs/diagrams/architecture.py: added {component}- Generated
docs/diagrams/architecture.png({size} KB)Please review the generated PNG(s) visually."
from diagrams import Diagram, Cluster, Edge
from diagrams.aws.compute import EC2, Lambda
from diagrams.aws.database import RDS, DynamoDB
from diagrams.aws.network import ELB, APIGateway
from diagrams.onprem.compute import Server
from diagrams.onprem.database import PostgreSQL
from diagrams.onprem.network import Nginx
from diagrams.programming.language import Python
show=False for Python diagrams — no GUI available.development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
Post-execution QA. Compares code against plan, checks for redundancy, runs tests, identifies gaps.
testing
Fast test-quality audit. Detects slow, bloated, or misclassified tests before full verification runs.
testing
Lead Architect review of implementation plans. Checks for redundancy, architectural fit, and testability. Use when asked to "review this plan", "check my approach", or "critique this design".