axiosleo/node-koapp/koapp-response
Claude Code and agent skill by axiosleo/node-koapp
- community
Checking that the SKILL.md file is still in the repository.
Send structured responses from @axiosleo/koapp handlers using success/failed/result/response/error helpers and HttpError/HttpResponse classes. Use when returning JSON envelopes, custom HTTP status codes, raw HTML/text, error responses, or when setting response headers from a koapp route handler or controller method.
Install
npx vskill@latest install axiosleo/node-koapp/koapp-responseSKILL.md
@axiosleo/koapp Response Helpers
Source: `src/response.js`.
@axiosleo/koapp uses throw-based response helpers: you call one of the helpers and it throws a typed object that the framework's workflow catches and writes to the wire. This keeps route handlers linear (no need to return) and lets middlewares/afters run consistently.
Import
Helper reference
| Helper | Signature | Purpose | ||
|---|---|---|---|---|
success(data?, headers?) | (data: any, headers: Record<string,string>) => never | 200 OK, JSON envelope with code: '200;Success' | ||
failed(data?, code?, status?, headers?) | (data: any, code?: string, status?: number, headers?) => never | Non-2xx with JSON envelope; defaults code: '501;Internal Server Error', status: 501 | ||
response(data, code?, status?, headers?, format?) | Full control JSON envelope | Explicit code, status, headers, format (`'json' | 'text'`) | |
result(data, status?, headers?) | Raw body pass-through | Bypass the JSON envelope and write data as-is | ||
error(status, msg, headers?) | Error with empty payload | Shortcut for response({}, '<status>;<msg>', status, headers) |
All helpers never return - they throw.
JSON envelope
success, failed, response, and error produce the framework's standard envelope:
code follows the "<status>;<message>" convention:
"200;Success""400;Bad Request""404;Not Found""500;Internal Server Error"
Both parts are mirrored into data (so message is still readable when clients only unpack code). Custom codes are free-form strings.
Raw pass-through with result()
Use result() when you need to emit HTML, plain text, binary, or a pre-built JSON body without the envelope wrapping:
result() sets notResolve: true internally so the envelope is skipped.
Error helpers
HttpError for validation / system errors
HttpError is primarily used internally (e.g. by Model when validation fails), but handlers may throw it to short-circuit with a plain error body:
The framework catches it in the workflow and writes status=401, the message, and any headers.
HttpResponse class
HttpResponse is the class behind all helpers. You normally won't instantiate it directly, but it's useful to know its shape:
Status code presets (TypeScript)
The type definitions in index.d.ts list convenient string literals:
Any "<number>;<text>" string is valid - the presets are just common ones.
Setting headers per response
Every helper accepts a headers argument:
Direct Koa response
Inside an HTTP handler you can still write to context.koa directly when you need streaming, redirects, or pipelining:
Mixing raw Koa output with the throw helpers: the last to write wins. If you need raw streaming, skip the helpers entirely.
Common pitfalls
- Forgetting
success/failed/result/...throws, leading to code that runs
after the "response" line. Treat them as terminal.
- Calling
successin a middleware (not a handler) stops execution just
like in a handler - the workflow still catches and emits the response.
failed(data, status)does not work - the second arg iscode, not
status. Use failed(data, '400;Bad Data', 400) or switch to response(data, '400;Bad Data', 400).
- Returning
success(...)from a handler is redundant (it throws) and
confusing to readers - do not return helper calls.
See also
- Organize handlers into classes with wrapped helpers: koapp-controller
- Validate body/params before responding: koapp-router
- Concrete response recipes: examples.md
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingassets/skills/koapp-response/SKILL.md
Popularity
- Repository stars
- 44
- Repository forks
- 11
- Repository npm downloads, 7 days
- 545
- 7-day trend score
- 34
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 31 Jul 2026, 3 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/axiosleo/node-koapp/koapp-response)