Agent skill

Koapp Controller

by AxiosLeo in AxiosLeo/node-koapp

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

MITAuto-check passedDevelopment

Install Koapp Controller

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

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

GitHub CLI
$ gh skill install AxiosLeo/node-koapp koapp-controller --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-controller .claude/skills/koapp-controller && 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-controller
GitHub stars
145
Token cost
~1.3k tokens
SKILL.md length
380 words
Files
2
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

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

  • Grouping related handlers
  • SKILL.md covers Import, Instance API, Basic usage and Why use Controller over plain…, plus 7 more sections
  • Calls npx
  • Reusing response helpers (this.success/failed/result/response/error/log)

What it does

Koapp Controller is an agent skill from AxiosLeo/node-koapp. Organize route handlers into reusable classes by extending the @axiosleo/koapp Controller base class. Use when grouping related handlers, reusing response helpers (this.success/failed/result/response/error/log), sharing state across handlers, or scaffolding service modules for a koapp project.

Its SKILL.md is about 1.3k 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 Development, covering Project scaffolding. The repository describes itself as: About Design for quickly developing OpenAPI applications using Node.js. The licence is MIT.

When your agent uses it

  • Grouping related handlers
  • Reusing response helpers (this.success/failed/result/response/error/log)
  • Sharing state across handlers
  • Scaffolding service modules for a koapp project

Example prompts

  • “/koapp-controller”

Requirements

  • Node.js

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

    Shell commands in SKILL.md call:

    • npx

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

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    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 Controller loads about 1.3k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 380 words of instructions outside code blocks.

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

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). 380 words, ~1,335 tokens.

Download SKILL.mdSave it as .claude/skills/koapp-controller/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
koapp-controller
description
Organize route handlers into reusable classes by extending the @axiosleo/koapp Controller base class. Use when grouping related handlers, reusing response helpers (this.success/failed/result/response/error/log), sharing state across handlers, or scaffolding service modules for a koapp project.

@axiosleo/koapp Controller

Source: src/controller.js.

Controller is a thin base class that mirrors the response helpers as instance methods. Extend it to keep related handlers together and share auxiliary state.

Import

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

Instance API

MethodEquivalent functionNotes
this.success(data?, headers?)success(data, headers)200 OK JSON envelope
this.failed(data?, code?, status?, headers?)failed(data, code, status, headers)Non-2xx JSON envelope
this.result(data, status?, headers?)result(data, status, headers)Raw body pass-through
this.response(data, code, status?, headers?)response(data, code, status, headers)Full control envelope
this.error(status, msg, headers?)error(status, msg, headers)Shortcut error envelope
this.log(...data)debug.log from @axiosleo/cli-toolConditional logging

All this.success / failed / result / response / error throw, same as the functional helpers. See koapp-response for envelope details.

Basic usage

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

class HealthController extends Controller {
  async ping(context) {
    this.log('ping from', context.request_id);
    this.success({ pong: true });
  }

  async version() {
    this.success({ version: require('../package.json').version });
  }
}

const health = new HealthController();
const router = new Router('/health');
router.get('/ping', (ctx) => health.ping(ctx));
router.get('/version', () => health.version());

Why use Controller over plain functions?

  • Shared state: load DB handles, caches, or config once in the constructor and reuse across methods.
  • Inheritance: define a BaseController with common middlewares or helpers, then extend it per module (the init scaffolding template at assets/tmpl/services/src/modules/controller.ts.tmpl does this).
  • Testability: easier to mock a controller instance than free-floating functions.

Binding handlers to routes

Controller methods expect a context argument and may use this, so bind them explicitly when registering with the router:

javascript
router.get('/users/{:id}', (ctx) => controller.find(ctx));
router.post('/users', (ctx) => controller.create(ctx));

// or with arrow methods
class UsersController extends Controller {
  find = async (ctx) => {
    const id = Number(ctx.params.id);
    this.success({ id });
  };
}

Pure wrappers (ctx) => controller.method(ctx) preserve this and avoid .bind clutter.

Error handling

Since this.success / failed / ... throw, any code after them does not run. The workflow catches the throw and writes the response. Keep try / catch only where you intend to shape a different error:

javascript
async create(context) {
  try {
    const user = await this.db.users.insert(context.body);
    this.success({ id: user.id });
  } catch (err) {
    if (err.code === 'DUP_ENTRY') {
      this.failed({ email: context.body.email }, '409;Email Already Registered', 409);
    }
    throw err;  // let the workflow convert to 500
  }
}
Show full SKILL.md (150 more words)Show less

