agentsclimarketplace

D2 diagram

Skill ajaygunalan/flow-friction/skills/d2-diagram

Claude Code skills for researchers, by a researcher. Humans + agents exploring what hasn't been built yet — without losing alignment along the way.

Install
npx -y skills add ajaygunalan/flow-friction --skill d2-diagram

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Create D2 diagrams. Triggers on "create a diagram," "visualize," "draw architecture," "show relationships."

SKILL.md

5.3 KB, as published. Nobody here has run it

D2 Diagram Skill

Style guide and rules for creating D2 diagrams. You already know D2 syntax — this tells you how to style, not how to write D2.

Other skills that generate D2 diagrams (walkthrough, index-codebase, index-sync) must follow these rules for visual consistency.

Mandatory Defaults

Every diagram starts with this skeleton:

vars: {
  d2-config: {
    layout-engine: elk
    theme-id: 0
  }
}

direction: down

classes: {
  # Define one class per semantic group — see Color Palette below
}

Style Rules

  1. Layout: Always ELK. Always theme 0 (Neutral Default).
  2. Classes: Define one class per semantic group. Every container/node gets a class. Never inline style.* on individual nodes.
  3. Labels: Single-line "name — short role". Never use |md ... | markdown blocks — they bloat nodes.
  4. Border-radius: Always border-radius: 8 on classes.
  5. Colors: Each class gets a fill (light), stroke (saturated), font-color (dark) from the same hue. Max 5-6 colors per diagram.
  6. Infrastructure noise: Omit config/utility connections that go everywhere. Mention them in prose below the diagram instead.
  7. Independent containers: When containers have no natural connections, add light guide connections to force vertical stacking: A -> B: "label" {style.stroke-dash: 3; style.opacity: 0.4}
  8. Container size: 3-7 nodes per container. Fewer than 3 = unnecessary grouping. More than 7 = split into sub-containers.
  9. Shapes: Use oval for start/end, diamond for decisions, rectangle (default) for everything else. Don't over-differentiate.
  10. Connection labels: 1-4 words max. Omit labels on obvious connections.
  11. Title: Every diagram gets a title: title: Name — Subtitle { shape: text; near: top-center; style.font-size: 24; style.bold: true }

Color Palette

Reusable hues — pick what fits, stay consistent within a diagram:

Namefillstrokefont-colorUse for
Blue#DBEAFE#2563EB#1E40AFCore/control, primary subsystems, model/compute
Green#DCFCE7#16A34A#166534Simulation, plant, success, output/results
Amber#FEF3C7#D97706#92400EHardware, actuators, warnings, monitoring
Purple#F3E8FF#9333EA#6B21A8Visualization, orchestration, inference
Slate#F1F5F9#64748B#334155Entry points, terminals, neutral, raw input
Teal#CCFBF1#0D9488#115E59Geometry, secondary compute, calibration
Rose#FFE4E6#E11D48#9F1239Safety-critical, force control, error paths
Indigo#E0E7FF#4338CA#3730A3Low-level tracking, secondary pipelines

Domain Color Mappings

When working in these domains, prefer these semantic color assignments:

Robotics (perception-planning-action):

LayerColorRationale
Sensors / perceptionGreenInput/plant data
Planning / decisionBlueCore compute
Control / actuationAmberHardware-facing
Safety / barriersRoseCritical path
Visualization / loggingPurpleObservation

ML / Deep Learning pipelines:

StageColorRationale
Data ingestion / raw inputSlateNeutral entry
Preprocessing / featuresTealTransform step
Model / trainingBlueCore compute
Evaluation / outputGreenResults
Monitoring / experiment trackingAmberObservation
Inference / servingPurpleDeployment

Scientific computing / simulation:

ComponentColorRationale
Physics plant / environmentGreenPhysical system
Solver / optimizerBlueCore compute
Sensor / measurementTealObservation
Low-level tracking / integrationIndigoSecondary pipeline
Hardware interfaceAmberPhysical I/O
VisualizationPurpleLogging

Domain Shape Conventions

Beyond the basic shapes (rule 9), these shapes carry specific meaning in technical domains:

ShapeUse forDomain
rectangleProcessing block, module, layer, systemAll
ovalStart/end state, terminalState machines
diamondDecision, branch, choiceState machines, pipelines
cylinderData store, database, feature store, model registryML, data systems
hexagonFusion node, gateway, load balancerPerception, distributed
queueMessage queue, buffer, FIFOReal-time systems
parallelogramI/O data, raw sensor streamDataflow diagrams

Don't use more than 3 shape types per diagram. Shapes distinguish categories, not individuals.

Class Template

classes: {
  my_class: {
    style: {
      fill: "#DBEAFE"
      stroke: "#2563EB"
      border-radius: 8
      font-color: "#1E40AF"
    }
  }
}

For state machines, add shape: oval or shape: diamond inside the class.

Icons

Only use URLs from references/d2_validated_icons_list.md. Use sparingly — icons on key external-facing nodes only, not on every box.

Syntax Reference

See references/d2_syntax_reference.md for shapes, connections, grids, and advanced features. Only consult when you need a specific syntax pattern.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.