Skip to content
Agentmart
Submit a tool

code-flow-scope-colors

Adds reusable scope-based color labels to MongoDB code-flow explanations.

Skill by enricogolfieri

IndexedUnlicense★ 1
Write a review

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-code-flow-scope-colors

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.

We use your email only for this newsletter. Privacy

About

Adds reusable scope-based color labels to MongoDB code-flow explanations. Diagrams must use abstract assignment notation (colored lhs = rhs, gates, scope open/close) for every flow—not only oplog timestamps. Use for OperationContext, WUOW, RecoveryUnit, oplog, catalog, routing, yield, acquisition, multikey, or any scope boundary.

Use cases: design

No 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/code-flow-scope-colors

What's inside

Skill name
code-flow-scope-colors
Description
Adds reusable scope-based color labels to MongoDB code-flow explanations. Diagrams must use abstract assignment notation (colored lhs = rhs, gates, scope open/close) for every flow—not only oplog timestamps. Use for OperationContext, WUOW, RecoveryUnit, oplog, catalog, routing, yield, acquisition, multikey, or any scope boundary.
License
Unlicense
Instructions
514 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: "code-flow-scope-colors" does not match folder "color-flow-scope-colors"
  • body: 514 lines (spec recommends under 500)

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Code Flow Scope Colors

## Mandatory Output Rule

**Every response using this skill MUST:**

1. Begin with an **Adapted Scope Palette** (only colors used in this flow).
2. Include **abstract assignment blocks** (`coloredField = expr`, gates, scope open/close) for the
   whole flow — not only timestamp or oplog sections.
3. End with the **Invariant Prompt**.

Do not dump the full canonical palette unless all nine colors appear. Never assign a color without
saying what scope it denotes. Never explain a flow with call names and arrows alone.

## Core Rule

Color by **owning scope / lifetime**, not by function name or call site.

**Diagrams are abstract assignment code**, not narrated call graphs. Show what gets stored where,
with `=` for every mutation or scope crossing. Use `->` only for sequencing (open WUOW, then
commit), never as a substitute for `dest = source`.

**Do not color a function call** unless you are naming the scope it establishes. Prefer the state
the call creates:

```text
// Wrong
⚪ acquireCollection() -> applyOperation_inlock()

// Right
🟢 TransactionResources += CollectionAcquisition request   // extends 🟢 opCtx bundle
⚪ collHandle = view into 🟢 TransactionResources           // stack-local ref
```

## Canonical Scope Palette

Reference definitions. Copy only the entries you use into the Adapted Scope Palette and adjust
wording when the flow needs a sharper label.

```text
⚫ black  = durable/on-disk state
           RecordStore bytes, SortedDataInterface entries, _mdb_catalog records,
           durable oplog records, persisted config collections.

🔴 red    = in-memory catalog / metadata view
           CollectionCatalog, IndexCatalog, IndexCatalogEntry, CollectionPtr metadata,
           in-memory multikey state, in-memory routing-independent catalog metadata.

🟡 yellow = oplog / replicated payload
           OplogEntry, DurableOplogEntry, applyOps payload, prepare/commit oplog entries,
           op.timestamp, op.object, op.nss, op.uuid.

🟢 green  = OperationContext scope and opCtx decorations
           MultikeyPathTracker, Locker, CurOp, RecoveryUnit access through opCtx,
           TransactionResources, OperationShardingState, request-local state
           attached to the current operation.

🟠 orange = ServiceContext / process-global service scope and decorations
           StorageEngine, ReplicationCoordinator, OpObserver, global services,
           server-wide feature flags, failpoints, service-level registries,
           CursorManager stashed resources.

⚪ white  = WriteUnitOfWork / local lexical scope
           WUOW lifetime, variables created inside the WUOW, rollback hooks,
           scoped guards, stack-local temporaries, per-WUOW derived state.
           NOT opCtx decorations, NOT acquisition handles, NOT API entry points.

🟣 purple = RecoveryUnit / storage transaction in-memory state
           RU timestamp, commit timestamp, prepare timestamp, snapshot state,
           WiredTiger transaction state before durability.

🟤 brown  = routing / sharding / placement metadata
           ShardVersion, DatabaseVersion, ChunkManager, CatalogCache,
           placement info, routing table state, ownership filter, RangePreserver.

🔵 blue   = client request / command payload before it becomes oplog
           InsertCommandRequest, UpdateRequest, DeleteRequest, parsed command,
           query specs, update specs, router-attached version fields.
```

## Adapted Scope Palette

Build this at the top of every response. Include only colors used below. Extend or narrow canonical
definitions when the flow requires it.

Example for shard-role acquisition:

```text
Adapted palette (shard role acquisition):

🔵  Incoming command + router-attached ShardVersion / DatabaseVersion
🟢  OperationContext decorations: OperationShardingState, TransactionResources,
    locks; CollectionAcquisition is a ref-counted view into this scope
🔴  In-memory local catalog snapshot: CollectionCatalog, CollectionPtr
🟤  Sharding placement: PlacementConcern, ownership filter, RangePreserver
🟣  Storage snapshot opened to match the catalog read
⚫  Durable bytes read/written through the pinned catalog view
⚪  WriteUnitOfWork wrapping individual document writes (separate from acquisition)
```

## Assignment & Scope-Change Notation (mandatory — all flows)

**Every diagram** for any topic (oplog, yield, acquisition, multikey, sharding, commands) must use
this notation. Specialized sections below are **templates**, not exceptions.

### Required elements

| Element           | Syntax                                           | When                                                |
| ----------------- | ------------------------------------------------ | --------------------------------------------------- |
| Copy / promote    | `🟢 dst = 🟡 src`                                | Value crosses scope; recolor on RHS if type changes |
| In-place mutate   | `🔴 entry.flags \|= MULTIKEY`                    | Field updated inside same scope                     |
| Gate              | `canX = false — because <scope condition>`       | Branch chooses which assignments run                |
| Conditional write | `if canX: 🟣 field = expr`                       | Write may be skipped; say who owns it when false    |
| Scope open        | `⚪ wuow = WriteUnitOfWork { open }`             | New lexical lifetime                                |
| Scope close       | `⚪ wuow.commit()` / `destroy`                   | End lifetime; show what 🟣/⚫ gains                 |
| Detach            | `⚪ bundle = 🟢 resources; 🟢 resources = empty` | Ownership leaves opCtx                              |
| Attach            | `🟢 resources = ⚪ bundle`                       | Restore                                             |
| Derive            | `🟡 subOpᵢ = extract(🟡 parent)`                 | New objects in same or new scope                    |
| Invalidate        | `🔴 CollectionPtr = UNSAFE`                      | Handle outlives valid view                          |

From enricogolfieri/workspace-mongo, Unlicense.

More from enricogolfieri/workspace-mongo

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

More from enricogolfieri

Cite this page

code-flow-scope-colors skill. Agent Mart. https://agentmart.dev/skills/enricogolfieri-code-flow-scope-colors (last updated 2026-10-24)