Logging

this.log is wired to debug.log from @axiosleo/cli-tool. Enable it by running with DEBUG=1 (or the cli-tool equivalent), or by setting debug: true on the application.

javascript
this.log('loading user', context.params.id);

Composing with validators

Validation stays on the router:

javascript
router.push('post', '/users', (ctx) => controller.create(ctx), {
  body: {
    rules: {
      name: 'required|string',
      email: 'required|email'
    }
  }
});

The validator runs before the handler, so by the time controller.create executes you already have a validated context.body.

Generator output

Running npx @axiosleo/koapp gen -d ./meta -o ./services/src/modules produces .controller.ts files that extend a project-local BaseController. That BaseController typically extends Controller and adds database handles:

typescript
import { Controller } from '@axiosleo/koapp';
import { mainDB } from '../services/db';

export class BaseController extends Controller {
  protected mainDB = mainDB;
}

Common pitfalls

  • Forgetting to pass context into instance methods: router.get('/x', controller.handler) loses this when the router calls the method as a free function. Use arrow wrappers.
  • Returning this.success(...) from a handler is redundant - the throw short-circuits execution.
  • Controllers are long-lived across requests; never stash per-request data on this. Use context or local variables instead.

See also

  • Response helper details: koapp-response
  • Grouping controllers under a router tree: koapp-router
  • Concrete controller recipes: examples.md

© 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-controller of AxiosLeo/node-koapp.

  • SKILL.md
  • examples.md

Open the folder on GitHubat commit 102955d

Compare with similar skills

Koapp Controller 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 Controller compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Koapp Controller this skillAxiosLeo/node-koapp145—~1.3kAutomated safety check: PassMIT
Nx Generatenomcopter/react-mosaic4.8k7 repos~1.9kAutomated safety check: PassCustom licence
PonytailDavidObando/gsharp5658 repos~1.7kAutomated safety check: PassMIT
Run Nx Generatornrwl/nx29k2 repos~592Automated safety check: NotesMIT
Conductor Setupgemini-cli-extensions/conductor3.8k—~4.2kAutomated safety check: PassApache-2.0
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.5kAutomated safety check: PassApache-2.0

Similar skills

  • Nx Generate

    nomcopter/react-mosaic

    Generate code using nx generators. An agent skill from nomcopter/react-mosaic.

    4.8k GitHub starsUsed in 7 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    565 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Run Nx generators with prioritization for workspace-plugin generators.

    29k GitHub starsUsed in 2 repos~592 tokens
    DevelopmentAuto-check: notes
  • Conductor Setup

    gemini-cli-extensions/conductor

    Scaffolds the project and sets up the Conductor environment.

    3.8k GitHub stars~4.2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Enforces this repository's TypeScript backend module architecture under server/: feature folders, barrel exports, and where shared types and utilities belong.

    14k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-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 22 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 22 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 22 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 22 days ago
    Auto-check passed
  • Koapp Router

    AxiosLeo/node-koapp

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

    145 GitHub stars~1.6k tokensUpdated 22 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 22 days ago
    Auto-check passed

Categories

Questions about Koapp Controller

What does Koapp Controller do?

Organize route handlers into reusable classes by extending the @axiosleo/koapp Controller base class. Koapp Controller is an agent skill from AxiosLeo/node-koapp. Organize route handlers into reusable classes by extending the @axiosleo/koapp Controller base class.

When should I use Koapp Controller?

Koapp Controller fits situations like: grouping related handlers; reusing response helpers (this.success/failed/result/response/error/log); sharing state across handlers; scaffolding service modules for a koapp project.

How do I install Koapp Controller in Claude Code?

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

How do I install Koapp Controller in Codex?

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

Can I use Koapp Controller 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-controller -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-controller, .gemini/skills/koapp-controller, .github/skills/koapp-controller and .opencode/skills/koapp-controller in your project.

What does Koapp Controller need to run?

Going by SKILL.md and its folder, Koapp Controller needs the command-line tools its instructions call (npx). Our summary lists: Node.js.

Does Koapp Controller access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Koapp Controller 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 Controller use?

Koapp Controller 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 Controller use?

About 1.3k tokens (SKILL.md is roughly 5.3k 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 Controller?

Skills that share tags, products or a category with Koapp Controller: Nx Generate (nomcopter/react-mosaic, 4.8k stars), Ponytail (DavidObando/gsharp, 565 stars), Run Nx Generator (nrwl/nx, 29k stars) and Conductor Setup (gemini-cli-extensions/conductor, 3.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Koapp Controller?

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.