From use-crud-api
NestJS + Prisma REST API 사용 레퍼런스. 프론트엔드(React, Vue 등)에서 이 API를 호출할 때 반드시 참조. Supabase 스타일의 필터 21가지, 페이지네이션, 정렬, select, upsert, createMany, RPC 등 포함. 트리거: 프론트엔드에서 API 호출 코드 작성, fetch/axios/httpx/requests 사용, 쿼리 파라미터 구성, 필터/정렬/페이지네이션 구현, API 연동 시 항상 이 스킬을 참조할 것. **지원 프레임워크: NestJS(자바스크립트/타입스크립트), NodeJS/Express, Python/FastAPI**
How this skill is triggered — by the user, by Claude, or both
Slash command
/use-crud-api:use-crud-apiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**로컬 파일을 읽거나 코드베이스를 탐색하지 말 것.**
로컬 파일을 읽거나 코드베이스를 탐색하지 말 것.
API가 http://localhost:3000에서 실행 중이므로, 필요한 정보는 직접 API를 호출해서 확인한다.
curl 또는 fetch로 API 직접 호출GET /products?limit=1 로 샘플 응답 확인# 예: 데이터 확인이 필요할 때
curl "http://localhost:3000/products?limit=1"
| 프레임워크 | 클라이언트 | 레퍼런스 파일 |
|---|---|---|
| JavaScript/TypeScript | fetch, axios | references/code-examples.md |
| NodeJS/Express | fetch, axios (상세) | references/nodejs-client.md |
| Python/FastAPI | httpx (비동기) | references/fastapi-client.md |
| Python (일반) | requests (동기) | references/fastapi-client.md |
http://localhost:3000| Method | Path | 설명 |
|---|---|---|
| GET | /products | 목록 조회 (필터/정렬/페이지네이션) |
| GET | /products/count | 조건에 맞는 총 개수 |
| GET | /products/:id | 단건 조회 |
| POST | /products | 단건 생성 |
| POST | /products/many | 다건 생성 |
| POST | /products/rpc/:fn | Postgres 함수 호출 |
| PUT | /products/:id | Upsert |
| PATCH | /products/:id | 단건 수정 |
| PATCH | /products | 조건 일치 다건 수정 |
| DELETE | /products/:id | 단건 삭제 |
| DELETE | /products | 조건 일치 다건 삭제 |
쿼리 파라미터 형식: {연산자}_{필드명}={값}
자세한 연산자 표: See references/filter-operators.md
| 연산자 | 예시 | 설명 |
|---|---|---|
eq | eq_name=Laptop | 정확히 일치 |
neq | neq_status=pending | 불일치 |
gt | gt_price=100 | 초과 |
gte | gte_price=100 | 이상 |
lt | lt_price=500 | 미만 |
lte | lte_price=500 | 이하 |
like | like_name=Lap | 포함 (대소문자 구분) |
ilike | ilike_name=lap | 포함 (대소문자 무시) |
textSearch | textSearch_name=laptop | 대소문자 무시 검색 |
in | in_name=Fan1,Fan2 | 목록 중 하나 |
is | is_active=true | true/false/null 체크 |
or | or=price.lt.100,stock.eq.0 | OR 복합 조건 |
and | and=price.gte.100,stock.gte.50 | AND 복합 조건 |
filter | filter={"status":{"eq":"active"}} | Raw Prisma where |
자세한 내용: See references/pagination-sorting.md
GET /products?page=2&perPage=10
GET /products?sortBy=price,createdAt&order=asc,desc
응답 형식:
{
"data": [...],
"count": 100,
"page": 2,
"perPage": 10
}
POST /products
Content-Type: application/json
{ "name": "Laptop Pro", "price": 1299.99, "stock": 30 }
POST /products/many
[ { "name": "Mouse", "price": 29.99 }, { "name": "Keyboard", "price": 79.99 } ]
PATCH /products/1
{ "price": 999.99 }
PUT /products/1
{ "name": "Laptop", "price": 899.99 }
DELETE /products/1
각 프레임워크별 상세 예제:
references/code-examples.mdreferences/nodejs-client.mdreferences/fastapi-client.mdreferences/fastapi-client.md// 목록 조회
const { data, count } = await fetch(
`${BASE_URL}/products?ilike_name=laptop>e_price=100&page=1&perPage=10&sortBy=price&order=asc`
).then(r => r.json());
// 생성
const created = await fetch(`${BASE_URL}/products`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'New Product', price: 99.99 }),
}).then(r => r.json());
// 수정
await fetch(`${BASE_URL}/products/1`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ price: 89.99 }),
});
// 삭제
await fetch(`${BASE_URL}/products/1`, { method: 'DELETE' });
async with CrudApiClient() as client:
result = await client.list(page=1, per_page=10, ilike_name="laptop", gte_price=100)
print(result["data"], result["count"])
await client.create({"name": "New Product", "price": 99.99, "stock": 10})
await client.update(1, {"price": 89.99})
await client.delete(1)
.env에서 MODE=dev로 설정되어 있을 때만 사용 가능.
POST /sql
{ "sql": "SELECT * FROM Product LIMIT 5" }
자세한 내용: See references/sql-endpoint.md
| 코드 | 상황 |
|---|---|
| 200 | 성공 |
| 201 | 생성 성공 |
| 400 | 잘못된 요청 |
| 404 | 리소스 없음 |
| 409 | 중복 (unique 제약) |
| 500 | 서버 오류 |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub auraworks/my-marketplace --plugin use-crud-api