agentleFS
IdraDevIdraDev/Diagrammer/.cursor/rules/diagrammer.mdc

Diagrammer / rules

Cursor rule11 starsChanged 7 months agoMITView on GitHub

Author Diagrammer JSON for the Diagrammer viewer. Use whenever the user asks for a mind map, concept map, flowchart, tree, dependency graph, ER diagram, or timeline. Output a single JSON document conforming to the schema below.

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

Show its rules and text

We split this diagrammer.mdc into the rules it gives an agent

15 rules. About 0 are common, 6 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the user is ambiguous, ask one clarifying question — or default to mindmap for "brainstorm" / "outline" intents, and flowchart for …

    line 40
  2. Very specific:

    Avoid links inside node labels.

    line 75
  3. Very specific:

    Leave most nodes at shape: "rounded" and color: "default".

    line 85
  4. Very specific:

    Default direction is forward (single arrow at to).

    line 100
  5. Very specific:

    Use dashed for weak / conditional / async links.

    line 101
  6. Very specific:

    Keep labels concise. Move detail into description.

    line 109
  7. Very specific:

    Avoid cycles in tree and flowchart.

    line 111
  8. Distinctive:

    Use this when the user asks to compare/show several small diagrams together, or to lay out parallel sub-trees, parallel flows, sibling ER …

    line 125
  9. Very specific:

    Use meta.tags or per-node description to explain what each group represents — there is no dedicated group field.

    line 128
  10. Very specific:

    Default is "forward". Pick "none" for ER associations or concept-map links that have no inherent direction.

    line 143
  11. Distinctive:

    Do not include id collisions, dangling edges, or unreferenced isolated nodes (unless the user's request explicitly calls for them).

    line 262
  12. Distinctive:

    Do not repeat the same idea under multiple ids — collapse synonyms.

    line 264
  13. Distinctive:

    Do not invent layout coordinates by guessing pixel positions.

    line 265
  14. Distinctive:

    Do not include emoji in labels.

    line 268
  15. Distinctive:

    Do not wrap the JSON in additional commentary unless asked.

    line 269

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
diagrammer.mdc
---
description: Author Diagrammer JSON for the Diagrammer viewer. Use whenever the user asks for a mind map, concept map, flowchart, tree, dependency graph, ER diagram, or timeline. Output a single JSON document conforming to the schema below.
globs:
  - "**/*"
alwaysApply: false
---

# Diagrammer authoring guide

You are producing a single JSON document that the Diagrammer viewer will
render on a pannable, zoomable canvas. Do not output prose around the JSON
unless the user explicitly asks for it; emit one fenced JSON block.

## Output contract

- Top-level keys: `version`, `type`, `title`, `nodes`, `edges`. Optional:
  `description`, `meta`.
- `version` MUST be the string `"1"`.
- `type` MUST be one of: `mindmap`, `tree`, `flowchart`, `graph`,
  `concept`, `timeline`. Pick the type that matches the user's intent — see
  the guidance below.
- `nodes[*].id` must be unique, stable, and URL-safe (`^[a-zA-Z0-9_-]+$`).
- `edges[*].from` and `edges[*].to` must reference existing node ids.
- You may include `x` / `y` (in pixels, node-center coordinates) when the
  user wants a hand-tuned layout. Otherwise omit them and let the viewer
  compute positions per type. Manual edits in the viewer's edit mode write
  these coordinates back when the user moves nodes.

## Choosing a type

| Type        | When to use                                                        |
| ----------- | ------------------------------------------------------------------ |
| `mindmap`   | Brainstorming, branches radiating from a single central topic.    |
| `tree`      | Strict hierarchy with one parent per child (org chart, taxonomy). |
| `flowchart` | Process or decision flow with directed steps.                     |
| `graph`     | Arbitrary network: dependencies, relationships, citations, **ER diagrams**. |
| `concept`   | Concept map with labelled, often bidirectional, links.            |
| `timeline`  | Linear sequence of events or milestones.                          |

If the user is ambiguous, ask one clarifying question — or default to
`mindmap` for "brainstorm" / "outline" intents, and `flowchart` for "process"
/ "how does X work" intents.

## Node fields

```ts
{
  id: string                  // unique, stable, URL-safe
  label: string               // short, ideally <= 40 chars
  description?: string        // single-line subtitle, <= 80 chars
  shape?:    'rectangle' | 'rounded' | 'ellipse' | 'diamond' | 'hexagon' | 'pill'
  color?:    'default' | 'slate' | 'blue' | 'green' | 'amber' | 'rose' | 'violet' | 'cyan'
  emphasis?: 'normal' | 'strong' | 'subtle'
  parent?:   string           // hint for tree/mindmap hierarchy
}
```

### Markdown formatting

Labels, descriptions, edge labels, and the map title render a small subset
of inline markdown. Use it to add typographic emphasis or to mark up
identifiers — not as decoration.

| Syntax          | Renders as                              |
| --------------- | --------------------------------------- |
| `**bold**`      | bold text                               |
| `*italic*`      | italic                                  |
| `_italic_`      | italic                                  |
| `` `code` ``    | inline monospace, e.g. for identifiers  |
| `~~strike~~`    | strikethrough                           |
| `[text](url)`   | link (opens in a new tab)               |

Nesting is allowed (`**` `` `code` `` `**`). Markup that doesn't match these
delimiters renders literally — no headings, lists, paragraphs, or HTML.
Avoid links inside node labels; put them in `description` instead.

### Visual conventions (use sparingly)

- `emphasis: "strong"` on the central node of a mindmap or the root of a tree.
- `shape: "diamond"` for decisions/branches in flowcharts.
- `shape: "pill"` for terminal/IO nodes (start, end, external service).
- `color: "rose"` for failure / error / risk nodes; `color: "green"` for
  success; `color: "amber"` for warnings or caveats. Use color to convey
  meaning, not decoration.
- Leave most nodes at `shape: "rounded"` and `color: "default"`. Restraint
  reads as design.

## Edge fields

```ts
{
  from: string                // node id
  to:   string                // node id
  label?:     string          // edge label, e.g. "yes", "no", "depends on"
  style?:     'solid' | 'dashed' | 'dotted'
  direction?: 'forward' | 'backward' | 'both' | 'none'
}
```

- Default direction is `forward` (single arrow at `to`).
- Use `dashed` for weak / conditional / async links; `dotted` for very weak
  or implied relationships.

## Sizing guidance

- 5–25 nodes per map is the sweet spot. Past 30, the viewer remains usable but
  comprehension drops. Split into multiple maps if the user's request implies
  more.
- Keep labels concise. Move detail into `description`. Move long explanations
  out of the map entirely.
- Avoid cycles in `tree` and `flowchart`. Use `graph` or `concept` if
  cycles are essential.

## Multiple groups in one map

A single map can contain **multiple disconnected sub-diagrams** that share the
canvas without being linked. The viewer detects connected components
automatically (via edges + `parent` hints) and lays each out independently,
packing them side-by-side with padding. No special syntax is required:

- Just emit the nodes and edges for each group. Anything that has no edge or
  `parent` link to another group becomes its own cluster.
- The same `type` is applied to every component (e.g. all clusters use
  `mindmap` layout if `type: "mindmap"`).
- Use this when the user asks to compare/show several small diagrams together,
  or to lay out parallel sub-trees, parallel flows, sibling ER schemas, etc.

Use `meta.tags` or per-node `description` to explain what each group
represents — there is no dedicated `group` field.

## Edge marker (line / arrow / double / back)

The `direction` field controls the arrowheads on the edge — i.e. the
visual marker between the two endpoints:

| `direction`  | Marker         | When to use                                       |
| ------------ | -------------- | ------------------------------------------------- |
| `"none"`     | line `—`       | Symmetric / undirected association.               |
| `"forward"`  | arrow `→`      | Directed link from `from` to `to` (default).      |
| `"both"`     | double `↔`     | Bidirectional / mutual relationship.              |
| `"backward"` | back arrow `←` | Reversed direction (rare; usually re-order ends). |

Default is `"forward"`. Pick `"none"` for ER associations or concept-map links
that have no inherent direction; `"both"` for ER many-to-many relationships,
mutual dependencies, or symmetric concept-map links.

## ER diagrams (entity–relationship)

ER diagrams are authored with `type: "graph"`. The schema has no dedicated
attribute list, but the existing fields cover the common case:

- **Entity** → one node per table/entity. Set `shape: "rectangle"` and
  `label: "**EntityName**"` (bold). Use `description` to list the
  attributes inline, comma-separated, with `(PK)` / `(FK)` markers — keep
  it under ~80 chars; if the entity is wide, split it into two lines via
  multiple short attributes or move secondary fields out of the diagram.
- **Weak entity / lookup** → `color: "slate"` and/or `emphasis: "subtle"`.
- **Primary domain entity** → `color: "blue"` or `emphasis: "strong"`.
- **Relationship** → an edge between the two entities. Put the verb plus
  cardinality in `label`, e.g. `"places (1—N)"`, `"has (1—1)"`,
  `"tagged with (M—N)"`. Use `direction: "both"` when the relationship is
  not directional (most ER links).
- **Chen-style explicit relationship node** (optional, only when the
  relationship itself carries attributes): add an intermediate node with
  `shape: "diamond"` and edges `entityA → relNode → entityB`, each edge
  labelled with its side's cardinality (`1`, `N`, `M`).
- **Cardinality notation**: pick one and stay consistent. Recommended:
  `1—1`, `1—N`, `M—N`. Also acceptable: `1..1`, `0..N`, `1..*`.

### ER worked example

```json
{
  "version": "1",
  "type": "graph",
  "title": "Order management ER",
  "description": "Customers, orders, line items, products.",
  "nodes": [
    {
      "id": "customer",
      "label": "**Customer**",
      "description": "id (PK), email, name, created_at",
      "shape": "rectangle",
      "color": "blue",
      "emphasis": "strong"
    },
    {
      "id": "order",
      "label": "**Order**",
      "description": "id (PK), customer_id (FK), placed_at, status",
      "shape": "rectangle",
      "color": "blue"
    },
    {
      "id": "line_item",
      "label": "**LineItem**",
      "description": "id (PK), order_id (FK), product_id (FK), qty, unit_price",
      "shape": "rectangle"
    },
    {
      "id": "product",
      "label": "**Product**",
      "description": "id (PK), sku, name, price",
      "shape": "rectangle",
      "color": "green"
    },
    {
      "id": "category",
      "label": "**Category**",
      "description": "id (PK), name",
      "shape": "rectangle",
      "color": "slate",
      "emphasis": "subtle"
    }
  ],
  "edges": [
    { "from": "customer", "to": "order",     "label": "places (1—N)",      "direction": "both" },
    { "from": "order",    "to": "line_item", "label": "contains (1—N)",    "direction": "both" },
    { "from": "product",  "to": "line_item", "label": "appears in (1—N)",  "direction": "both" },
    { "from": "category", "to": "product",   "label": "groups (1—N)",      "direction": "both" }
  ]
}
```

## Worked example

```json
{
  "version": "1",
  "type": "flowchart",
  "title": "Password reset flow",
  "description": "Happy path and failure branches.",
  "nodes": [
    { "id": "start",   "label": "User clicks 'Forgot password'", "shape": "pill" },
    { "id": "form",    "label": "Email entry", "shape": "rounded" },
    { "id": "lookup",  "label": "User exists?", "shape": "diamond", "color": "amber" },
    { "id": "send",    "label": "Send reset email", "shape": "rounded", "color": "blue" },
    { "id": "ack",     "label": "Generic ack screen", "shape": "rounded" },
    { "id": "click",   "label": "User clicks token", "shape": "rounded" },
    { "id": "valid",   "label": "Token valid?", "shape": "diamond", "color": "amber" },
    { "id": "set",     "label": "Set new password", "shape": "rounded", "color": "green" },
    { "id": "expired", "label": "Show expired notice", "shape": "rounded", "color": "rose" },
    { "id": "done",    "label": "Done", "shape": "pill", "color": "green", "emphasis": "strong" }
  ],
  "edges": [
    { "from": "start",   "to": "form" },
    { "from": "form",    "to": "lookup" },
    { "from": "lookup",  "to": "send",    "label": "yes" },
    { "from": "lookup",  "to": "ack",     "label": "no",  "style": "dashed" },
    { "from": "send",    "to": "ack" },
    { "from": "ack",     "to": "click" },
    { "from": "click",   "to": "valid" },
    { "from": "valid",   "to": "set",     "label": "yes" },
    { "from": "valid",   "to": "expired", "label": "no",  "style": "dashed" },
    { "from": "set",     "to": "done" }
  ]
}
```

## Anti-patterns

- Do **not** include id collisions, dangling edges, or unreferenced isolated
  nodes (unless the user's request explicitly calls for them).
- Do **not** repeat the same idea under multiple ids — collapse synonyms.
- Do **not** invent layout coordinates by guessing pixel positions; let the
  viewer compute them unless the user explicitly asks for a custom layout
  (e.g. by editing in the viewer first).
- Do **not** include emoji in labels.
- Do **not** wrap the JSON in additional commentary unless asked. The user
  will paste the JSON directly into the viewer.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.