map-dispatch-over-conditionals
Skill0 starsChanged 4 days agoMITView on GitHub
Use when stable named cases are implemented as long if or switch chains. Prefer table, map, or strategy dispatch with explicit fallback behavior.
In this repository108 other files it gives its agents.
- adaptive-estimationSkill
- adaptive-loop-budgetingSkill
- adopt-and-deleteSkill
- adversarial-reviewSkill
- agent-drives-uiSkill
- agentic-coding-loopSkill
- agent-otel-trajectorySkill
- agents-as-iac-modulesSkill
- ascii-ui-mockupsSkill
- authoring-html-emailSkill
- authoring-skills-vs-mcpSkill
- batched-ssh-enumerationSkill
- c4-architectureSkill
- challenge-the-premiseSkill
- codegraph-bootstrapSkill
- codegraph-worktree-startupSkill
- colocated-pod-tolerationsSkill
- command-creatorSkill
- complexity-budgetsSkill
- connector-readinessSkill
- context-anchored-patchingSkill
- continuous-issue-resolutionSkill
- credential-proxySkill
- criticality-tiered-reportingSkill
- data-connector-buildingSkill
- declarative-firstSkill
- disk-pressure-forensicsSkill
- early-return-over-elseSkill
- email-triageSkill
- enums-codify-behaviorSkill
- ephemeral-workspace-lifecycleSkill
- event-sourcingSkill
- evidence-claim-boundariesSkill
- exhaustive-matchSkill
- feature-coverage-not-just-line-coverageSkill
- full-disk-forensicsSkill
- gate-before-pushSkill
- github-pr-shepherdingSkill
- graceful-shutdown-stateful-agentsSkill
- grounded-generationSkill
- iac-incident-responseSkill
- iac-not-ad-hocSkill
- instrumented-service-scaffoldSkill
- interface-over-conditionalsSkill
- knowledge-routingSkill
- lean-on-oss-standardsSkill
- live-money-disciplineSkill
- live-state-verificationSkill
- loop-governance-and-learningSkill
- low-level-executor-task-specSkill
- merge-conflict-disciplineSkill
- mermaid-diagramsSkill
- oke-arc-runners-opentofuSkill
- orchestrate-agySkill
- orchestrate-claudeSkill
- orchestrate-codexSkill
- orchestrate-geminiSkill
- otel-emit-at-willSkill
- parameter-designSkill
- parse-dont-validateSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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 8
Use this skill when a conditional chain selects behavior by command, event type, status, provider, file kind, or another stable key.
- Distinctive: line 16
Put validation and fallback behavior next to the dispatch lookup.
- Distinctive: line 17
Keep each handler small and independently testable.
- Distinctive: line 18
Add or update tests for one normal case, the fallback case, and any case with special authorization, side effects, or error handling.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Map Dispatch Over Conditionals
Use this skill when a conditional chain selects behavior by command, event type, status, provider, file kind, or another stable key.
Workflow
- Confirm the cases are named and stable. If each branch has unrelated conditions, simplify the branches first instead of forcing a table.
- Define a dispatch table from key to function, object, class, or value.
- Put validation and fallback behavior next to the dispatch lookup.
- Keep each handler small and independently testable.
- Add or update tests for one normal case, the fallback case, and any case with special authorization, side effects, or error handling.
Review Checks
- Adding a new case changes one table entry and one focused test.
- Unknown keys fail closed or use a documented default.
- Handler signatures are consistent enough that the dispatch table is readable.
- The table does not hide important ordering rules. If order matters, use an ordered structure and test it.
Anti-Patterns
- Building a dispatch map for two tiny cases that were already clear.
- Capturing too much outer state in anonymous handlers.
- Replacing an obvious conditional with reflection, dynamic imports, or string evaluation.
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.

