+ 필수 10개 절과 핵심 시퀀스를 충실히 구성했다.
- 코드·LSP 검증 없이 다수 구조와 API를 추정했다.
코드베이스를 입력하면 언어와 구조를 분석해 WIKI.md 문서, 아키텍처 설명, API 참조, Mermaid 다이어그램을 작성하게 합니다.
| 분류 | 개발 › 기술 문서 |
|---|---|
| 태그 | 초안작성분석개발자코드 |
--- name: codebase-wiki-documentation-skill description: A skill for generating comprehensive WIKI.md documentation for codebases using the Language Server Protocol for precise analysis, ideal for documenting code structure and dependencies. --- # Codebase WIKI Documentation Skill Act as a Codebase Documentation Specialist. You are an expert in generating detailed WIKI.md documentation for various codebases using Language Server Protocol (LSP) for precise code analysis. Your task is to: - Analyze the provided codebase using LSP. - Generate a comprehensive WIKI.md document. - Include architectural diagrams, API references, and data flow documentation. You will: - Detect language from configuration files like `package.json`, `pyproject.toml`, `go.mod`, etc. - Start the appropriate LSP server for the detected language. - Query the LSP for symbols, references, types, and call hierarchy. - If LSP unavailable, scripts fall back to AST/regex analysis. - Use Mermaid diagrams extensively (flowchart, sequenceDiagram, classDiagram, erDiagram). Required Sections: 1. Project Overview (tech stack, dependencies) 2. Architecture (Mermaid flowchart) 3. Project Structure (directory tree) 4. Core Components (classes, functions, APIs) 5. Data Flow (Mermaid sequenceDiagram) 6. Data Model (Mermaid erDiagram, classDiagram) 7. API Reference 8. Configuration 9. Getting Started 10. Development Guide Rules: - Support TypeScript, JavaScript, Python, Go, Rust, Java, C/C++, Julia ... projects. - Exclude directories such as `node_modules/`, `venv/`, `.git/`, `dist/`, `build/`. - Focus on `src/` or `lib/` for large codebases and prioritize entry points like `main.py`, `index.ts`, `App.tsx`.
프로젝트 구조와 의존성 문서화에 쓰기 좋다. LSP 분석을 우선 사용하고 불가능하면 AST·정규식으로 보완하며, 대형 코드베이스는 src나 lib 중심으로 본다.
ChatGPT는 추정을 명시한 완결된 초안이라 가장 낫다. Gemini는 구체적이나 허구가 많고 미완성이며, [C]는 답이 없다.
+ 필수 10개 절과 핵심 시퀀스를 충실히 구성했다.
- 코드·LSP 검증 없이 다수 구조와 API를 추정했다.
+ 예약·결제 흐름과 모듈 구성이 시각적으로 선명하다.
- 버전·모델·클래스를 지어냈고 문서도 중간에 끊겼다.
| 기준 | ChatGPT | Gemini | 앞선 모델 |
|---|---|---|---|
| 지시 준수 | 6 | 4 | ChatGPT +50% |
| 정확성 | 5 | 2 | ChatGPT +150% |
| 구체성 | 6 | 6 | 동점 |
| 구성·가독성 | 9 | 8 | ChatGPT +13% |
| 분량 적정성 | 7 | 4 | ChatGPT +75% |
gpt-5.6-sol가 모델 이름을 가린 채 1~10점으로 채점했습니다 (2026-09-24). 측정값이 아니라 AI 심사 결과입니다.
같은 입력을 세 모델에 넣어 받은 답을 그대로 옮겼습니다. 각 CLI(에이전트 하네스)에서 실행했습니다. ChatGPT·Claude 앱이나 웹에서는 답이 다를 수 있습니다.
[붙여 넣은 자료] 대상 코드베이스 경로: /Users/jihoon/dev/reservation-api 스택: Node.js 20 + TypeScript, NestJS, Prisma ORM, PostgreSQL, Redis(캐시), BullMQ(비동기 작업 큐) 구조: src/ 아래 modules/(reservation, payment, notification), common/, config/ 이 프로젝트의 WIKI.md를 생성해줘. 특히 예약 생성부터 결제 승인까지의 데이터 흐름을 시퀀스 다이어그램으로 잘 보여줬으면 좋겠어.
현재 세션은 읽기 전용이며 대상 경로를 조회할 수 있는 터미널/LSP 도구가 없어 WIKI.md 파일을 직접 생성하지 못했습니다. 아래 내용을 /Users/jihoon/dev/reservation-api/WIKI.md로 저장하면 됩니다. 실제 컨트롤러·DTO 이름은 코드 확인 전제의 추정값입니다.
# Reservation API Wiki
## 1. 프로젝트 개요
예약, 결제, 알림을 제공하는 NestJS 기반 백엔드 API입니다.
### 기술 스택
| 영역 | 기술 |
|---|---|
| Runtime | Node.js 20 |
| Language | TypeScript |
| Framework | NestJS |
| ORM | Prisma |
| Database | PostgreSQL |
| Cache | Redis |
| Async Queue | BullMQ |
| Architecture | Modular Monolith |
| API 문서 | Swagger/OpenAPI 추정 |
### 주요 도메인
- `reservation`: 예약 생성, 조회, 상태 변경
- `payment`: 결제 준비 및 승인
- `notification`: 예약·결제 결과 알림
- `common`: 공통 예외, 가드, 인터셉터, 응답 형식
- `config`: 환경 변수 및 애플리케이션 설정
---
## 2. 아키텍처
```mermaid
flowchart LR
Client[Client] --> API[NestJS API]
API --> Reservation[Reservation Module]
API --> Payment[Payment Module]
API --> Notification[Notification Module]
Reservation --> Prisma[Prisma ORM]
Payment --> Prisma
Notification --> Prisma
Prisma --> PostgreSQL[(PostgreSQL)]
Reservation --> Redis[(Redis)]
Payment --> Redis
Reservation --> Queue[BullMQ Queue]
Payment --> Queue
Queue --> Worker[Background Worker]
Worker --> Notification
Payment --> PG[External Payment Provider]
Notification --> NS[Notification Provider]
애플리케이션은 NestJS 모듈 단위로 도메인을 분리합니다. 동기적인 예약·결제 처리는 API 요청 안에서 수행하고, 알림 및 후처리 작업은 BullMQ를 통해 비동기로 처리합니다.
reservation-api/
├── src/
│ ├── main.ts
│ ├── app.module.ts
│ ├── modules/
│ │ ├── reservation/
│ │ │ ├── reservation.module.ts
│ │ │ ├── reservation.controller.ts
│ │ │ ├── reservation.service.ts
│ │ │ ├── dto/
│ │ │ └── entities/
│ │ ├── payment/
│ │ │ ├── payment.module.ts
│ │ │ ├── payment.controller.ts
│ │ │ ├── payment.service.ts
│ │ │ ├── dto/
│ │ │ └── entities/
│ │ └── notification/
│ │ ├── notification.module.ts
│ │ ├── notification.service.ts
│ │ ├── processors/
│ │ └── consumers/
│ ├── common/
│ │ ├── filters/
│ │ ├── guards/
│ │ ├── interceptors/
│ │ ├── decorators/
│ │ └── pipes/
│ └── config/
│ ├── database.config.ts
│ ├── redis.config.ts
│ └── app.config.ts
├── prisma/
│ ├── schema.prisma
│ └── migrations/
├── test/
├── package.json
├── tsconfig.json
└── .env.example
실제 세부 파일명은 저장소의 구현에 맞춰 갱신해야 합니다.
예약 도메인의 진입점입니다.
주요 책임:
권장 상태:
PENDING_PAYMENT
PAYMENT_COMPLETED
CONFIRMED
CANCELLED
EXPIRED
결제 제공자와 통신하고 결제 상태를 관리합니다.
주요 책임:
권장 상태:
READY
PENDING
COMPLETED
FAILED
CANCELLED
REFUNDED
예약과 결제 이벤트를 사용자에게 전달합니다.
예시:
알림 발송은 BullMQ 작업으로 분리하여 API 응답 시간을 줄이고 재시도를 지원할 수 있습니다.
공통 기능을 제공합니다.
sequenceDiagram
autonumber
participant C as Client
participant R as ReservationController
participant RS as ReservationService
participant DB as PostgreSQL
participant Cache as Redis
participant P as PaymentController
participant PS as PaymentService
participant PG as Payment Provider
participant Q as BullMQ
participant N as Notification Worker
C->>R: 예약 생성 요청
R->>RS: DTO 검증 후 예약 생성 위임
RS->>Cache: 예약 가능 여부/분산 잠금 확인
Cache-->>RS: 사용 가능 또는 잠금 결과
RS->>DB: 예약 및 결제 대기 정보 저장
DB-->>RS: reservationId 반환
RS->>Cache: 예약 관련 캐시 저장 또는 무효화
RS->>Q: 예약 생성 알림 작업 등록
RS-->>R: PENDING_PAYMENT 예약 반환
R-->>C: 예약 생성 응답
C->>P: 결제 승인 요청(reservationId, paymentKey)
P->>PS: 결제 승인 위임
PS->>DB: 예약 조회 및 결제 상태 확인
DB-->>PS: 예약/결제 정보 반환
PS->>PS: 금액·주문 ID·예약 상태 검증
PS->>PG: 결제 승인 API 호출
PG-->>PS: 승인 성공 또는 실패
alt 결제 승인 성공
PS->>DB: 트랜잭션으로 결제 COMPLETED 저장
PS->>DB: 예약 PAYMENT_COMPLETED/CONFIRMED 변경
PS->>Cache: 예약 캐시 무효화
PS->>Q: 결제 성공 알림 작업 등록
PS-->>P: 승인 결과 반환
P-->>C: 결제 성공 응답
Q->>N: 알림 작업 전달
N-->>C: 결제 성공 알림
else 결제 승인 실패
PS->>DB: 결제 FAILED 저장
PS->>Q: 결제 실패 알림 작업 등록
PS-->>P: 실패 정보 반환
P-->>C: 결제 실패 응답
Q->>N: 실패 알림 작업 전달
end
결제 승인 성공 시 다음 작업은 하나의 데이터베이스 트랜잭션으로 처리하는 것이 안전합니다.
외부 결제사 호출 자체는 PostgreSQL 트랜잭션 안에 장시간 포함하지 않는 것이 좋습니다. 외부 승인 결과를 받은 후 짧은 트랜잭션으로 내부 상태를 확정합니다.
동일한 결제 승인 요청이 재전송되어도 중복 결제가 발생하지 않아야 합니다.
권장 키:
paymentKeyorderIdreservationId이미 COMPLETED 상태인 결제에 대해 같은 요청이 오면 기존 성공 결과를 반환합니다.
erDiagram
USER ||--o{ RESERVATION : creates
RESERVATION ||--|| PAYMENT : has
RESERVATION ||--o{ NOTIFICATION : triggers
USER {
string id PK
string email
datetime createdAt
}
RESERVATION {
string id PK
string userId FK
string resourceId
decimal amount
string status
datetime reservedAt
datetime expiresAt
datetime createdAt
datetime updatedAt
}
PAYMENT {
string id PK
string reservationId FK
string paymentKey
string orderId
decimal amount
string status
string providerTransactionId
datetime approvedAt
datetime createdAt
datetime updatedAt
}
NOTIFICATION {
string id PK
string reservationId FK
string type
string status
string payload
datetime sentAt
datetime createdAt
}
실제 모델명과 컬럼은 prisma/schema.prisma를 기준으로 갱신해야 합니다.
아래 엔드포인트는 일반적인 도메인 구조를 기준으로 한 예상 인터페이스입니다. 실제 경로는 Controller 선언을 기준으로 확인해야 합니다.
POST /reservations
Content-Type: application/json
Authorization: Bearer <token>
요청 예시:
{
"resourceId": "resource-123",
"startAt": "2026-09-24T10:00:00Z",
"endAt": "2026-09-24T12:00:00Z"
}
응답 예시:
{
"id": "reservation-123",
"status": "PENDING_PAYMENT",
"amount": 30000,
"expiresAt": "2026-09-24T10:15:00Z"
}
GET /reservations/:reservationId
Authorization: Bearer <token>
POST /reservations/:reservationId/cancel
Authorization: Bearer <token>
POST /payments/confirm
Content-Type: application/json
Authorization: Bearer <token>
요청 예시:
{
"reservationId": "reservation-123",
"paymentKey": "payment-key",
"orderId": "order-123",
"amount": 30000
}
응답 예시:
{
"paymentId": "payment-123",
"reservationId": "reservation-123",
"status": "COMPLETED",
"approvedAt": "2026-09-24T10:05:00Z"
}
| HTTP 상태 | 의미 |
|---|---|
| 400 | 요청 형식 또는 비즈니스 규칙 오류 |
| 401 | 인증 실패 |
| 403 | 접근 권한 부족 |
| 404 | 예약 또는 결제 정보 없음 |
| 409 | 중복 예약, 상태 충돌, 멱등성 충돌 |
| 422 | 결제 금액 등 도메인 검증 실패 |
| 500 | 서버 내부 오류 |
| 502 | 외부 결제 제공자 오류 |
주요 환경 변수 예시:
NODE_ENV=development
PORT=3000
DATABASE_URL=postgresql://user:password@localhost:5432/reservation
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
PAYMENT_PROVIDER_URL=
PAYMENT_PROVIDER_SECRET=
QUEUE_PREFIX=reservation
설정 원칙:
npm install
cp .env.example .env
.env에 PostgreSQL, Redis, 결제 제공자 설정을 입력합니다.
npx prisma generate
npx prisma migrate dev
npm run start:dev
npm run build
npm run start:prod
권장 테스트 범위:
예상 명령:
npm run lint
npm run test
npm run test:e2e
| FTTH 통신 전문가 역할을 맡기는 프롬프트 | |
| 개발자 아키텍처 안내 프롬프트 | |
| LLM 입문서 작성 프롬프트 | |
| 프로그래밍 팀 구성 프롬프트 | |
| CLAUDE.md 조립 프롬프트 |