Agent skill

Koapp Sse

by AxiosLeo in AxiosLeo/node-koapp

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

MITAuto-check passedBackend & APIs

Install Koapp Sse

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

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

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

At a glance

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

  • Works in 4 steps: Call await sse(context.koa, async () =>… → After that, context.koa.sse exists. → Push events with… → …
  • Pushing real-time events to a browser over HTTP
  • SKILL.md covers Import, Middleware factory, Wiring into a router handler and Event shape, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Koapp Sse is an agent skill from AxiosLeo/node-koapp. Stream Server-Sent Events (SSE) from a @axiosleo/koapp Koa route using the KoaSSEMiddleware. Use when pushing real-time events to a browser over HTTP, implementing progress bars, live logs, notifications, or EventSource endpoints with text/event-stream, including ctx.koa.sse.send/close/keepAlive APIs.

Its SKILL.md is about 1.5k 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

  • Pushing real-time events to a browser over HTTP
  • Implementing progress bars
  • EventSource endpoints with text/event-stream
  • Including ctx.koa.sse.send/close/keepAlive APIs

Example prompts

  • “/koapp-sse”

Workflow steps

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

  1. Call await sse(context.koa, async () => {}) - pass a no-op next.
  2. After that, context.koa.sse exists.
  3. Push events with context.koa.sse.send(event); end with .close().
  4. Do not call success / failed / result in the same handler - SSE

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

    No URLs in SKILL.md.

    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 Sse loads about 1.5k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 479 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.5k

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). 479 words, ~1,513 tokens.

Download SKILL.mdSave it as .claude/skills/koapp-sse/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
koapp-sse
description
Stream Server-Sent Events (SSE) from a @axiosleo/koapp Koa route using the KoaSSEMiddleware. Use when pushing real-time events to a browser over HTTP, implementing progress bars, live logs, notifications, or EventSource endpoints with text/event-stream, including ctx.koa.sse.send/close/keepAlive APIs.

@axiosleo/koapp Server-Sent Events Middleware

Source: src/middlewares/sse.js.

KoaSSEMiddleware upgrades a Koa request to a Server-Sent Events (SSE) stream, setting the right headers and exposing ctx.sse.send(...) for pushing events to the browser over plain HTTP.

Use SSE when:

  • You need server → client streaming (notifications, logs, live charts)
  • You do NOT need client → server streaming (use koapp-apps WebSocket instead)
  • You want a simple, proxy-friendly transport - SSE works over HTTP/1.1

Browsers reconnect automatically; most reverse proxies handle it fine.

Import

javascript
const { KoaSSEMiddleware } = require('@axiosleo/koapp').middlewares;

Middleware factory

javascript
const middleware = KoaSSEMiddleware({
  pingInterval: 60000,  // ms between heartbeat comments (default 60s)
  closeEvent: 'close'   // event name sent on stream close
});

The factory returns a standard Koa middleware (ctx, next) => {}.

Wiring into a router handler

Because the framework already dispatches routes via its workflow, invoke the middleware inside the handler, passing context.koa:

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

const router = new Router('/');

router.any('/sse', async (context) => {
  const sse = KoaSSEMiddleware();
  await sse(context.koa, async () => {});

  context.koa.sse.send({ data: 'hello, world!' });

  process.nextTick(async () => {
    for (let i = 0; i < 5; i++) {
      context.koa.sse.send({ id: i, event: 'tick', data: { i } });
      await new Promise((r) => setTimeout(r, 1000));
    }
    context.koa.sse.close();
  });
});

Key points:

  1. Call await sse(context.koa, async () => {}) - pass a no-op next.
  2. After that, context.koa.sse exists.
  3. Push events with context.koa.sse.send(event); end with .close().
  4. Do not call success / failed / result in the same handler - SSE takes over the response body.

Event shape

sse.send(data) accepts either a string or an object:

javascript
// String payload - becomes `data:<text>\n\n`
context.koa.sse.send('hello');

// Object payload - id/event are optional
context.koa.sse.send({
  id: 42,
  event: 'progress',
  data: { percent: 75 }  // objects are JSON-stringified
});

Raw wire output:

id:42
event:progress
data:{"percent":75}

Lifecycle methods

