allra-api-design
Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
Best use case
allra-api-design is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "allra-api-design" skill to help with this workflow task. Context: Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/allra-api-design/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How allra-api-design Compares
| Feature / Agent | allra-api-design | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Allra Backend API 설계 및 패키지 구조
Allra 백엔드 팀의 API 설계, DTO 네이밍, 패키지 구조 표준을 정의합니다.
## 프로젝트 기본 정보
이 가이드는 다음 환경을 기준으로 작성되었습니다:
- **Java**: 17 이상
- **Spring Boot**: 3.2 이상
- **주요 기술**: JPA/Hibernate, QueryDSL, JWT
**참고**: 프로젝트별로 사용하는 기술 스택이나 버전이 다를 수 있습니다. 프로젝트에 맞게 조정하여 사용하세요.
## 패키지 구조 규칙
도메인별 패키지 구조를 권장합니다:
```text
└── {domain}
├── api // 컨트롤러 레이어
├── dto // 데이터 전송 객체
├── entity // JPA 엔티티
├── enums // Enum 정의 (선택)
├── repository // 데이터 접근 계층
└── service // 비즈니스 로직
```
**참고**: 프로젝트에 따라 `controller`, `model`, `dao` 등 다른 이름을 사용할 수 있습니다. 중요한 것은 레이어별 책임을 명확히 분리하는 것입니다.
### 예시
```text
└── user
├── api
│ └── UserController.java
├── dto
│ ├── UserSignUpEventDto.java // 내부 사용
│ ├── request
│ │ └── SignUpRequest.java
│ └── response
│ └── SignUpResponse.java
├── entity
│ └── User.java
├── repository
│ ├── UserRepository.java
│ └── UserRepositorySupport.java
└── service
└── UserService.java
```
## DTO 네이밍 규칙
### 1. 클라이언트 통신 DTO
- **Request**: `{Operation}Request`
- 예: `SignUpRequest`, `UpdateUserRequest`
- **Response**: `{Operation}Response`
- 예: `SignUpResponse`, `UserDetailResponse`
### 2. 내부 사용 DTO
내부에서만 사용하는 DTO는 `Dto` 접미사 추가:
- Repository Layer QueryDSL Fetch DTO
- Internal Layer Transfer DTO
- 예: `UserSignUpEventDto`, `UserSummaryDto`
### 3. Record 사용
**DTO 같은 단순 클래스들은 가능하면 대부분 record로 생성**
```java
// Request/Response
public record SignUpRequest(
String email,
String password,
String name
) {}
public record SignUpResponse(
Long userId,
String email
) {}
// 내부 사용 DTO
public record UserSignUpEventDto(
Long userId,
String email,
LocalDateTime signUpAt
) {}
```
## API 컨트롤러 설계 가이드
### 1. REST API 명명 규칙
```java
@RestController
@RequestMapping("/api/v1/users")
public class UserController {
// GET /api/v1/users - 목록 조회
@GetMapping
public List<UserResponse> getUsers() { }
// GET /api/v1/users/{id} - 단건 조회
@GetMapping("/{id}")
public UserDetailResponse getUser(@PathVariable Long id) { }
// POST /api/v1/users - 생성
@PostMapping
public SignUpResponse createUser(@RequestBody @Valid SignUpRequest request) { }
// PUT /api/v1/users/{id} - 전체 수정
@PutMapping("/{id}")
public UserResponse updateUser(
@PathVariable Long id,
@RequestBody @Valid UpdateUserRequest request
) { }
// PATCH /api/v1/users/{id} - 부분 수정
@PatchMapping("/{id}")
public UserResponse patchUser(
@PathVariable Long id,
@RequestBody @Valid PatchUserRequest request
) { }
// DELETE /api/v1/users/{id} - 삭제
@DeleteMapping("/{id}")
public void deleteUser(@PathVariable Long id) { }
}
```
**참고**: API 버저닝(`/api/v1/...`)은 프로젝트 정책에 따라 선택적으로 적용합니다.
### 2. Request Validation
모든 Request DTO는 Bean Validation 사용:
```java
public record SignUpRequest(
@NotBlank(message = "이메일은 필수입니다")
@Email(message = "올바른 이메일 형식이 아닙니다")
String email,
@NotBlank(message = "비밀번호는 필수입니다")
@Size(min = 8, message = "비밀번호는 최소 8자 이상이어야 합니다")
String password,
@NotBlank(message = "이름은 필수입니다")
String name
) {}
```
### 3. 응답 형식
**Allra 표준 형식 (예시):**
성공 응답:
```json
{
"data": { ... },
"message": "요청이 성공적으로 처리되었습니다"
}
```
에러 응답:
```json
{
"error": {
"code": "USER_NOT_FOUND",
"message": "사용자를 찾을 수 없습니다",
"details": []
}
}
```
**참고**: 응답 형식은 프로젝트별로 다를 수 있습니다. 일관성 있는 형식을 유지하는 것이 중요합니다.
## When to Use This Skill
이 skill은 다음 상황에서 자동으로 적용됩니다:
- 새로운 API 엔드포인트 생성
- DTO 클래스 작성
- 컨트롤러 구현
- 도메인 패키지 구조 설계
- Request/Response 객체 네이밍
## Examples
### 예제 1: 새로운 도메인 API 생성
```java
// 1. 패키지 구조 생성
kr.co.allra.product/
├── api/ProductController.java
├── dto/
│ ├── request/CreateProductRequest.java
│ └── response/ProductResponse.java
├── entity/Product.java
├── repository/ProductRepository.java
└── service/ProductService.java
// 2. Request DTO
public record CreateProductRequest(
@NotBlank String name,
@NotNull BigDecimal price
) {}
// 3. Response DTO
public record ProductResponse(
Long id,
String name,
BigDecimal price,
LocalDateTime createdAt
) {}
// 4. Controller
@RestController
@RequestMapping("/api/v1/products")
public class ProductController {
@PostMapping
public ProductResponse createProduct(
@RequestBody @Valid CreateProductRequest request
) {
return productService.createProduct(request);
}
}
```
### 예제 2: 내부 DTO 생성
```java
// QueryDSL 결과를 위한 내부 DTO
public record ProductSummaryDto(
Long id,
String name,
Long orderCount
) {
@QueryProjection
public ProductSummaryDto {}
}
// 이벤트 전달용 내부 DTO
public record ProductCreatedEventDto(
Long productId,
String productName,
LocalDateTime createdAt
) {}
```
## Checklist
새로운 API를 만들 때 확인사항:
- [ ] 도메인별 패키지 구조를 따르는가?
- [ ] Request/Response DTO 네이밍이 규칙을 따르는가?
- [ ] DTO가 record로 작성되었는가?
- [ ] Request DTO에 Validation이 적용되었는가?
- [ ] REST API 명명 규칙을 따르는가?
- [ ] 내부 사용 DTO에 `Dto` 접미사가 있는가?Related Skills
ui-design
UI 样式修改协作流程。当用户要求修改页面样式、调整布局、改 UI 细节时使用。通过"截图定位 → 现状描述 → 方案选择 → 改代码 → 微调"的结构化流程,减少沟通偏差,避免浪费 token。
design-exploration
新功能设计探索流程。当用户有模糊想法要做新功能/新模块时使用。通过"需求收敛 → 技术调研 → ASCII 批量探索 → HTML 设计稿 → 全状态覆盖 → 需求总结"的结构化流程,从模糊想法产出可交付的设计参考文档,作为 PRD 阶段的输入。
web-component-design
Master React, Vue, and Svelte component patterns including CSS-in-JS, composition strategies, and reusable component architecture. Use when building UI component libraries, designing component APIs, or implementing frontend design systems.
visual-design-foundations
Apply typography, color theory, spacing systems, and iconography principles to create cohesive visual designs. Use when establishing design tokens, building style guides, or improving visual hierarchy and consistency.
react-native-design
Master React Native styling, navigation, and Reanimated animations for cross-platform mobile development. Use when building React Native apps, implementing navigation patterns, or creating performant animations.
python-design-patterns
Python design patterns including KISS, Separation of Concerns, Single Responsibility, and composition over inheritance. Use when making architecture decisions, refactoring code structure, or evaluating when abstractions are appropriate.
postgresql-table-design
Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
mobile-ios-design
Master iOS Human Interface Guidelines and SwiftUI patterns for building native iOS apps. Use when designing iOS interfaces, implementing SwiftUI views, or ensuring apps follow Apple's design principles.
mobile-android-design
Master Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.
interaction-design
Design and implement microinteractions, motion design, transitions, and user feedback patterns. Use when adding polish to UI interactions, implementing loading states, or creating delightful user experiences.
design-system-patterns
Build scalable design systems with design tokens, theming infrastructure, and component architecture patterns. Use when creating design tokens, implementing theme switching, building component libraries, or establishing design system foundations.
responsive-design
Create responsive web designs that work across all devices and screen sizes. Use when building mobile-first layouts, implementing breakpoints, or optimizing for different viewports. Handles CSS Grid, Flexbox, media queries, viewport units, and responsive images.