Adds 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).
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.
Generate one vertical slice of a domain in a project bootstrapped by axum-bootstrap. Admin and
Client are split at the file level (admin.rs, client.rs) because their auth model and response
shape diverge. Inside the domain, each file owns one layer, so a reader always knows where to look:
| File | Owns |
|---|---|
entity.rs | The SeaORM 2.0 table model. Columns only, no logic. |
repository.rs | A concrete struct holding every query on the table. Soft-delete filtering lives only here (active()), and every update sets updated_at. |
service.rs | Use-cases and domain rules. Maps DB errors such as SqlErr::UniqueConstraintViolation to <DOMAIN>_<REASON> codes. No SQL. |
dto.rs | Request and response types with utoipa ToSchema (plus Validate on requests). The client response hides internal fields. |
admin.rs / client.rs | Handlers with #[utoipa::path], and the routes() that returns their OpenApiRouter. No business rules. |
mod.rs | pub mod for the files above. |
No trait repositories, no mocks, no generics of our own: the service owns a concrete repository, and tests run it against a real Postgres.
{
"domainName": "coupon", // snake_case Rust module name (kebab-case input is normalized)
"interfaces": ["admin", "client"], // subset; generate only what is asked
"entity": {
"softDeletable": true, // adds deleted_at, active() filter, soft delete
"fields": [
{ "name": "code", "type": "String", "unique": true, "nullable": false }
]
},
"exportContracts": false // monorepo only, see Registration
}
Ask only for what blocks generation: the domain name and its fields. Defaults: interfaces: ["admin","client"], softDeletable: false, unique: false, nullable: false, exportContracts
true only when the repo has packages/contracts/ and a root package.json script codegen:api.
entity is required: this scaffold is table-backed. id, created_at, updated_at (and
deleted_at) are always added; never list them in fields.
From one domainName (examples for order_item):
| Use | Form | Example |
|---|---|---|
| Rust module, folder, table name, test file | snake_case | order_item, src/domains/order_item/, table order_item, tests/order_item.rs |
| URL path segment | kebab-case | /order-item, /admin/order-item |
| Types | PascalCase | OrderItemService, ClientOrderItemRes |
| Error-code prefix | UPPER_SNAKE | ORDER_ITEM_NOT_FOUND |
OpenAPI tag, messages | Korean noun | "주문 항목" |
A domain named after a Postgres reserved word (user, order, group) works through SeaORM,
which quotes identifiers, but every raw SQL line and psql check must write it as "user".
Field names are snake_case in Rust and the DB; the wire is camelCase via #[serde(rename_all = "camelCase")]. Stop if the name is a Rust keyword (type, mod, ref, ...) or an existing module
under src/ (common, error, ...).
type is the Rust type. Accepted without Cargo changes (the bootstrap enables only with-chrono):
type | entity.rs | dto.rs | Request validation |
|---|---|---|---|
String | String | String | length(min = 1, ...); a field named email or *_email gets email(...) instead |
i16 / i32 / i64 | same | same | none unless the caller gives a range |
f64 | f64 | f64 | none; drop Eq from the entity derive (floats are not Eq) |
bool | bool | bool | none |
DateTimeUtc | DateTimeUtc | DateTime<Utc> | none |
nullable: true wraps both sides in Option<...> (a missing JSON key becomes None). Other types
(Decimal, Uuid, Json) need a sea-orm feature in Cargo.toml: stop and ask before adding one.
{
"createdFiles": ["src/domains/coupon/mod.rs", "...", "tests/coupon.rs"], // relative to the api root
"registeredIn": ["src/domains/mod.rs", "src/router_groups.rs"],
"migrationNeeded": true
}
migrationNeeded is true whenever entity.rs was written. This skill never writes the migration.
The caller runs axum-migration next with { "name": "create_<domain>", "apiRoot": "<api root>" }.
The entity's doc comment says where the unique constraint lives (plain UNIQUE, or a partial unique
index WHERE deleted_at IS NULL when soft-deletable), so the migration writer has what it needs.
Until that migration exists, cargo test is red. common::test_db builds each test schema from
the migrations alone, so both tests in tests/<domain>.rs fail with code: "42P01", message: "relation \"<domain>\" does not exist", and cargo stops at that failing test target. The other
test files stay green. So this skill's own gate is fmt + clippy + build (Procedure step 8); the
tests it writes go green once the migration is applied.
Locate the api root: the directory whose Cargo.toml depends on axum and sea-orm. It
is the repo root (standalone) or apps/api (monorepo). Every path below is relative to it, and
every cargo command runs from it.
Verify the convention exists: src/router_groups.rs, src/domains/mod.rs,
src/common/extract.rs, src/common/pagination.rs, src/error.rs and tests/common/mod.rs.
If any is missing, the project was not bootstrapped with this convention. Stop and point at
axum-bootstrap; do not invent the layout.
Verify the target is free. If src/domains/<domain>/ exists, do not overwrite anything in
it. Adding a missing interface is fine: write the missing admin.rs or client.rs, add its
pub mod line to the domain's mod.rs, append the response struct (and any repository or
service method it needs) without rewriting existing items, and register it. That case reports
migrationNeeded: false.
Decide the endpoints (the default slice; build anything else the caller names with the same handler pattern):
| Interface | Endpoints |
|---|---|
| client | GET /<path> list, GET /<path>/{id} one |
| admin | GET /admin/<path> list, POST /admin/<path> create, DELETE /admin/<path>/{id} soft delete (only when softDeletable) |
With client only, POST /<path> create moves to client.rs (the user domain's sign-up is
that shape). With admin only, there is no get-one endpoint.
Write the files from references/templates.md: mod.rs, entity.rs, repository.rs,
service.rs, dto.rs, then admin.rs and/or client.rs. Entities use the SeaORM 2.0 format:
#[sea_orm::model] above #[derive(.., DeriveEntityModel)]. A 1.x-style entity fails with
cannot find type `Relation` in this scope. A bare Expr::col(..).eq(..) in a query needs
use sea_orm::ExprTrait (column methods come from ColumnTrait). /// on a dto.rs type or
field is published as its OpenAPI description, so it is Korean text for the API reader;
developer notes go in //.
Register in src/domains/mod.rs and src/router_groups.rs (see Registration).
Write tests/<domain>.rs from the test template in references/templates.md.
Gate, from the api root:
cargo fmt
cargo fmt --check
cargo clippy --all-targets -- -D warnings # also compiles tests/<domain>.rs
cargo build
The three checks must pass. Do not run cargo test as a gate here (see Outputs).
If exportContracts, run pnpm codegen:api from the repo root. It builds the
export-openapi binary and needs no database.
Report (see Report).
references/templates.md has the code for every file and its variants
(soft-deletable, no unique field, one interface only). Read it before writing files. Placeholders
there and below follow the Naming rule table: {{domain}} snake_case, {{path}} kebab-case,
{{Domain}} PascalCase, {{DOMAIN}} UPPER_SNAKE, {{label}} the Korean noun.
/{{path}} and /admin/{{path}}. openapi::mount nests both groups under
/api/v1; writing /api/v1 here doubles it.routes!(a, b) takes handlers that share one path (list + create on /admin/{{path}}). A
different path is its own .routes(routes!(..)) call.#[utoipa::path] has a Korean tag (the domain label, the same on both files) and a Korean
noun-form summary. Every 4xx is declared as body = ErrorBody, description = "<CODE>, ..."
listing the codes it can return. The frontend branches on code.{{DOMAIN}}_<REASON> (COUPON_NOT_FOUND, COUPON_CODE_TAKEN); messages are
Korean. Shared codes (VALIDATION_FAILED, INVALID_BODY, INVALID_QUERY) come from
common::extract./// on handler functions unless it is Korean text for the API reader: utoipa publishes it
as the operation description.routes! calls (or merging
a routes() twice) panics at boot: Overlapping method route. Handler for `GET /...` already exists.tests/<domain>.rs holds one service test (the service against Postgres, no mocks) and one HTTP
test (build_app driven with oneshot through tests/common).
{{domain}}_ and the test_db("..") argument is the function's
own name. Each name becomes a Postgres schema test_<name>, so it must be unique across tests/
and at most 58 characters (Postgres cuts identifiers at 63 bytes).each_openapi_document_lists_only_its_own_paths in tests/http.rs. An admin route merged
into the client group does not panic; that test is what catches it.Three sites exist; this skill touches two of them, and axum-migration touches the third
(migration/src/lib.rs).
src/domains/mod.rs: add pub mod {{domain}}; (rustfmt keeps the list sorted).
src/router_groups.rs: the one list that feeds the router (build_app) and the client, admin
and all OpenAPI documents (openapi.rs). Add the module to the use and one .merge per
interface, client routes into client_routes() and admin routes into admin_routes():
use crate::domains::{coupon, user};
pub fn client_routes() -> OpenApiRouter<AppState> {
OpenApiRouter::new()
.merge(user::client::routes())
.merge(coupon::client::routes())
}
pub fn admin_routes() -> OpenApiRouter<AppState> {
OpenApiRouter::new()
.merge(user::admin::routes())
.merge(coupon::admin::routes())
}
Append new merges at the end. Nothing else registers routes: no main.rs, lib.rs or
openapi.rs edit.
exportContracts (monorepo with packages/contracts/ and root codegen:api only): after the gate,
run pnpm codegen:api from the repo root so packages/contracts/openapi.json and packages/contracts/src/api.d.ts
include the new paths.
Return the output contract, then:
/api/v1/...) and error codes;migrationNeeded: true with the exact hand-off: run axum-migration with
{ "name": "create_{{domain}}", "apiRoot": "<api root>" }, then cargo test;cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo build pass.src/domains/mod.rs and in the right group(s) of src/router_groups.rs,
each handler registered once.tests/{{domain}}.rs has one service test and one HTTP test with unique test_db names.migrationNeeded.What SKILL.md sets; muted values are Claude Code's defaults
/backend:axum-domain-modulefrom 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-bootstrapScaffolds 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.Other plugins' skills for the same job