skills/pagination/SKILL.md
페이지네이션 패턴 설계 가이드를 실행합니다.
npx skillsauth add excatt/superclaude-plusplus paginationInstall 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.
페이지네이션 패턴 설계 가이드를 실행합니다.
GET /users?page=2&limit=20
→ OFFSET (page-1)*limit LIMIT limit
장점: 구현 단순, 특정 페이지 이동 가능
단점: 대용량에서 느림, 데이터 변경 시 중복/누락
GET /users?cursor=abc123&limit=20
→ WHERE id > cursor LIMIT limit
장점: 대용량에서 빠름, 일관된 결과
단점: 특정 페이지 이동 불가
GET /users?after_id=100&after_date=2024-01-15&limit=20
→ WHERE (created_at, id) > (after_date, after_id)
장점: 정렬된 대용량 데이터에 효율적
단점: 복잡한 정렬 시 어려움
async function getUsers(page = 1, limit = 20) {
const offset = (page - 1) * limit;
const [users, [{ total }]] = await Promise.all([
db.query(`
SELECT * FROM users
ORDER BY created_at DESC
LIMIT $1 OFFSET $2
`, [limit, offset]),
db.query('SELECT COUNT(*) as total FROM users'),
]);
return {
data: users,
pagination: {
page,
limit,
total,
totalPages: Math.ceil(total / limit),
hasNext: page < Math.ceil(total / limit),
hasPrev: page > 1,
},
};
}
async function getUsers(cursor, limit = 20) {
const query = cursor
? `SELECT * FROM users WHERE id > $1 ORDER BY id LIMIT $2`
: `SELECT * FROM users ORDER BY id LIMIT $1`;
const params = cursor ? [cursor, limit + 1] : [limit + 1];
const users = await db.query(query, params);
const hasNext = users.length > limit;
if (hasNext) users.pop();
return {
data: users,
pagination: {
nextCursor: hasNext ? users[users.length - 1].id : null,
hasNext,
},
};
}
async function getUsersConnection(first, after) {
const cursor = after ? decodeCursor(after) : null;
const query = cursor
? `SELECT * FROM users WHERE id > $1 ORDER BY id LIMIT $2`
: `SELECT * FROM users ORDER BY id LIMIT $1`;
const users = await db.query(query, cursor ? [cursor, first + 1] : [first + 1]);
const hasNextPage = users.length > first;
if (hasNextPage) users.pop();
const edges = users.map(user => ({
node: user,
cursor: encodeCursor(user.id),
}));
return {
edges,
pageInfo: {
hasNextPage,
hasPreviousPage: !!cursor,
startCursor: edges[0]?.cursor,
endCursor: edges[edges.length - 1]?.cursor,
},
totalCount: await getTotalCount(),
};
}
function encodeCursor(id) {
return Buffer.from(`cursor:${id}`).toString('base64');
}
function decodeCursor(cursor) {
return Buffer.from(cursor, 'base64').toString().replace('cursor:', '');
}
{
"data": [...],
"pagination": {
"page": 2,
"limit": 20,
"total": 150,
"totalPages": 8,
"hasNext": true,
"hasPrev": true
}
}
{
"data": [...],
"pagination": {
"nextCursor": "eyJpZCI6MTAwfQ==",
"prevCursor": "eyJpZCI6ODB9",
"hasNext": true,
"hasPrev": true
}
}
Link: <https://api.example.com/users?page=3>; rel="next",
<https://api.example.com/users?page=1>; rel="prev",
<https://api.example.com/users?page=1>; rel="first",
<https://api.example.com/users?page=8>; rel="last"
-- Offset 페이지네이션
CREATE INDEX idx_users_created_at ON users(created_at DESC);
-- Cursor 페이지네이션
CREATE INDEX idx_users_id ON users(id);
-- 복합 정렬
CREATE INDEX idx_users_created_id ON users(created_at DESC, id DESC);
// 대략적인 카운트 (PostgreSQL)
async function getEstimatedCount(table) {
const result = await db.query(`
SELECT reltuples::bigint AS estimate
FROM pg_class
WHERE relname = $1
`, [table]);
return result[0].estimate;
}
// 캐시된 카운트
async function getCachedCount(key) {
let count = await cache.get(key);
if (!count) {
count = await db.query('SELECT COUNT(*) FROM users');
await cache.set(key, count, 'EX', 300); // 5분 캐시
}
return count;
}
| 상황 | 권장 방식 | |------|----------| | 작은 데이터셋 (<10K) | Offset | | 대용량 + 순차 탐색 | Cursor | | 특정 페이지 점프 필요 | Offset | | 실시간 데이터 | Cursor | | GraphQL API | Relay Connection | | 무한 스크롤 | Cursor |
## Pagination Design
### Strategy
- 방식: [Offset/Cursor/Keyset]
- 이유: [선택 이유]
### API Design
GET /resource?[params]
### Response Format
```json
{
"data": [...],
"pagination": {...}
}
// 구현 코드
---
요청에 맞는 페이지네이션을 설계하세요.
testing
사용자 계획을 기존 도메인 모델에 대해 stress-test하는 인터뷰 세션. 용어를 날카롭게 다듬고, 결정이 굳어질 때마다 CONTEXT.md(도메인 어휘 사전)와 ADR을 인라인으로 갱신한다. 새 기능 요구사항 탐색은 `/brainstorm`을, 기존 도메인 모델·용어와의 정합성 점검은 이 스킬을 사용한다.
development
# Excel (XLSX) Spreadsheet Skill Claude Code supports comprehensive spreadsheet operations through the **xlsx** skill, enabling creation, editing, and analysis of Excel files (.xlsx, .xlsm, .csv, .tsv). ## Trigger - When user needs Excel spreadsheet creation or editing - Financial modeling or data analysis required - Spreadsheet formulas and calculations needed - Data import from CSV/TSV files ## Core Capabilities **Primary functions include:** - Creating new spreadsheets with formulas and f
tools
Generate structured implementation workflows from PRDs and feature requirements
development
실시간 통신 설계 가이드를 실행합니다.