encore
БесплатноБез исполняемых скриптовНе проверенBuild cloud backend applications with Encore — type-safe backend framework with built-in infrastructure. Use when someone asks to "build a backend", "Encore"…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Encore
Overview
Encore is an open-source backend framework (TypeScript via the encore.dev npm package, or Go) where infrastructure is declared in application code. You write api() endpoints, new SQLDatabase(...), new Topic(...) and new CronJob(...); the Encore CLI compiles the app, runs the resources locally (Postgres in Docker, an in-process broker), and Encore Cloud provisions the real ones in AWS or GCP. It also generates API docs, a service catalog, a client library and distributed traces from the same source. This skill covers Encore.ts (encore.dev 1.58.x).
When to Use
- Building a typed REST backend where databases, pub/sub and cron should not need Terraform
- Splitting a monolith into services that call each other as plain functions
- Self-hosting a compiled backend as a Docker image
Instructions
Setup
brew install encoredev/tap/encore # macOS and Linux with Homebrew
encore version
encore app create orders-api --lang=ts # asks to sign in to Encore Cloud unless --platform=false
cd orders-api
encore run # local server + dashboard (needs Docker for databases)
On Windows or Linux without Homebrew, the docs provide an installer script; download it, read it, then run it rather than piping it into a shell. encore app create --example=ts/url-shortener starts from a working example instead of an empty app.
A service is a directory containing an encore.service.ts file with import { Service } from "encore.dev/service"; export default new Service("user");; put it next to the endpoints below. The local dashboard (printed by encore run, http://localhost:9400) shows requests, traces and the architecture diagram.
Define API endpoints
// user/user.ts — service "user"
import { api, APIError } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("users", { migrations: "./migrations" });
interface User { id: number; email: string; name: string }
export const create = api(
{ method: "POST", path: "/user", expose: true },
async (params: { email: string; name: string }): Promise<User> => {
const row = await db.queryRow<User>`
INSERT INTO users (email, name) VALUES (${params.email}, ${params.name})
RETURNING id, email, name`;
return row!;
},
);
export const get = api(
{ method: "GET", path: "/user/:id", expose: true },
async ({ id }: { id: number }): Promise<User> => {
const row = await db.queryRow<User>`SELECT id, email, name FROM users WHERE id = ${id}`;
if (!row) throw APIError.notFound("user not found"); // returns HTTP 404
return row;
},
);
export const list = api(
{ method: "GET", path: "/user", expose: true },
async (p: { limit?: number; offset?: number }): Promise<{ users: User[] }> => {
const users = await db.queryAll<User>`
SELECT id, email, name FROM users ORDER BY id DESC
LIMIT ${p.limit ?? 20} OFFSET ${p.offset ?? 0}`;
return { users };
},
);
-- user/migrations/1_create_users.up.sql
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL
);
Rules worth knowing:
- Endpoints are private unless
expose: true; private ones can only be called by other services and cron jobs.auth: truerequires an auth handler. - For GET, HEAD and DELETE the parameters come from the query string; for other methods from the JSON body unless the field is typed
Query<number>,Header<"X-Request-Id">and so on. - Migrations are
<number>_<name>.up.sqlfiles that run in order; there are no automatic down migrations. db.queryreturns an async iterator (for await (const row of rows)); usequeryAllfor an array andexecfor statements without rows.- Add a new database or topic while
encore runis running and you must restart it.
Call another service
// orders/orders.ts
import { api } from "encore.dev/api";
import { user } from "~encore/clients"; // generated typed client, no HTTP code
export const summary = api(
{ method: "GET", path: "/orders/:userId/summary", expose: true },
async ({ userId }: { userId: number }): Promise<{ owner: string }> => {
const u = await user.get({ id: userId });
return { owner: u.name };
},
);
Pub/Sub
// notifications/events.ts
import { Topic, Subscription } from "encore.dev/pubsub";
export interface UserCreated { userId: number; email: string }
export const userCreated = new Topic<UserCreated>("user-created", {
deliveryGuarantee: "at-least-once", // required; or "exactly-once"
});
new Subscription(userCreated, "send-welcome-email", {
handler: async (event) => {
await mailer.sendWelcome(event.email); // must be idempotent: delivery can repeat
},
});
Publish with await userCreated.publish({ userId: 42, email: "[email protected]" }). A handler that throws is retried, then the event goes to a dead-letter queue
Установить encore в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл encore?
Build cloud backend applications with Encore — type-safe backend framework with built-in infrastructure. Use when someone asks to "build a backend", "Encore", "type-safe API framework", "backend with built-in infra", "auto-provision cloud resources", or "backend framework with databases built-in". Covers API definition, databases, pub/sub, cron, and auto-provisioned infrastructure.
Как установить скилл encore?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл encore запускает скрипты?
Нет, скилл состоит только из инструкций (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