oak
БесплатноБез исполняемых скриптовНе проверенOak Deno middleware framework inspired by Koa. Covers routing, middleware, context, WebSocket, and static files. Use for Koa-like Deno APIs. USE WHEN: user…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Oak Core Knowledge
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:oakfor comprehensive documentation.
Full Reference: See advanced.md for WebSocket patterns, Error Handling, Validation with Zod, and Production Readiness (health checks, graceful shutdown, logging).
Basic Setup
import { Application, Router } from "https://deno.land/x/[email protected]/mod.ts";
const app = new Application();
const router = new Router();
router.get("/", (ctx) => {
ctx.response.body = "Hello, World!";
});
app.use(router.routes());
app.use(router.allowedMethods());
console.log("Server running on http://localhost:8080");
await app.listen({ port: 8080 });
Configuration
// deps.ts - Centralized dependencies
export {
Application,
Router,
Context,
Status,
isHttpError,
} from "https://deno.land/x/[email protected]/mod.ts";
export type {
Middleware,
RouterContext,
State,
} from "https://deno.land/x/[email protected]/mod.ts";
// main.ts
import { Application, Router } from "./deps.ts";
Routing
Basic Routes
import { Router } from "./deps.ts";
const router = new Router();
router
.get("/users", listUsers)
.get("/users/:id", getUser)
.post("/users", createUser)
.put("/users/:id", updateUser)
.delete("/users/:id", deleteUser);
// Handler functions
function listUsers(ctx: RouterContext<"/users">) {
ctx.response.body = { users: [] };
}
function getUser(ctx: RouterContext<"/users/:id">) {
const { id } = ctx.params;
ctx.response.body = { id };
}
Path Parameters
const router = new Router();
// Single parameter
router.get("/users/:id", (ctx) => {
const id = ctx.params.id;
ctx.response.body = { userId: id };
});
// Multiple parameters
router.get("/users/:userId/posts/:postId", (ctx) => {
const { userId, postId } = ctx.params;
ctx.response.body = { userId, postId };
});
// Optional parameter
router.get("/files/:path*", (ctx) => {
const path = ctx.params.path;
ctx.response.body = { path };
});
Route Prefixes
const apiRouter = new Router({ prefix: "/api" });
apiRouter
.get("/users", listUsers) // GET /api/users
.post("/users", createUser); // POST /api/users
const v1Router = new Router({ prefix: "/api/v1" });
const v2Router = new Router({ prefix: "/api/v2" });
app.use(v1Router.routes());
app.use(v2Router.routes());
Context
Request Data
router.post("/users", async (ctx) => {
// Path params
const id = ctx.params.id;
// Query params
const page = ctx.request.url.searchParams.get("page") || "1";
// Headers
const auth = ctx.request.headers.get("Authorization");
// Body
const body = ctx.request.body;
if (body.type() === "json") {
const data = await body.json();
console.log(data);
}
if (body.type() === "form") {
const form = await body.form();
const name = form.get("name");
}
ctx.response.body = { success: true };
});
Response
router.get("/users/:id", (ctx) => {
// JSON response
ctx.response.body = { id: ctx.params.id, name: "Alice" };
ctx.response.type = "application/json";
// Status code
ctx.response.status = 200;
// Headers
ctx.response.headers.set("X-Custom-Header", "value");
});
// Redirect
router.get("/old-path", (ctx) => {
ctx.response.redirect("/new-path");
});
State
interface AppState {
user?: { id: string; email: string };
requestId: string;
}
const app = new Application<AppState>();
// Set state in middleware
app.use(async (ctx, next) => {
ctx.state.requestId = crypto.randomUUID();
await next();
});
// Access state in handler
router.get("/me", (ctx: RouterContext<"/me", Record<string, string>, AppState>) => {
const user = ctx.state.user;
if (!user) {
ctx.response.status = 401;
return;
}
ctx.response.body = user;
});
Middleware
Application Middleware
import { Application, Status, isHttpError } from "./deps.ts";
const app = new Application();
// Logger middleware
app.use(async (ctx, next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
console.log(`${ctx.request.method} ${ctx.request.url.pathname} - ${ms}ms`);
});
// Error handler middleware
app.use(async (ctx, next) => {
try {
await next();
} catch (err) {
if (isHttpError(err)) {
ctx.response.status = err.status;
ctx.response.body = { error: err.message };
} else {
console.error(err);
ctx.response.status = Status.InternalServerError;
ctx.response.body = { error: "Internal server error" };
}
}
});
Authentication Middleware
import { Middleware, Status } from "./deps.ts";
interface AuthState {
user: { id: string; email: string; role: string };
}
const authMiddleware: Middleware<AuthState> = async (ctx, next) => {
const authHeader = ctx.request.headers.get("Authorization"
Установить oak в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditВложенные файлы
FAQ
Что делает скилл oak?
Oak Deno middleware framework inspired by Koa. Covers routing, middleware, context, WebSocket, and static files. Use for Koa-like Deno APIs. USE WHEN: user mentions "Oak", "oak", "Deno middleware", "Koa for Deno", asks about "Deno web framework", "Deno API server", "context-based routing in Deno", "Koa alternative for Deno" DO NOT USE FOR: Node.js apps - use `express` or `nestjs` instead, Fresh framework - use `fresh` skill instead, Edge runtimes - use `hono` instead, React SSR in Deno - use `fresh` instead
Как установить скилл oak?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл oak запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic