distributed-code-flow-diagrams
Generate scoped Mermaid diagrams for distributed code flows.
Skill by enricogolfieri
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/enricogolfieri-distributed-code-flow-diagrams
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/distributed-code-flow-diagrams
What's inside
- Skill name
distributed-code-flow-diagrams- Description
- Generate scoped Mermaid diagrams for distributed code flows. Use when the user asks for a diagram, mental model, flow, lifecycle, protocol, who-does-what-when explanation, when analyzing a diff or before/after PR change, or when reasoning about replication, sharding, transactions, timestamps, or cross-node state.
- License
- Unlicense
- Instructions
- 281 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Distributed Code Flow Diagrams
## Purpose
Use this skill to explain confusing code by extracting the right actors in the algorithm and drawing them in the distributed context where correctness matters. Do not draw only the local call stack when the bug or invariant crosses replication, sharding, transaction, timestamp, or metadata boundaries.
## Core Rule
Start with the distributed boundary, then add local components.
- Replication: include the primary node and relevant primary components, the oplog or replicated log entry, and the secondary node with relevant apply components.
- Sharding: include `Mongos`, the primary or target shard, participant shards, and `ConfigServer` when routing, placement, metadata, coordinator state, or refresh is part of the flow.
- Transactions: include the parent transaction, side transaction if present, prepare, commit, abort, and visibility boundaries.
- Local-only flows: include only the components that own state transitions or payload transformations.
## Algorithm
1. Identify one anchor event.
Example: `wildcard index becomes multikey inside a transaction`.
2. Classify the scope:
- local only
- replication
- sharding
- transaction
- mixed, such as sharded transaction or replicated transaction metadata
3. Create required actor lanes before adding local details.
- Replication lanes: `PrimaryNode`, `PrimaryIndexCatalog`, `Oplog`, `SecondaryApply`, `SecondaryIndexCatalog`.
- Sharding lanes: `Mongos`, `CatalogCache`, `PrimaryShard`, `ParticipantShardA`, `ParticipantShardB`, `ConfigServer`.
- Transaction lanes: `ParentTxn`, `SideTxn`, `CoordinatorShard`, `ParticipantShard`.
4. Add local components only where they explain ownership.
Avoid dumping every function. Prefer components that author state, transmit state, reconstruct state, validate state, or persist state.
5. Track payloads explicitly.
Examples: `multikeyPaths`, `multikeyMetadataKeys`, `setMultikeyMetadata`, `opTime`, `commitTimestamp`, `shardVersion`, `databaseVersion`, `routing metadata`.
6. Mark phase boundaries.
Examples: `before prepare`, `side txn commit`, `parent abort`, `secondary apply`, `participant decision`, `metadata refresh`, `critical section`.
7. After the diagram, add a short explanation answering:
- who authors the state
- how it is transmitted
- who reconstructs or derives it
- what must match across actors
8. If analyzing a **diff** (PR, branch, before/after): use **one lifecycle** with inline `⛔ OLD` / `✅ NEW` notes — see [Diff analysis](#diff-analysis-one-lifecycle-with-inline-beforeafter) below. Do not use `rect rgb`, `box`, or `classDef` for coloring.
## Mermaid Choices
- Use `sequenceDiagram` for lifecycles, transactions, replication, and sharding protocols.
- Use `flowchart TD` for decision trees or single-node algorithms.
- Prefer 4-8 participants. If more are needed, split into multiple diagrams.
- Use Mermaid-safe node IDs: no spaces, no reserved keywords, no styling.
### Renderer compatibility (Cursor, GitHub, many IDEs)
Do **not** rely on Mermaid color styling — it is often stripped or unsupported:
- `rect rgb(...)` / `rect #hex` — box outline may render; **fill color usually does not**
- `box green ...` — often **not visible** (needs Mermaid ~11+)
- `classDef fill:...` / `linkStyle stroke:...` — **often stripped**
Use **structure + emoji labels** instead of color. For full-color output, suggest [mermaid.live](https://mermaid.live) or an exported image.
## Diff analysis: one lifecycle with inline before/after
Use this when the user asks to explain a **diff**, **PR change**, **before vs after**, or when you are reviewing what a branch changed in a distributed flow.
### Rules
1. Draw **one** `sequenceDiagram` — the **after** lifecycle as the main arrow flow. Do not split into separate before/after charts unless the user asks.
2. At each **changed** step, add a `Note over` with both sides:
- `⛔ OLD: …` — removed or broken behavior
- `✅ NEW: …` — what replaces it
3. Prefix **new/changed message arrows** with `✅` in the label. Leave unchanged steps unmarked.
4. Keep the same participants and phase order as a plain lifecycle diagram — only annotate what the diff touches.
5. After the diagram, add a short read-this-as paragraph covering: who authors state now, what changed in transmission/reconstruction, and what invariants must still match.
### Template
```mermaid
sequenceDiagram
participant Client
participant ParentTxn as Parent txn
participant SideTxn as Side txn
participant Index
participant Oplog
participant Secondary
participant Planner
Client->>ParentTxn: anchor event (unchanged — no emoji)
Note over ParentTxn,Index: ⛔ OLD: …<br/>✅ NEW: …
ParentTxn->>SideTxn: ✅ new or changed step
SideTxn->>Index: ✅ …
SideTxn->>Oplog: ✅ …
Note over SideTxn,Oplog: ⛔ OLD: … (only if arrow label alone is not enough)
Client->>Planner: downstream read or apply (unchanged trigger)
Note over Planner,Index: ⛔ OLD: …<br/>✅ NEW: …
Planner->>Index: ✅ changed step
Oplog->>Secondary: apply (unchanged trigger)
Secondary->>Index: ✅ changed step
Note over Secondary,Index: ⛔ OLD: …
```
### Example: diff lifecycle (wildcard multikey in txn)
```mermaid
sequenceDiagram
participant Client
participant ParentTxn as Parent txn
participant SideTxn as Side txn
participant Index as Wildcard indexFrom enricogolfieri/workspace-mongo, Unlicense.
More from enricogolfieri/workspace-mongo
- 0.552score
trace-function
enricogolfieri
Statically trace what happens when a C++ function is called, including verified call edges, max-depth stack trace, and branch gates.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-implement
enricogolfieri
Implement an approved SERVER ticket plan: create branch, code+tests, validate, open a draft PR.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-plan
enricogolfieri
Start and plan a Jira ticket: load context, summarize scope, evaluate split, and produce an approved plan.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-resume
enricogolfieri
Resume a ticket from durable state and continue from its recorded phase.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-analyse
enricogolfieri
Analyse PERF tickets and register each new experiment in state.json (patch, comparison links, notes paths).
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-flush
enricogolfieri
Persist durable ticket session truth mid-chat: update state.json and create any memory files needed (context, session notes, experiment notes), indexed from…
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
write-mongo-jstests
enricogolfieri
Write focused MongoDB jstests with explicit mocha cases, small mechanical topology helpers, purposeful comments, robust teardown, and correct ownership.
SkillBFreshness: B★ 1Claude Code +9 - 0.544score
ticket-shared
enricogolfieri
Shared reference and state_memory.py for ticket-plan, ticket-implement, ticket-analyse, ticket-resume, and ticket-flush.
SkillBFreshness: B★ 1Claude Code +9 - 0.497score
mongo-pr-review
enricogolfieri
Performs deep pull request reviews by quickly explaining code changes and identifying potential bugs grouped by severity (critical, non-critical, nit).
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
extract-author-changes
enricogolfieri
Loads context for the current branch's PR-scope changes (merge-base to HEAD), including uncommitted edits, then confirms without summarizing.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
hot-bf-pings
enricogolfieri
Drafts Slack ping messages for hot Build Failures (BFs) from a Jira filter, listing the assignee, the SERVER dependency ticket, the GitHub PR, and a one-line…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
mongo-failure-investigator
enricogolfieri
Investigates MongoDB test failures from a local log file (./tests.log).
SkillCFreshness: C★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 15, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Unlicense
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from enricogolfieri
- 0.552score
trace-function
enricogolfieri
Statically trace what happens when a C++ function is called, including verified call edges, max-depth stack trace, and branch gates.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-analyse
enricogolfieri
Analyse PERF tickets and register each new experiment in state.json (patch, comparison links, notes paths).
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-flush
enricogolfieri
Persist durable ticket session truth mid-chat: update state.json and create any memory files needed (context, session notes, experiment notes), indexed from…
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-implement
enricogolfieri
Implement an approved SERVER ticket plan: create branch, code+tests, validate, open a draft PR.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-plan
enricogolfieri
Start and plan a Jira ticket: load context, summarize scope, evaluate split, and produce an approved plan.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ticket-resume
enricogolfieri
Resume a ticket from durable state and continue from its recorded phase.
SkillBFreshness: B★ 1Claude Code +9
Cite this page
distributed-code-flow-diagrams skill. Agent Mart. https://agentmart.dev/skills/enricogolfieri-distributed-code-flow-diagrams (last updated 2026-10-24)