RO

router-first-architecture

A structural pattern that directs user intents through specialized domain routers to ensure the correct tools are invoked.

Install

mkdir -p .claude/skills/router-first-architecture && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1151" && unzip -o skill.zip -d .claude/skills/router-first-architecture && rm skill.zip

Installs to .claude/skills/router-first-architecture

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Router-First Architecture
25 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Route user intents to CLI commands
  • Co-activate domain skills with their router
  • Abstract tool selection
  • Map user intent to exact CLI commands
  • Handle 'not found' gracefully

How it works

A two-layer architecture uses a skill-rules trigger layer to nudge the system towards a router, which then deterministically maps user intent to specific CLI commands.

Inputs & outputs

You give it
User intent as a string
You get back
Exact CLI commands

When to use router-first-architecture

  • Mapping complex user requests to specific CLI tools
  • Ensuring consistent tool activation
  • Abstracting internal command logic

About this skill

Router-First Architecture

Route through domain routers before using individual tools. Routers abstract tool selection.

Pattern

Domain routers (like math-router) provide deterministic mapping from user intent to exact CLI commands. Always use the router first; only bypass for edge cases.

DO

  • Call math-router route "<intent>" before any math operation
  • Let domain skills co-activate with their router (via coActivate in skill-rules.json)
  • Trust the router's confidence score; only fall back if command: null
  • Keep trigger keywords/patterns in skill-rules.json broader than routing patterns

DON'T

  • Call individual scripts directly when a router exists
  • Duplicate routing logic in individual skills
  • Let domain skills bypass their router

Co-Activation Pattern

Domain skills should co-activate with their router:

{
  "math/abstract-algebra/groups": {
    "coActivate": ["math-router"],
    "coActivateMode": "always"
  }
}

This ensures the router is always available when domain knowledge is activated.

Two-Layer Architecture

  1. Skill-rules trigger layer: Nudges Claude to use the router (keywords, intent patterns)
  2. Router routing layer: Deterministic mapping to scripts via regex patterns

Keep the trigger layer broader than routing - the router should handle "not found" gracefully.

Source Sessions

  • 2bbc8d6e: "Trigger layer was narrower than routing layer" - expanded triggers
  • This session: Wired 8 domain math skills to co-activate with math-router

When not to use it

  • When individual scripts are called directly
  • When routing logic is duplicated in individual skills
  • When domain skills bypass their router

Limitations

  • Requires domain routers to exist for specific operations
  • Bypassing the router is only for edge cases

How it compares

This architecture ensures that a router always mediates tool selection, unlike direct invocation of individual scripts.

Compared to similar skills

router-first-architecture side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
router-first-architecture (this skill)37moNo flagsIntermediate
openspec-onboard106moReviewBeginner
workflow-orchestration-patterns102moNo flagsAdvanced
meta-automation-architect78moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry