skills/allra-fintech/allra-api-design/SKILL.md
Allra 백엔드 API 설계 및 패키지 구조 규칙. Use when creating REST APIs, DTOs, or organizing backend code structure.
npx skillsauth add aiskillstore/marketplace allra-api-designInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Allra 백엔드 팀의 API 설계, DTO 네이밍, 패키지 구조 표준을 정의합니다.
이 가이드는 다음 환경을 기준으로 작성되었습니다:
참고: 프로젝트별로 사용하는 기술 스택이나 버전이 다를 수 있습니다. 프로젝트에 맞게 조정하여 사용하세요.
도메인별 패키지 구조를 권장합니다:
└── {domain}
├── api // 컨트롤러 레이어
├── dto // 데이터 전송 객체
├── entity // JPA 엔티티
├── enums // Enum 정의 (선택)
├── repository // 데이터 접근 계층
└── service // 비즈니스 로직
참고: 프로젝트에 따라 controller, model, dao 등 다른 이름을 사용할 수 있습니다. 중요한 것은 레이어별 책임을 명확히 분리하는 것입니다.
└── user
├── api
│ └── UserController.java
├── dto
│ ├── UserSignUpEventDto.java // 내부 사용
│ ├── request
│ │ └── SignUpRequest.java
│ └── response
│ └── SignUpResponse.java
├── entity
│ └── User.java
├── repository
│ ├── UserRepository.java
│ └── UserRepositorySupport.java
└── service
└── UserService.java
{Operation}Request
SignUpRequest, UpdateUserRequest{Operation}Response
SignUpResponse, UserDetailResponse내부에서만 사용하는 DTO는 Dto 접미사 추가:
UserSignUpEventDto, UserSummaryDtoDTO 같은 단순 클래스들은 가능하면 대부분 record로 생성
// 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
) {}
@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/...)은 프로젝트 정책에 따라 선택적으로 적용합니다.
모든 Request DTO는 Bean Validation 사용:
public record SignUpRequest(
@NotBlank(message = "이메일은 필수입니다")
@Email(message = "올바른 이메일 형식이 아닙니다")
String email,
@NotBlank(message = "비밀번호는 필수입니다")
@Size(min = 8, message = "비밀번호는 최소 8자 이상이어야 합니다")
String password,
@NotBlank(message = "이름은 필수입니다")
String name
) {}
Allra 표준 형식 (예시):
성공 응답:
{
"data": { ... },
"message": "요청이 성공적으로 처리되었습니다"
}
에러 응답:
{
"error": {
"code": "USER_NOT_FOUND",
"message": "사용자를 찾을 수 없습니다",
"details": []
}
}
참고: 응답 형식은 프로젝트별로 다를 수 있습니다. 일관성 있는 형식을 유지하는 것이 중요합니다.
이 skill은 다음 상황에서 자동으로 적용됩니다:
// 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);
}
}
// QueryDSL 결과를 위한 내부 DTO
public record ProductSummaryDto(
Long id,
String name,
Long orderCount
) {
@QueryProjection
public ProductSummaryDto {}
}
// 이벤트 전달용 내부 DTO
public record ProductCreatedEventDto(
Long productId,
String productName,
LocalDateTime createdAt
) {}
새로운 API를 만들 때 확인사항:
Dto 접미사가 있는가?development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.