MethodWhen to use
ctx.sse.send(data)Push one event
ctx.sse.keepAlive()Send a :\n\n comment to keep the connection warm (called automatically every pingInterval ms for all active streams)
ctx.sse.close()Emit a final { event: closeEvent } and end the stream

The middleware maintains an internal ssePool and calls keepAlive on every registered stream every pingInterval ms. Manual calls are rarely needed.

Reacting to client disconnect

The middleware listens to close / error events on the SSE stream and calls an internal close() that:

  1. Removes the stream from the pool
  2. unpipe() + destroy() the stream
  3. Ends the Koa response
  4. Destroys the underlying socket

You can listen yourself too:

javascript
context.koa.sse.on('close', () => {
  clearInterval(myPushLoop);
});
Show full SKILL.md (211 more words)Show less

Long-lived handlers

The handler function must remain alive while the SSE stream is open. Don't return from it immediately; either keep pushing inline, or spawn a background task and let it own the lifecycle:

javascript
router.any('/logs', async (context) => {
  const sse = KoaSSEMiddleware();
  await sse(context.koa, async () => {});

  // Detach so the handler resolves but the stream stays open
  (async () => {
    for await (const line of tail('./app.log')) {
      context.koa.sse.send({ event: 'log', data: line });
    }
    context.koa.sse.close();
  })();
});

The framework's workflow will see the handler resolve, but the response body (the SSE stream) remains open until you close() it or the client disconnects.

Browser client

javascript
const source = new EventSource('/sse');

source.onmessage = (e) => {
  console.log('data:', e.data);
};

source.addEventListener('progress', (e) => {
  const payload = JSON.parse(e.data);
  console.log('progress:', payload.percent);
});

source.addEventListener('close', () => {
  console.log('server closed the stream');
  source.close();
});

Browsers automatically reconnect on network blips.

Pairing with other koapp pieces

  • Validate the upgrade with a router-level validator on query (e.g. auth token) - koapp-router
  • Authenticate via session cookie - the middleware does not touch auth
  • Control backpressure by only pushing when context.koa.sse.writable

Common pitfalls

  • Calling success / failed / result / context.koa.body = ... in the same handler conflicts with the SSE stream and yields incomplete output.
  • Using HTTP/2 requires enabling SSE on the server side - the default Node HTTP/1.1 works out of the box.
  • Firewall / proxy buffering can delay events. Set X-Accel-Buffering: no for nginx:
    javascript
    context.koa.set('X-Accel-Buffering', 'no');
    Do this before calling sse(context.koa, ...).
  • The middleware's global setInterval heartbeat keeps all open SSE connections warm; it does not leak across requests because each stream auto-removes itself from the pool on close.

See also

  • Real-time browser apps needing bi-directional traffic → koapp-apps (WebSocket)
  • Progress indicators for long-running HTTP jobs → this skill + Workflow from @axiosleo/cli-tool
  • Concrete SSE 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-sse of AxiosLeo/node-koapp.

  • SKILL.md
  • examples.md

Open the folder on GitHubat commit 102955d

Compare with similar skills

Koapp Sse 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 Sse compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Koapp Sse this skillAxiosLeo/node-koapp145—~1.5kAutomated 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 3 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 4 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 yesterday
    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 24 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 24 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 24 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 24 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 24 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 24 days ago
    Auto-check passed

Categories

Questions about Koapp Sse

What does Koapp Sse do?

Stream Server-Sent Events (SSE) from a @axiosleo/koapp Koa route using the KoaSSEMiddleware. Koapp Sse is an agent skill from AxiosLeo/node-koapp. Stream Server-Sent Events (SSE) from a @axiosleo/koapp Koa route using the KoaSSEMiddleware.

When should I use Koapp Sse?

Koapp Sse fits situations like: pushing real-time events to a browser over HTTP; implementing progress bars; eventSource endpoints with text/event-stream; including ctx.koa.sse.send/close/keepAlive APIs.

How do I install Koapp Sse in Claude Code?

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

How do I install Koapp Sse in Codex?

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

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

What does Koapp Sse need to run?

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

Does Koapp Sse access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

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

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

About 1.5k tokens (SKILL.md is roughly 6.1k 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 Sse?

Skills that share tags, products or a category with Koapp Sse: 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 Sse?

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.