Agent skill

Koapp Router

by AxiosLeo in AxiosLeo/node-koapp

Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class.

MITAuto-check passedBackend & APIs

Install Koapp Router

skills CLI
$ npx skills add AxiosLeo/node-koapp --skill koapp-router -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install AxiosLeo/node-koapp koapp-router --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/AxiosLeo/node-koapp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/assets/skills/koapp-router .claude/skills/koapp-router && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
koapp-router
GitHub stars
145
Token cost
~1.6k tokens
SKILL.md length
484 words
Files
2
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class.

  • Works in 4 steps: Walk the router tree by path segments,… → When multiple candidates remain, prefer… → If nothing matches, follow the nearest… → …
  • Declaring HTTP/WebSocket/TCP routes in koapp
  • SKILL.md covers Constructor, Path params, HTTP method shortcuts and Custom methods, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Koapp Router is an agent skill from AxiosLeo/node-koapp. Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class. Use when declaring HTTP/WebSocket/TCP routes in koapp, adding path params like /users/{:id}, composing nested routers, attaching per-route middlewares or after-handlers, validating params/query/body with validatorjs rules, or using shortcut helpers (get/post/put/patch/delete/any).

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `examples.md`).

It sits in Backend & APIs, covering Realtime and WebSockets. The repository describes itself as: About Design for quickly developing OpenAPI applications using Node.js. The licence is MIT.

When your agent uses it

  • Declaring HTTP/WebSocket/TCP routes in koapp
  • Adding path params like /users/{:id}
  • Composing nested routers
  • Attaching per-route middlewares

