Allra api design
Skill ComeOnOliver/skillshub/skills/aiskillstore/marketplace/allra-fintech/allra-api-design
π§ The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.
npx -y skills add ComeOnOliver/skillshub --skill allra-api-designAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Allra λ°±μλ API μ€κ³ λ° ν¨ν€μ§ ꡬ쑰 κ·μΉ. Use when creating REST APIs, DTOs, or organizing backend code structure.
SKILL.md
6.6 KB, as published. Nobody here has run it
Allra Backend API μ€κ³ λ° ν¨ν€μ§ ꡬ쑰
Allra λ°±μλ νμ API μ€κ³, DTO λ€μ΄λ°, ν¨ν€μ§ ꡬ쑰 νμ€μ μ μν©λλ€.
νλ‘μ νΈ κΈ°λ³Έ μ 보
μ΄ κ°μ΄λλ λ€μ νκ²½μ κΈ°μ€μΌλ‘ μμ±λμμ΅λλ€:
- Java: 17 μ΄μ
- Spring Boot: 3.2 μ΄μ
- μ£Όμ κΈ°μ : JPA/Hibernate, QueryDSL, JWT
μ°Έκ³ : νλ‘μ νΈλ³λ‘ μ¬μ©νλ κΈ°μ μ€νμ΄λ λ²μ μ΄ λ€λ₯Ό μ μμ΅λλ€. νλ‘μ νΈμ λ§κ² μ‘°μ νμ¬ μ¬μ©νμΈμ.
ν¨ν€μ§ ꡬ쑰 κ·μΉ
λλ©μΈλ³ ν¨ν€μ§ ꡬ쑰λ₯Ό κΆμ₯ν©λλ€:
βββ {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
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λ‘ μμ±
// 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 λͺ λͺ κ·μΉ
@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 μ¬μ©:
public record SignUpRequest(
@NotBlank(message = "μ΄λ©μΌμ νμμ
λλ€")
@Email(message = "μ¬λ°λ₯Έ μ΄λ©μΌ νμμ΄ μλλλ€")
String email,
@NotBlank(message = "λΉλ°λ²νΈλ νμμ
λλ€")
@Size(min = 8, message = "λΉλ°λ²νΈλ μ΅μ 8μ μ΄μμ΄μ΄μΌ ν©λλ€")
String password,
@NotBlank(message = "μ΄λ¦μ νμμ
λλ€")
String name
) {}
3. μλ΅ νμ
Allra νμ€ νμ (μμ):
μ±κ³΅ μλ΅:
{
"data": { ... },
"message": "μμ²μ΄ μ±κ³΅μ μΌλ‘ μ²λ¦¬λμμ΅λλ€"
}
μλ¬ μλ΅:
{
"error": {
"code": "USER_NOT_FOUND",
"message": "μ¬μ©μλ₯Ό μ°Ύμ μ μμ΅λλ€",
"details": []
}
}
μ°Έκ³ : μλ΅ νμμ νλ‘μ νΈλ³λ‘ λ€λ₯Ό μ μμ΅λλ€. μΌκ΄μ± μλ νμμ μ μ§νλ κ²μ΄ μ€μν©λλ€.
When to Use This Skill
μ΄ skillμ λ€μ μν©μμ μλμΌλ‘ μ μ©λ©λλ€:
- μλ‘μ΄ API μλν¬μΈνΈ μμ±
- DTO ν΄λμ€ μμ±
- 컨νΈλ‘€λ¬ ꡬν
- λλ©μΈ ν¨ν€μ§ ꡬ쑰 μ€κ³
- Request/Response κ°μ²΄ λ€μ΄λ°
Examples
μμ 1: μλ‘μ΄ λλ©μΈ API μμ±
// 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 μμ±
// 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μ λ―Έμ¬κ° μλκ°?