본문으로 건너뛰기
cccskills
무료GitHub에 공개

backend-api-design

Design RPC-style APIs with layered architecture (Controller → Manager → Repository). Use when creating new API endpoints, designing API contracts, or reviewing API patterns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.2 KB
  • code-patterns.md2.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Backend API Design — Quick Reference

URL Patterns

GET  /api/v1/employees              # List (plural)
GET  /api/v1/employee               # Get one (?id=xxx)
POST /api/v1/employee               # Create
POST /api/v1/employee/update        # Update (?id=xxx)
POST /api/v1/employee/delete        # Soft delete (?id=xxx)
POST /api/v1/employee/restore       # Restore (?id=xxx)
POST /api/v1/sync/employees         # Action

Hard Rules

  • NO path params — always @QueryValue, never @PathVariable
  • Singular for single resource — /employee not /employees/{id}
  • Plural for collections — /employees
  • Verb sub-paths for actions — /delete, /restore, /sync

Layered Architecture

Controller  →  thin, just delegates
    ↓
Manager     →  business logic, transactions, Either returns
    ↓
Repository  →  data access only, no business logic

Controller: Thin Wrapper

  • Parse query params with defaults
  • Delegate to manager
  • Unwrap Either with .throwOrValue()
  • NO business logic, NO repository access

Manager: Business Logic

  • Returns Either<ClientException, T>
  • Wraps DB ops in transaction(db.primary) { }
  • Orchestrates multiple repositories
  • Validates business rules

Repository: Data Access

  • Returns entities or null
  • db.replica for reads, db.primary for writes
  • Always checks deletedAt.isNull()

Quick Code Reference

The core controller delegation pattern:

@Get("/employee")
suspend fun getEmployee(@QueryValue id: UUID): EmployeeResponse {
  return employeeManager.findById(id).throwOrValue()
}
  • Response models — companion object { fun from(entity) } in module-client/response/{domain}/
  • Pagination — offset-based, manager returns EmployeeListResponse with items, total, page, limit, hasMore
  • Errors — return ClientError.NOT_FOUND.asException().left() from managers, never throw
  • Factory beans — @Factory class with @Singleton method, wire repos + db into manager

See code-patterns.md for complete controller, response model, pagination, error handling, and factory bean templates.

Gotchas

  • Multi-word @QueryValue params MUST have explicit snake_case names. The frontend axios interceptor sends project_id but Micronaut matches the literal param name. Write @QueryValue("project_id") projectId: UUID, not bare @QueryValue projectId: UUID.
  • Don't use @Put, @Delete, or @Patch. This is RPC-style — all mutations are @Post. The only @Get is for reads.
  • Controllers that inject repositories are a code smell. If you see private val fooRepository: FooRepository in a controller, move it to the manager.
  • andWhere {} not second .where {}. Calling .where {} twice replaces the first condition. Use .andWhere {} to chain.
  • Don't forget @ExecuteOn(TaskExecutors.IO). Without it, suspend functions may hang or run on the wrong thread pool. Every controller needs it.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Creates RPC-style endpoint following layered architecture (Controller → Manager → Repository). Use when creating new API endpoints or CRUD operations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

Write blog posts, guides, tutorials, and long-form content. Sounds like a real person, not AI. Use when the user wants polished written content.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

Run a structured brainstorm session for startup ideas. Takes a theme or problem and generates ideas with quick gut-checks. Use when the user wants to explore a space or generate new ideas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

Run real browser QA with Playwright. Use when testing a frontend feature, verifying UI before PR, smoke testing after deploy, or investigating reported visual bugs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

CI/CD pipeline patterns for GitHub Actions, PR automation, and deployment workflows. Use when setting up CI, fixing broken pipelines, automating PR checks, or configuring deployment.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

Deep competitor analysis. Tear apart a specific competitor or compare multiple competitors. Use when the user names a competitor or asks "who else is doing this?"

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

c0x12c/ai-toolkit1082026년 6월 18일 업데이트

c0x12c의 스킬 모두 보기

이 스킬의 문제 신고