Example prompts

  • “/koapp-router”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Walk the router tree by path segments, preferring static matches over * / / *`
  2. When multiple candidates remain, prefer the one whose method list includes the request method (or ANY)
  3. If nothing matches, follow the nearest /*** fallback
  4. If even that misses, the framework lets the next Koa middleware run (typically 404)

What it can do on your machine

Read from SKILL.md and the folder at commit 102955d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Koapp Router loads about 1.6k tokens when it runs. Until then it costs about 99 tokens; SKILL.md has 484 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~99
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from AxiosLeo/node-koapp at commit 102955d, republished under its MIT licence (© AxiosLeo). 484 words, ~1,610 tokens.

Download SKILL.mdSave it as .claude/skills/koapp-router/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
koapp-router
description
Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class. Use when declaring HTTP/WebSocket/TCP routes in koapp, adding path params like /users/{:id}, composing nested routers, attaching per-route middlewares or after-handlers, validating params/query/body with validatorjs rules, or using shortcut helpers (get/post/put/patch/delete/any).

@axiosleo/koapp Router

Source: src/router.js.

Router is the single route-definition primitive for all three application types (KoaApplication, SocketApplication, WebSocketApplication). A router can be flat or a tree of sub-routers, and it carries middlewares, handlers, after-handlers, and validators.

Constructor

javascript
const { Router } = require('@axiosleo/koapp');

const router = new Router(prefix, options);
ArgTypeDefaultNotes
prefixstring''Path prefix like /api/v1 or /users/{:id}
options.methodstring''HTTP method. Use 'any' for all methods. Empty string disables the route
options.handlersFunction[][]Async handler functions async (context) => { ... }
options.middlewaresFunction[][]Run before handlers
options.aftersFunction[][]Run after handlers (even on thrown response)
options.validatorsobject{}{ params, query, body } - each { rules, messages? }

Any unknown keys on options are kept on the router instance as-is.

Path params

Use {:name} for path parameters. Legacy :name also works but {:name} is preferred:

javascript
new Router('/users/{:id}/posts/{:postId}', {
  method: 'GET',
  handlers: [async (context) => {
    const { id, postId } = context.params;
  }]
});

Wildcards:

  • /* - matches one segment (captured as params.<next> if named)
  • /** - matches one segment without capture
  • /*** - matches any remaining path, ideal for fallback handlers

HTTP method shortcuts

Each method shortcut creates a nested sub-router:

javascript
const root = new Router('/api');

root.get('/users', listUsers);
root.post('/users', createUser, {
  body: { rules: { name: 'required|string', email: 'required|email' } }
});
root.put('/users/{:id}', updateUser);
root.patch('/users/{:id}', patchUser);
root.delete('/users/{:id}', deleteUser);
root.any('/health', healthcheck);

Under the hood every shortcut delegates to router.push(method, prefix, handler, validator).

Custom methods

javascript
root.push('copy', '/resources/{:id}', async (context) => { ... });

The framework uppercases and stores the method; match it by sending the same method string.

Combining multiple methods

javascript
root.push('get|post', '/multi', async (context) => {
  // handles both GET and POST
});

Nested routers

javascript
const api = new Router('/api');
const v1 = new Router('/v1');
const users = new Router('/users');

users.get('/{:id}', async (context) => { ... });

v1.add(users);           // /api/v1/users/{:id}
api.add(v1);

router.add(...subrouters) attaches other Router instances. If the first argument is a string prefix, sub-routers are added under it:

javascript
api.add('/admin', adminUserRouter, adminRoleRouter);

The helper router.new(prefix, options) creates and mounts a sub-router in one call:

javascript
api.new('/internal', { middlewares: [authMiddleware] });

Middlewares and afters

javascript
const root = new Router(null, {
  middlewares: [
    async (context) => {
      console.log(`[${context.method}] ${context.pathinfo}`);
    }
  ],
  afters: [
    async (context) => {
      console.log('response:', context.response);
    }
  ]
});
  • Middlewares inherit down the tree (children + grandchildren see them)
  • Afters also inherit and run after any handler in the subtree
  • Throwing inside a handler still runs afters

Request validation

Validation uses validatorjs rules.

javascript
root.new('/items/{:id}', {
  method: 'PUT',
  handlers: [updateItem],
  validators: {
    params: {
      rules: { id: 'required|integer' }
    },
    query: {
      rules: { include: 'in:profile,settings' }
    },
    body: {
      rules: {
        name: 'required|string',
        price: 'required|numeric|min:0'
      },
      messages: {
        required: 'The :attribute field is required.'
      }
    }
  }
});

On failure the framework throws HttpError(400, <first-error-message>) which the workflow converts into a 400 response.

Common validatorjs rules: required, string, integer, numeric, email, url, min:N, max:N, in:a,b,c, regex:/pattern/, boolean, array.

Show full SKILL.md (204 more words)Show less

The catch-all fallback

To handle anything that did not match:

javascript
root.any('/***', async (context) => {
  result('Not Found', 404, { 'Content-Type': 'text/plain' });
});

'/***' matches any remaining path. The framework falls back to the deepest matching /*** route when no exact match is found.

Method resolution order

For a request PUT /users/42:

  1. Walk the router tree by path segments, preferring static matches over * / ** / ***
  2. When multiple candidates remain, prefer the one whose method list includes the request method (or ANY)
  3. If nothing matches, follow the nearest /*** fallback
  4. If even that misses, the framework lets the next Koa middleware run (typically 404)

Common pitfalls

  • Leaving method: '' (or unset) on a router.push creates a route that matches no HTTP method - requests fall through to fallback handlers. Always use 'any' or a concrete method unless you know you want this.
  • new Router('/') and new Router('') behave differently; prefer null or '' for the root.
  • Path params must use {:name} inside route segments - {:name} must be the entire segment, not a substring (/a-{:x} does not work).
  • Validators bubble with the router; nested routers inherit parent middlewares and afters, so avoid double-registering auth middlewares.

See also

  • Richer, copy-paste examples: examples.md
  • Building a complete HTTP server around the router: koapp-apps
  • Sending responses from handlers: koapp-response
  • Typed contexts and Router generics in TypeScript: koapp-typescript

© AxiosLeo, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in assets/skills/koapp-router of AxiosLeo/node-koapp.

  • SKILL.md
  • examples.md

Open the folder on GitHubat commit 102955d

Compare with similar skills

Koapp Router next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Koapp Router compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Koapp Router this skillAxiosLeo/node-koapp145—~1.6kAutomated safety check: PassMIT
Supabase Development and Debuggingsupabase/agent-skills2.7k3 repos~3.6kAutomated safety check: PassMIT
Use Yaakmountain-loop/yaak19k—~1.9kAutomated safety check: PassMIT
Gemini Live API Devgoogle-gemini/gemini-skills4.3k—~4.6kAutomated safety check: PassApache-2.0
Broker Integrationmarketcalls/openalgo2.8k—~4.7kAutomated safety check: NotesAGPL-3.0
Trigger.dev Realtimepapermark/papermark9.2k—~1.7kAutomated safety check: PassCustom licence

Similar skills

  • Official

    General Supabase skill for database, auth, Edge Functions, Realtime and storage work, plus client libraries, migrations, security audits, debugging and reading logs.

    2.7k GitHub starsUsed in 3 repos~3.6k tokens
    Backend & APIsAuto-check passed
  • Use Yaak

    mountain-loop/yaak

    A skill your agent uses when the user mentions Yaak, a Yaak workspace, or the yaak command, or asks to call, hit, or smoke test HTTP/REST endpoints, save or organize API requests for reuse or manual…

    19k GitHub stars~1.9k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Gemini Live API Dev

    google-gemini/gemini-skills

    Official

    A skill your agent uses when building real-time, bidirectional streaming applications with the Gemini Live API, or migrating legacy Live models (2.0/2.5/3.1) to Gemini 3.8 Live.

    4.3k GitHub stars~4.6k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Broker Integration

    marketcalls/openalgo

    Integrate a new Indian broker into OpenAlgo, or modify an existing broker plugin.

    2.8k GitHub stars~4.7k tokensUpdated today
    Backend & APIsAuto-check: notes
  • Trigger.dev Realtime

    papermark/papermark

    Shows how to subscribe to Trigger.dev task runs from the backend and from React for progress indicators, live dashboards, AI response streams and approval waits.

    9.2k GitHub stars~1.7k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Spider King

    aoyunyang/spider-king-skill

    Pure-web protocol reverse skill: turn hostile browser clients into browser-free Python collectors.

    509 GitHub stars~7.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from AxiosLeo/node-koapp

All 8 skills in this repo
  • Koapp

    AxiosLeo/node-koapp

    Overview of the @axiosleo/koapp framework - a Koa-based web, TCP socket, and WebSocket framework for Node.js.

    145 GitHub stars~1.3k tokensUpdated 23 days ago
    Auto-check passed
  • Koapp Apps

    AxiosLeo/node-koapp

    Choose and configure the right @axiosleo/koapp Application class - KoaApplication for HTTP, SocketApplication for TCP sockets, WebSocketApplication for WebSocket.

    145 GitHub stars~1.2k tokensUpdated 23 days ago
    Auto-check passed
  • Koapp Controller

    AxiosLeo/node-koapp

    Organize route handlers into reusable classes by extending the @axiosleo/koapp Controller base class.

    145 GitHub stars~1.3k tokensUpdated 23 days ago
    Auto-check passed
  • Koapp Model

    AxiosLeo/node-koapp

    Validate and serialize structured data with the @axiosleo/koapp Model class powered by validatorjs.

    145 GitHub stars~1.6k tokensUpdated 23 days ago
    Auto-check passed
  • Koapp Response

    AxiosLeo/node-koapp

    Send structured responses from @axiosleo/koapp handlers using success/failed/result/response/error helpers and HttpError/HttpResponse classes.

    145 GitHub stars~1.5k tokensUpdated 23 days ago
    Auto-check passed
  • Koapp Sse

    AxiosLeo/node-koapp

    Stream Server-Sent Events (SSE) from a @axiosleo/koapp Koa route using the KoaSSEMiddleware.

    145 GitHub stars~1.5k tokensUpdated 23 days ago
    Auto-check passed

Categories

Questions about Koapp Router

What does Koapp Router do?

Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class. Koapp Router is an agent skill from AxiosLeo/node-koapp. Define routes, path parameters, validators, and nested routers with the @axiosleo/koapp Router class.

When should I use Koapp Router?

Koapp Router fits situations like: declaring HTTP/WebSocket/TCP routes in koapp; adding path params like /users/{:id}; composing nested routers; attaching per-route middlewares.

How do I install Koapp Router in Claude Code?

Run `npx skills add AxiosLeo/node-koapp --skill koapp-router -a claude-code`. Or copy the skill folder (assets/skills/koapp-router in AxiosLeo/node-koapp) into .claude/skills/koapp-router in your project. Claude Code loads it when a task matches its description.

How do I install Koapp Router in Codex?

Run `npx skills add AxiosLeo/node-koapp --skill koapp-router -a codex`. Or copy the skill folder (assets/skills/koapp-router in AxiosLeo/node-koapp) into .agents/skills/koapp-router in your project. Codex loads it when a task matches its description.

Can I use Koapp Router in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add AxiosLeo/node-koapp --skill koapp-router -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/koapp-router, .gemini/skills/koapp-router, .github/skills/koapp-router and .opencode/skills/koapp-router in your project.

What does Koapp Router need to run?

SKILL.md names no scripts, command-line tools or credentials: Koapp Router is instructions for the agent only.

Does Koapp Router access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Koapp Router safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Koapp Router use?

Koapp Router is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Koapp Router use?

About 1.6k tokens (SKILL.md is roughly 6.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Koapp Router?

Skills that share tags, products or a category with Koapp Router: Supabase Development and Debugging (supabase/agent-skills, 2.7k stars), Use Yaak (mountain-loop/yaak, 19k stars), Gemini Live API Dev (google-gemini/gemini-skills, 4.3k stars) and Broker Integration (marketcalls/openalgo, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Koapp Router?

AxiosLeo (a GitHub user) maintains it in AxiosLeo/node-koapp, which has 145 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on September 16, 2026.

Source: AxiosLeo/node-koapp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.