Scaffolds a Rust axum 0.8 + SeaORM 2.0 + PostgreSQL 16 backend from zero, standalone or apps/api monorepo. House convention: DDD-lite domains with Admin/Client route groups, fail-fast env validation, three utoipa OpenAPI docs with Swagger UI, tracing JSON logs, a Docker image, tests against a real Postgres. Phase 0 decides standalone (Cargo workspace at the repo root) or apps/api in a pnpm monorepo next to packages/contracts. Use when the user wants to start, set up or scaffold a new axum or Rust backend with this stack: "러스트 백엔드 새로 세팅해줘", "axum 프로젝트 만들어줘", "sea-orm 붙여서 rust api 서버 깔아줘", "bootstrap an axum backend", "scaffold a Rust API with SeaORM and Postgres", "set up apps/api in Rust". Do NOT use for: adding a domain to an existing axum project (use axum-domain-module), writing a SeaORM migration (use axum-migration), NestJS or FastAPI backends (nestjs-bootstrap / fastapi-bootstrap), the whole multi-app bootstrap chain (project-setup), or other Rust frameworks such as actix-web, rocket, poem or loco.
Ships in backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Orchestrates a full project scaffold from the house convention. This file is the
control flow: run the phases in order, pass each phase's gate, and stop
(don't cascade) on failure. The file contents for each phase live in
references/*.md; read the referenced file at the top of each phase, then write the
files. Only phase 12 delegates to other skills; the rest you execute inline.
The phase numbers match nestjs-bootstrap and fastapi-bootstrap, so the three
conventions can be read side by side. The wire contract matches nestjs-bootstrap: the
same ErrorBody keys (minus path), { pagination, data } lists, /ping, /api/health, /api/v1,
client/admin/all OpenAPI documents, repo-root .env with API_PORT.
Every code block in the references was copied from a golden project that passed
cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test, a Docker
build and a boot (2026-11-30, rustc 1.100.1). The empty-registry variants (no domain yet)
were checked on a stripped copy with fmt, clippy, the tests and a boot; the Docker image
was not rebuilt for them.
The CORS layer and CORS_ORIGINS were added afterwards and checked the same way, on the
stripped copy only. The toolchain files (rust-toolchain.toml, rust-version) and the
cross-platform shutdown_signal came last: build, clippy and the tests passed on rustc
1.94.1 and 1.100.1, the Docker image was rebuilt and reached healthy (2026-11-30).
// for why. When adapting a
reference line, keep its style (build-config.md, "Readability rules")..env paths, Dockerfile COPY, compose
dockerfile:, the project slug). A retyped block is how fmt --check and clippy start
failing.lib.rs (phase 6) names modules from phases 7 to 9, so
the first full compile is phase 9's gate.skipped and continue. Re-running on a half-built
project should finish it, not clobber it.cargo install, rustup, and docker compose are
surfaced before running unless the user already said to go ahead.| # | Phase | Reference | Gate | Delegates |
|---|---|---|---|---|
| 0 | Preflight | host stable on the newest stable Rust (RUST_STABLE), sea-orm-cli on sea-orm's major present (or its install approved), docker answered, layout decided | ||
| 1 | Layout | references/layout.md | Cargo.toml with [workspace] + default-members, migration/Cargo.toml, rust-toolchain.toml, placeholders; monorepo: pnpm-workspace.yaml, root package.json, packages/contracts | |
| 2 | Dependencies | references/dependencies.md | cargo build exits 0; one version per crate in the dependencies.md loop | |
| 3 | Build config | references/build-config.md | cargo metadata shows edition 2024, rust_version = RUST_STABLE's minor and both crates in default members; no rustfmt/clippy config, no Makefile/justfile | |
| 4 | Config / env | references/config-env.md | stage.rs + config.rs + repo-root .env.example (API_PORT, CORS_ORIGINS, no bare PORT) + .gitignore, keys agree both ways | |
| 5 | Persistence | references/persistence.md | db.rs, migration/src/lib.rs with an empty Migrator, migration/src/main.rs with the layout's .env path | |
| 6 | App bootstrap | references/bootstrap-app.md | main.rs, lib.rs (CORS outermost), state.rs, empty router_groups.rs and domains/mod.rs | |
| 7 | Observability | references/observability.md | error.rs (nest-compatible body), telemetry.rs (G10), health.rs | |
| 8 | OpenAPI | references/openapi.md | openapi.rs builds three docs from router_groups; /docs only local-like; monorepo: export-openapi + default-run + codegen:api | |
| 9 | Common | references/common.md | first compile: cargo build, cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test --lib | |
| 10 | Infra | references/infra.md | Dockerfile (cargo-chef, pinned images, shell-form HEALTHCHECK), root compose + .dockerignore, repo-root .env created | |
| 11 | Test setup | references/testing.md | tests/common + tests/http.rs; cargo test --no-run; with db up, all but the OpenAPI-split test pass | |
| 12 | First domain | domain files exist, registered in domains/mod.rs + router_groups.rs, migration generated, registered and reviewed | Skill: backend:axum-domain-module, then Skill: backend:axum-migration | |
| 13 | Verify | fmt, clippy, tests, migration, boot, endpoints, prod stage all checked with evidence |
Create one todo per phase so progress is visible and resumable.
0. Preflight. Run cargo +stable -V and rustc +stable -V: phase 1's
rust-toolchain.toml selects the stable channel, so stable is what every later cargo
call runs.
The scaffold targets the newest stable Rust, resolved now and not from memory (Rust has
no LTS line; stable moves every six weeks):
RUST_STABLE=$(curl -fs https://static.rust-lang.org/dist/channel-rust-stable.toml | grep -m1 -A1 '^\[pkg.rust\]' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
Offline, take the host's rustc +stable -V. Two places take this value: rust-version in
both manifests gets its minor (1.100 for 1.100.1, layout.md), and the builder image is the
newest published cargo-chef tag for that minor (infra.md). Every 1.100 in the references
stands for it. The host's stable has to be on that minor or newer: with an older one,
phase 2's cargo build stops with rustc 1.93.1 is not supported by the following packages: and lists [email protected] requires rustc 1.94 (measured on 1.93.1 against a 1.94
rust-version). So when rustc +stable -V is behind, stop and say so. rustup update stable is the user's call, and so is installing stable when rustup toolchain list has
none; a non-interactive or pre-approved run updates it and says so.
The tree's own minimum is lower: sea-orm 2.0.4 and sqlx 0.9.1 declare rust-version = "1.94.0", utoipa and validator 1.88, tokio and sea-orm-migration 1.85, edition 2024 needs
1.85. Verified on rustc 1.94.1 and 1.100.1, 2026-11-30: build, cargo clippy --all-targets -- -D warnings and cargo test all green on both.
Then sea-orm-cli --version. Phase 12 generates migrations with it, and its major must
match sea-orm's (cargo search sea-orm --limit 1 prints the newest; 2.x today, the golden run used 2.0.4). If it is missing, offer
cargo install sea-orm-cli --version '^2' --locked (the major sea-orm is on; an unpinned install can land on a major ahead of the crate): it compiles for a few minutes and writes to ~/.cargo/bin, so
it is an install the user approves. A non-interactive or pre-approved run installs it and
says so. A 1.x CLI is a stop: report the version and ask before replacing it.
Then docker compose version (≥ 2.24 for env_file with required: false). Docker
runs the database for phases 10, 11, 12 and 13. Without it, phases 0 to 9 still complete;
every DB-backed gate is reported not verified, never passed.
Monorepo only: pnpm -v (the root codegen:api script and the workspace).
Then decide the layout. It changes phases 1, 4, 5, 8, 10 and the commands in 13:
api + migration).apps/api, inside a pnpm workspace with
packages/contracts.Look before asking: an existing pnpm-workspace.yaml or apps/ directory settles it (add
apps/api). Greenfield, default to monorepo when a Next.js frontend is in the picture,
since nextjs-bootstrap joins as apps/web and reads the types codegen:api writes into
packages/contracts. Otherwise ask, and do not scaffold a pnpm workspace for a single
service nobody asked to share. Standalone is not a one-way door (layout.md, conversion).
Ask for the project name in the same message; its slug becomes the compose name: (rule in
infra.md). A non-interactive run derives it from the directory and marks it assumed.
Gate: toolchain checked, target dir, layout and project name agreed.
1. Layout. Read references/layout.md. Write the two manifest headers,
rust-toolchain.toml and the two placeholders (src/main.rs with fn main() {}, empty
migration/src/lib.rs) at the api root; in monorepo mode also the repo-root
pnpm-workspace.yaml, package.json and packages/contracts/package.json (merge into
existing ones). Every later phase writes
relative to the api root: apps/api in monorepo mode, the repo root standalone.
Gate: cargo metadata --no-deps --format-version 1 lists api and migration; monorepo:
pnpm -r ls shows only monorepo-root and @app/contracts.
2. Dependencies. Read references/dependencies.md. Run its cargo add lines from the
api root, every one with -p api or -p migration (a bare cargo add fails under
default-members). Version policy: no version on any cargo add, so each crate lands on
its newest release; never * or =; Cargo.lock does the rest. A crate that ends up in
the tree twice is the one to step down (dependencies.md). Gate: cargo build exits 0 and
the one-version loop in dependencies.md prints nothing. Fallback: on a resolver error,
surface cargo's output and stop.
3. Build config. Read references/build-config.md. Nothing new to write beyond the
phase 1 files; this phase checks edition = "2024", rust-version on RUST_STABLE's minor,
default-members (G5: without it clippy at the root silently skips the migration crate),
publish = false, rust-toolchain.toml on stable, and the policy of default rustfmt and
clippy with no config files and no Makefile/justfile/cargo aliases (every command is one
cargo call). Gate: cargo metadata shows edition 2024 and that rust_version for both
crates and both in workspace_default_members. Do not run fmt or clippy yet: src/ is a
placeholder.
4. Config / env. Read references/config-env.md. Write src/stage.rs, src/config.rs
(fail-fast Settings that lists every problem at once, CORS_ORIGINS included), the
repo-root .env.example and .gitignore. The .env path in config.rs is built from
CARGO_MANIFEST_DIR: "/.env" standalone, "/../../.env" monorepo. Gate: every key Settings reads is in
.env.example and the reverse; no apps/api/.env*; git check-ignore -q .env.example
exits 1. Fallback: without real values, .env.example documents them; never invent
secrets.
5. Persistence. Read references/persistence.md. Write src/db.rs, the empty
migration/src/lib.rs and migration/src/main.rs (.env path "/../.env" standalone,
"/../../../.env" monorepo). The empty vec![] is deliberate and carries a trap for
phase 12 (G1): sea-orm-cli migrate generate appends the first migration's mod line
at the end of the file and does not register it in vec![], silently. The first
migration must be registered by hand; later ones register themselves. Also G2: never
cargo run -p migration -- generate from the api root (it writes into ./src/). Gate:
cargo build exits 0 and no code under src/ runs migrations.
6. App bootstrap. Read references/bootstrap-app.md. Write src/main.rs (config,
logging, pool, app, serve with graceful shutdown, in that order), src/lib.rs
(build_app, the 404 fallback, the CORS layer for CORS_ORIGINS as the outermost layer),
src/state.rs, src/router_groups.rs with empty client_routes() / admin_routes(), and
an empty src/domains/mod.rs. Gate: the files
exist and router_groups.rs is the only place domain routes will be listed (lib.rs and
openapi.rs read its two functions). No compile yet.
7. Observability. Read references/observability.md. Write src/error.rs (AppError
and ErrorBody with statusCode, code, message, timestamp, the NestJS
AllExceptionsFilter shape minus path, G16), src/telemetry.rs (request id, one span
per request, human-readable logs only for the local and test stages and JSON everywhere else,
the docker stage included, with
.flatten_event(true).with_span_list(false), G10), and src/health.rs (/ping,
/api/health with a real DB ping). Gate: files match the reference; lib.rs and
main.rs already call into them.
8. OpenAPI. Read references/openapi.md. Write src/openapi.rs: mount nests each
group under /api/v1 and splits out its document, swagger_ui serves /docs and
/openapi/{all,client,admin}.json, merged by build_app only when
stage.is_local_like(). Monorepo: also src/bin/export-openapi.rs, default-run = "api"
in Cargo.toml, and the root codegen:api script. Gate: the documents come from
router_groups only; no second registration path.
9. Common. Read references/common.md. Write src/common/{mod,pagination,extract}.rs:
PaginationQuery (limit 1 to 100, default 15), generic Paginated<T>, and
ValidatedJson / ValidatedQuery that turn every rejection into an AppError 400. Gate,
the first full compile: cargo build, cargo fmt --check,
cargo clippy --all-targets -- -D warnings and cargo test --lib (3 passed) all exit 0.
A failure here is a copy error in phases 4 to 9; fix it there, never with #[allow].
10. Infra. Read references/infra.md. Write docker/Dockerfile (cargo-chef stages,
images pinned per G12, non-root uid 10001, shell-form HEALTHCHECK on
${API_PORT:-9999} per G6), the repo-root docker-compose.yml (app + postgres:16)
and .dockerignore. Monorepo: apps/api/docker/Dockerfile copies apps/api and builds
--bin api --bin migration; compose points dockerfile: at it; .dockerignore uses
**/target and **/rust-toolchain.toml. .dockerignore keeps rust-toolchain.toml out
of the build context in both layouts: inside the builder image it made rustup download
stable at build time (infra.md). If a root docker-compose.yml already exists,
merge into it: add only the missing service, reuse its db, never rewrite it wholesale
(infra.md, "Merging").
Before the gate, create the repo-root .env if it is missing:
[ -f .env ] || cp .env.example .env from the repo root, the one .env in both layouts.
Do it even when the rest of the phase is skipped: phases 11 to 13 read it. Gate: no
latest tag, every compose ${VAR} has a :-default and docker compose config exits 0
with .env moved aside, pre-existing services survive with no host port bound twice;
when docker use is agreed, docker compose up -d --build app reaches healthy and /ping
answers pong.
11. Test setup. Read references/testing.md. Write tests/common/mod.rs (test_db
gives each test its own schema test_<fn name> in <DB_NAME>_test, created once under an
advisory lock, fully migrated) and tests/http.rs (ping, health, OpenAPI split). Gate:
cargo test --no-run exits 0; with docker compose up -d db running,
cargo test -- --skip each_openapi_document_lists_only_its_own_paths passes (config, ping,
health, CORS preflight). The skipped test is red until phase 12 registers a domain, by design: it is the
G14 guard. A connection failure after 5 s with cannot connect to postgres (is `docker compose up -d db` running?) is G13, the intended message: start the db.
12. First domain. Delegate; do not hand-write the domain:
Skill(backend:axum-domain-module) with
{ domainName: <chosen>, interfaces: ["admin","client"], entity: { softDeletable, fields }, exportContracts: <monorepo> }.
exportContracts is true in monorepo mode (the domain module runs
pnpm codegen:api afterwards) and false standalone. Ask for the domain and its
fields; a non-interactive or pre-approved run takes user with one email field,
soft-deletable, and marks it assumed. Confirm the returned registeredIn is
["src/domains/mod.rs","src/router_groups.rs"] and both files changed.migrationNeeded: true, Skill(backend:axum-migration) with
{ name: "create_<domain>", apiRoot } (apiRoot is apps/api in monorepo mode, .
standalone). This is the project's first migration, so it hits G1: check that
migration/src/lib.rs has the Box::new(m..._create_<domain>::Migration) entry and
the mod line above pub struct Migrator;, whoever wrote it. Honor every verdict:
safe continues to phase 13; needs-review stops, and you surface
destructiveOps before anything is applied.Where the runtime has no Skill(...) call, read that sibling skill's own SKILL.md (next to this
skill's directory, wherever the skills are installed) and follow it inline with the same inputs.
Gate: domain files exist under src/domains/<domain>/, the two registration files list
it, and a reviewed migration file is registered in migration/src/lib.rs.
13. Verify. The final gate: prove it runs, don't assert it. From the api root
(monorepo: cd apps/api, compose commands from the repo root):
docker compose stop app # repo root; phase 10 left it on API_PORT, which cargo run needs
docker compose up -d db # repo root
cargo run -p migration -- up # "Applying all pending migrations" (or "No pending migrations")
cargo run -p migration -- status # the create_<domain> migration listed as applied
cargo fmt --check # exit 0, no output
cargo clippy --all-targets -- -D warnings # exit 0
cargo test # every target "0 failed", incl. each_openapi_document_lists_only_its_own_paths
cargo run -p api # in the background; log line `listening addr=0.0.0.0:<API_PORT>`
Then check against the running server, with the evidence in the report:
curl -si localhost:$API_PORT/ping: 200, body pong, an x-request-id header.curl -s localhost:$API_PORT/api/health:
{"info":{"database":{"status":"up"}},"status":"ok"}, non-empty.curl -s -o /dev/null -w '%{http_code}' localhost:$API_PORT/docs/: 200. Use the
trailing slash: /docs is a 303 (G8).curl -s localhost:$API_PORT/openapi/client.json | jq -r '.paths | keys[]' lists only
/api/v1/<domain>... paths, admin.json only /api/v1/admin/..., and all.json both.curl -s localhost:$API_PORT/api/v1/<domain>:
{"pagination":{"limit":15,"offset":0,"total":0},"data":[]}.curl -s localhost:$API_PORT/nope: 404 with "code":"ROUTE_NOT_FOUND"..env default CORS_ORIGINS=http://localhost:3000:
curl -si -X OPTIONS localhost:$API_PORT/api/health -H 'Origin: http://localhost:3000' -H 'Access-Control-Request-Method: POST'
is 200 with access-control-allow-origin: http://localhost:3000 and
access-control-allow-credentials: true; the same with Origin: http://evil.example has
no access-control-allow-origin; curl -si localhost:$API_PORT/nope -H 'Origin: http://localhost:3000'
is the 404 and still carries access-control-allow-origin and
access-control-expose-headers: x-request-id.STAGE=prod cargo run -p api: /docs/ and
/openapi/all.json are 404, /ping is 200, and log lines are JSON objects.pnpm codegen:api from the repo root writes packages/contracts/openapi.json
and src/api.d.ts containing the domain's paths (skip if the domain module already ran
it and the files are current). Then write packages/contracts/src/index.ts, the alias file
in layout.md, if it is missing, and check pnpm exec tsc --noEmit -p packages/contracts or
a sibling web app's typecheck resolves ApiErrorBody and UserSummary from @app/contracts.When docker use is agreed, also docker compose up -d --build app and
docker compose run --rm app /app/migration status (container healthy, /ping pong).
Stop everything you started: kill each cargo run -p api (check the port is free again) and
docker compose stop the containers (stop, not down -v: the dev data stays). Report
each check with its evidence. Fallback: if boot fails, report the error and the phase
most likely responsible; do not claim completion. (Common first-boot failures: a missing
.env gives invalid environment (5 problems): and exit 1; a CORS_ORIGINS entry with a
trailing slash or a path is listed there as
CORS_ORIGINS must be comma-separated origins like http://localhost:3000, got "http://localhost:3000/";
a db not running gives cannot connect to the database after 5 s; a port in use gives cannot bind.)
// input to axum-domain-module
{ "domainName": "user", "interfaces": ["admin","client"],
"entity": { "softDeletable": true, "fields": [{ "name": "email", "type": "String", "unique": true, "nullable": false }] },
"exportContracts": true } // false in standalone layout
// output
{ "createdFiles": [...], "registeredIn": ["src/domains/mod.rs","src/router_groups.rs"], "migrationNeeded": true }
// input to axum-migration (only if migrationNeeded)
{ "name": "create_user", "apiRoot": "apps/api" } // "." in standalone layout
// output
{ "migrationFile": "migration/src/m<timestamp>_create_user.rs", "verdict": "safe|needs-review", "destructiveOps": [] }
Auth/authz policy, cache/Redis, S3 upload, background jobs, CI/CD, security
baseline (rate limiting, security headers), seed data. These are per-project decisions:
do not scaffold them here, and don't flag their absence as a gap.
One consequence is reported, not fixed: the first domain's admin routes ship public. Say so
in one line of the final report, and leave the admin_routes() comment (bootstrap-app.md)
that names where the auth layer goes once the project has one.
evals/evals.json (opens in a new tab)evals/results-2026-11-30.md (opens in a new tab)evals/results-2026-12-02.md (opens in a new tab)evals/run.sh (opens in a new tab)evals/trigger-eval.json (opens in a new tab)references/bootstrap-app.md (opens in a new tab)references/build-config.md (opens in a new tab)references/common.md (opens in a new tab)references/config-env.md (opens in a new tab)references/dependencies.md (opens in a new tab)references/infra.md (opens in a new tab)references/layout.md (opens in a new tab)references/observability.md (opens in a new tab)references/openapi.md (opens in a new tab)references/persistence.md (opens in a new tab)references/testing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
/backend:axum-bootstrapfrom backend
npx claudepluginhub siu9068/ggyul-skills --plugin backend11 skills in this plugin
/api-creator-bootstrapGenerates a backend repo's `api-creator` + `test-checker` skill pair: set up, port, or bootstrap the API + test skills here. Generate a project-tailored TDD skill PAIR — `api-creator` (scaffold new APIs) and `test-checker` (audit & fill existing unit tests) — for a backend project: extract the proven gated, test-first methodology and fill in THIS project's own conventions (layers, base classes, auth, DTO/serialization, folder layout, test framework, verify commands). Both skills share one discovered recipe so they stay consistent. Use whenever the user wants to "set up api-creator here", "port the api-creator/test-checker skills to this project", "bootstrap the API + test skills for this repo", or bring one project's API + test conventions into another as reusable skills. Do NOT use this to actually build an API or audit tests in the current project (that is the generated skills' job), nor to edit an existing skill (use skill-creator / skill-ops)./axum-domain-moduleAdds a domain module to an existing axum + SeaORM 2.0 Rust API: "axum 프로젝트에 coupon 도메인 추가해줘", "add an orders module to the axum api". Scaffolds src/domains/NAME in the house DDD-lite layout (SeaORM entity, concrete repository, service with domain error codes, utoipa DTOs, admin and client handlers), registers it in src/domains/mod.rs and src/router_groups.rs (router plus client/admin/all OpenAPI docs), and seeds a service test and an HTTP test. Use whenever a request on a Rust axum codebase names a new resource or table: "러스트 api에 notice 도메인 만들어줘". Also for adding the missing admin or client side to an existing domain ("user 모듈에 admin.rs 추가해줘"): a hand edit misses the router_groups registration and the OpenAPI split. Do NOT use for: bootstrapping a new axum project (axum-bootstrap), the migration (axum-migration; this skill hands off to it), NestJS or FastAPI projects (nestjs-domain-module, fastapi-domain-module), or end-to-end feature work (feature-builder, or the project's generated api-creator).Other plugins' skills for the same job