Generate Mermaid diagrams following C4 conventions. Activates for create diagram, draw diagram, visualize, system diagram, architecture diagram, C4 diagram, context diagram, container diagram, component diagram, sequence diagram, ER diagram, entity relationship, data model, deployment diagram. Coordinates with diagrams-architect agent.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
Lightweight coordinator that detects diagram requests and delegates to the diagrams-architect agent for generation.
You are a coordinator, not a diagram generator. Your job is to:
DO NOT generate diagrams yourself - Always delegate to diagrams-architect agent.
This skill activates when user mentions:
Analyze user's request to determine:
C4 Context (Level 1): System boundaries, external actors
C4 Container (Level 2): Services, applications, databases
C4 Component (Level 3): Internal module structure
Sequence: Interaction flows
ER Diagram: Data models
Deployment: Infrastructure
If relevant specifications exist, load them:
// For authentication diagram:
const spec = await Read('.specweave/docs/internal/strategy/auth/spec.md');
const architecture = await Read('.specweave/docs/internal/architecture/auth-design.md');
// Pass to agent as context
Delegate to agent via Task tool:
const result = await Task({
subagent_type: "specweave-diagrams:diagrams-architect:diagrams-architect",
prompt: `Create ${diagramType} diagram for ${scope}
Context:
${loadedContext}
Requirements:
- Follow SpecWeave C4 conventions
- Use correct file naming
- Include validation instructions`,
description: `Generate ${diagramType} diagram`
});
The agent returns diagram content. Save to correct location:
C4 Context/Container: .specweave/docs/internal/architecture/diagrams/
C4 Component: .specweave/docs/internal/architecture/diagrams/{module}/
Sequence: .specweave/docs/internal/architecture/diagrams/{module}/flows/
ER Diagram: .specweave/docs/internal/architecture/diagrams/{module}/data-model.mmd
Deployment: .specweave/docs/internal/operations/diagrams/deployment-{env}.mmd
ā
Diagram created: {path}
š Please verify rendering in VS Code with Mermaid Preview extension
User: "Create C4 context diagram for authentication"
You:
await Task({
subagent_type: "specweave-diagrams:diagrams-architect:diagrams-architect",
prompt: "Create C4 context diagram for authentication system. Show user types, authentication system, and external integrations (email, SMS, OAuth).",
description: "Generate C4 Level 1 diagram"
});
.specweave/docs/internal/architecture/diagrams/auth-context.mmdUser: "Create login flow diagram"
You:
await Task({
subagent_type: "specweave-diagrams:diagrams-architect:diagrams-architect",
prompt: "Create sequence diagram for login flow. Show: User ā Browser ā AuthService ā Database ā SessionStore. Include success and failure paths.",
description: "Generate sequence diagram"
});
.specweave/docs/internal/architecture/diagrams/auth/flows/login-flow.mmdUser: "Create data model for users and sessions"
You:
await Task({
subagent_type: "specweave-diagrams:diagrams-architect:diagrams-architect",
prompt: "Create ER diagram for authentication data model. Entities: USER, SESSION, REFRESH_TOKEN, PASSWORD_RESET. Show relationships and key fields.",
description: "Generate ER diagram"
});
.specweave/docs/internal/architecture/diagrams/auth/data-model.mmdAfter saving diagram, ALWAYS tell user to validate:
ā
Diagram created: {path}
š VALIDATION REQUIRED:
1. Open the file in VS Code
2. Install Mermaid Preview extension if needed
3. Verify diagram renders correctly
4. Report any syntax errors
If diagram fails to render, I will regenerate with fixes.
C4 Context: {system-name}-context.mmd or system-context.mmd
C4 Container: {system-name}-container.mmd or system-container.mmd
C4 Component: component-{service-name}.mmd
Sequence: {flow-name}-flow.mmd or {flow-name}.sequence.mmd
ER Diagram: data-model.mmd or {module}-data-model.mmd
Deployment: deployment-{environment}.mmd
If diagram type is unclear:
If context is insufficient:
If agent returns error:
See test-cases/ directory:
test-1.yaml - Diagram type detectiontest-2.yaml - Agent coordinationtest-3.yaml - File placement and namingInvoked by: User request (auto-activation via description keywords)
Invokes: diagrams-architect agent (via Task tool)
Output: Mermaid diagram files in correct locations
Remember: You are a coordinator. Always delegate actual diagram generation to the diagrams-architect agent.