micro — Codex skill: what it does, how to install
Provides expert guidance for building asynchronous HTTP microservices with Vercel's micro in Node.js. Generates clean handlers, body parsing, and error routines.
npx skills add openai/plugins --skill micro -a codexWhat micro does
The skill instructs your coding assistant on creating lightweight Node.js services with the micro library. It covers modern serve() patterns using Web standard Request objects alongside classic Node.js HTTP handlers. The agent applies built-in parsers like json(), text(), and buffer() directly instead of pulling heavy middleware.
Built-in routing is completely absent in micro. It targets single-purpose endpoints, so multi-route APIs require external routers like micro-router. Middleware behavior is achieved by wrapping handlers with higher-order functions. For local hot-reloading during development, the skill configures micro-dev in package.json.
What it helps with
- scaffold lightweight HTTP endpoints with minimal boilerplate
- parse JSON, text, or raw buffer request bodies
- handle HTTP errors with createError status codes
- configure micro-dev scripts for hot-reloading in package.json
Example prompts for the agent
- Create a micro endpoint that parses incoming JSON and responds with an object
- Wrap this micro handler with a custom CORS higher-order function
- Add authentication checks throwing a 401 status via createError
How to install micro
1Skills CLI (Vercel)
npx skills add openai/plugins --skill micro -a codex2Manually: put the files in place
.agents/skills/micro/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add openai/plugins --skill micro -a claude-code2Manually: put the files in place
~/.claude/skills/micro/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/micro/
Manually: put the files in place
.cursor/skills/micro/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install openai/plugins micro2Manually: put the files in place
.github/skills/micro/SKILL.mdPlatform CLI
gemini skills install https://github.com/openai/plugins --path plugins/vercel/skills/microManually: put the files in place
.devin/skills/micro/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: Codex skills: how to install, where they live, how to call them
Questions about micro
How to install micro skill in Codex?
Run npx skills add openai/plugins --skill micro in your terminal or specify the platform with npx skills add openai/plugins --skill micro -a codex. The skill installs into .agents/skills/micro/SKILL.md.
What does the micro skill do?
It guides your coding agent to write asynchronous HTTP microservices using Vercel's micro framework. It ensures the model handles errors, request bodies, and function composition correctly.
Does micro support routing out of the box?
No, micro is designed for single-purpose endpoints without built-in routing. For multiple paths, the skill guides you to use dedicated routers like micro-router.
Source text
SKILL.md · Apache-2.0
---
name: micro
description: Expert guidance for micro — asynchronous HTTP microservices framework by Vercel. Use when building lightweight HTTP servers, API endpoints, or microservices using the micro library.
metadata:
priority: 4
docs:
- "https://github.com/vercel/micro"
pathPatterns: []
importPatterns:
- 'micro'
- 'micro-dev'
bashPatterns:
- '\bnpm\s+(install|i|add)\s+[^\n]*\bmicro\b'
- '\bpnpm\s+(install|i|add)\s+[^\n]*\bmicro\b'
- '\bbun\s+(install|i|add)\s+[^\n]*\bmicro\b'
- '\byarn\s+add\s+[^\n]*\bmicro\b'
- '\bnpx\s+micro\b'
- '\bnpx\s+micro-dev\b'
---
# micro — Asynchronous HTTP Microservices
You are an expert in micro, Vercel's lightweight framework for building asynchronous HTTP microservices in Node.js. micro makes it easy to write single-purpose HTTP endpoints with minimal boilerplate.
## Installation
```bash
npm install micro
```
## Basic Usage
Create a module that exports a request handler:
```ts
// index.ts
import { serve } from 'micro'
const handler = (req: Request) => {
return new Response('Hello, World!')
}
serve(handler)
```
Or use the classic API:
```ts
import { IncomingMessage, ServerResponse } from 'http'
export default (req: IncomingMessage, res: ServerResponse) => {
res.end('Hello, World!')
}
```
Run with:
```bash
npx micro
```
## Core API
### `json(req)` — Parse JSON Body
```ts
import { json } from 'micro'
export default async (req: IncomingMessage, res: ServerResponse) => {
const body = await json(req)
return { received: body }
}
```
### `text(req)` — Parse Text Body
```ts
import { text } from 'micro'
export default async (req: IncomingMessage, res: ServerResponse) => {
const body = await text(req)
return `You said: ${body}`
}
```
### `buffer(req)` — Parse Raw Body
```ts
import { buffer } from 'micro'
export default async (req: IncomingMessage, res: ServerResponse) => {
const raw = await buffer(req)
return `Received ${raw.length} bytes`
}
```
### `send(res, statusCode, data)` — Send Response
```ts
import { send } from 'micro'
export default (req: IncomingMessage, res: ServerResponse) => {
send(res, 200, { status: 'ok' })
}
```
### `createError(statusCode, message)` — HTTP Errors
```ts
import { createError } from 'micro'
export default (req: IncomingMessage, res: ServerResponse) => {
if (!req.headers.authorization) {
throw createError(401, 'Unauthorized')
}
return { authorized: true }
}
```
## Development with micro-dev
`micro-dev` provides hot-reloading for development:
```bash
npm install --save-dev micro-dev
# Run in dev mode
npx micro-dev index.js
```
## Composition
Chain multiple handlers with function composition:
```ts
import { IncomingMessage, ServerResponse } from 'http'
const cors = (fn: Function) => async (req: IncomingMessage, res: ServerResponse) => {
res.setHeader('Access-Control-Allow-Origin', '*')
return fn(req, res)
}
const handler = async (req: IncomingMessage, res: ServerResponse) => {
return { hello: 'world' }
}
export default cors(handler)
```
## package.json Setup
```json
{
"main": "index.js",
"scripts": {
"start": "micro",
"dev": "micro-dev"
},
"dependencies": {
"micro": "^10.0.0"
},
"devDependencies": {
"micro-dev": "^3.0.0"
}
}
```
## Key Points
1. **Return values are sent as responses** — return strings, objects (auto-serialized to JSON), or Buffers
2. **Async by default** — handlers can be async functions, errors are caught automatically
3. **Thrown errors become HTTP errors** — use `createError()` for proper status codes
4. **No routing built-in** — micro is a single-endpoint server; use a router like `micro-router` for multi-route services
5. **Body parsing is explicit** — use `json()`, `text()`, or `buffer()` to parse request bodies
6. **Composable** — wrap handlers with higher-order functions for middleware-like behavior
## Official Resources
- [micro GitHub](https://github.com/vercel/micro)
© Vercel Labs · Apache-2.0 · openai/plugins