event-contract-matrix
Skill5 starsChanged 4 months agoMITView on GitHub
Maintain an explicit matrix of which module dispatches each event and which modules listen — many-to-many, with deliberate bypass sites noted — so event contracts stay a single source of truth. Use in event-driven or pub/sub systems where events cross module boundaries.
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-conventionsSkill
- defensive-patternsSkill
- extension-points-and-seamsSkill
- module-layeringSkill
- documentation-placementSkill
- prose-standardSkill
- code-reviewSkill
- decision-recordsSkill
- minimal-evidence-checksSkill
- postmortemSkill
- pr-history-hygieneSkill
- responding-to-review-on-a-stackSkill
- runtime-invariantsSkill
- testing-tiersSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Review it like a contract: When a dispatch or listen site changes, verify the matrix still matches before merging.
- Distinctive: line 38
Every boundary-crossing event appears with its producers and listeners.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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.
Files
Event Contract Matrix
A discipline for documenting who produces and who consumes each event in an event-driven or pub/sub system. It keeps the event contracts a single source of truth, so a change to a producer or consumer is visible against the whole graph instead of being discovered per call site.
The defining constraint: the matrix records the many-to-many relationship — each event lists its dispatch sites and its listeners — and explicitly notes sites that deliberately bypass the normal emit path. An event contract is not just "this event exists"; it is who can hear it.
What the matrix records
- One row (or entry) per event, listing:
- the producer(s) that dispatch it — including any dispatch site that deliberately bypasses the standard emit path (e.g. containment-driven dispatch), so those are visible rather than a hidden surprise;
- the listener(s) that receive it.
- The relationship shape: many-to-many, so the matrix is a table of event → producers and event → listeners, not one large implicit graph.
A dense many-to-many relation is best presented as a table rather than a sprawling graph — one event per row, producers and listeners as columns.
Keeping it a single source of truth
- Update the matrix in the same change that changes an event contract — a new event, a new producer, a new listener, or a new bypass site. Do not let the matrix drift from the code.
- Treat the matrix as the contract's home. Where a contract is defined, link to the matrix; do not restate the producer/listener list in multiple places.
- Review it like a contract. When a dispatch or listen site changes, verify the matrix still matches before merging.
Workflow
- Enumerate the events that cross module boundaries.
- For each event, record its producers and listeners — including bypass sites.
- Choose the presentation — a table for many-to-many relations, kept dense and readable.
- Update it with each contract change in the same change; link from the contract's definition.
- Verify the matrix matches the code before merging.
Completion criteria
- Every boundary-crossing event appears with its producers and listeners.
- Deliberate bypass sites are explicitly noted, not hidden.
- The matrix is the single home for producer/listener relationships; other docs link, not restate.
- It is updated in the same change as any event-contract change and verified before merge.
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
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.

