micro

Expert guidance for micro — asynchronous HTTP microservices framework by Vercel. Use when building lightweight HTTP servers, API endpoints, or microservices using the micro library.

685 stars

Best use case

micro is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert guidance for micro — asynchronous HTTP microservices framework by Vercel. Use when building lightweight HTTP servers, API endpoints, or microservices using the micro library.

Teams using micro should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/micro/SKILL.md --create-dirs "https://raw.githubusercontent.com/openai/plugins/main/plugins/vercel/skills/micro/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/micro/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How micro Compares

Feature / AgentmicroStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert guidance for micro — asynchronous HTTP microservices framework by Vercel. Use when building lightweight HTTP servers, API endpoints, or microservices using the micro library.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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)

Related Skills

workflow

685
from openai/plugins

Vercel Workflow DevKit (WDK) expert guidance. Use when building durable workflows, long-running tasks, API routes or agents that need pause/resume, retries, step-based execution, or crash-safe orchestration with Vercel Workflow.

verification

685
from openai/plugins

Full-story verification — infers what the user is building, then verifies the complete flow end-to-end: browser → API → data → response. Triggers on dev server start and 'why isn't this working' signals.

vercel-storage

685
from openai/plugins

Vercel storage expert guidance — Blob, Edge Config, and Marketplace storage (Neon Postgres, Upstash Redis). Use when choosing, configuring, or using data storage with Vercel applications.

vercel-services

685
from openai/plugins

Vercel Services — deploy multiple services within a single Vercel project. Use for monorepo layouts or when combining a backend (Python, Go) with a frontend (Next.js, Vite) in one deployment.

vercel-sandbox

685
from openai/plugins

Vercel Sandbox guidance — ephemeral Firecracker microVMs for running untrusted code safely. Supports AI agents, code generation, and experimentation. Use when executing user-generated or AI-generated code in isolation.

vercel-queues

685
from openai/plugins

Vercel Queues guidance (public beta) — durable event streaming with topics, consumer groups, retries, and delayed delivery. $0.60/1M ops. Powers Workflow DevKit. Use when building async processing, fan-out patterns, or event-driven architectures.

vercel-functions

685
from openai/plugins

Vercel Functions expert guidance — Serverless Functions, Edge Functions, Fluid Compute, streaming, Cron Jobs, and runtime configuration. Use when configuring, debugging, or optimizing server-side code running on Vercel.

vercel-flags

685
from openai/plugins

Vercel Flags guidance — feature flags platform with unified dashboard, Flags Explorer, gradual rollouts, A/B testing, and provider adapters. Use when implementing feature flags, experimentation, or staged rollouts.

vercel-firewall

685
from openai/plugins

Vercel Firewall and security expert guidance. Use when configuring DDoS protection, WAF rules, rate limiting, bot filtering, IP allow/block lists, OWASP rulesets, Attack Challenge Mode, or any security configuration on the Vercel platform.

vercel-cli

685
from openai/plugins

Vercel CLI expert guidance. Use when deploying, managing environment variables, linking projects, viewing logs, managing domains, or interacting with the Vercel platform from the command line.

vercel-api

685
from openai/plugins

Vercel MCP and REST API expert guidance. Use when the agent needs live access to Vercel projects, deployments, environment variables, domains, logs, or documentation through the MCP server or REST API.

vercel-agent

685
from openai/plugins

Vercel Agent guidance — AI-powered code review, incident investigation, and SDK installation. Automates PR analysis and anomaly debugging. Use when configuring or understanding Vercel's AI development tools.