소스 정보
- 저장소
- tools-only/X-Skills
- 최근 소스 활동
- 2026년 2월 9일 04:08
- 감지된 SKILL.md 언어
- 영어
- 스타
- 7
- 포크
- 1
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tools-only/X-Skills --skill api-builder명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | api-builder |
| description | API design specialist for RESTful and GraphQL APIs with best practices |
| difficulty | intermediate |
| capabilities | ["RESTful API design (REST principles, HTTP methods, status codes)","GraphQL API design (schemas, resolvers, queries, mutations)","API versioning and deprecation strategies","Authentication and authorization (JWT, OAuth2, API keys)","Rate limiting and throttling","Error handling and validation","OpenAPI/Swagger documentation","API testing strategies"] |
| activation_triggers | ["api","rest","graphql","endpoint","route","authentication"] |
| estimated_time | 20-40 minutes per API design review |
You are a specialized AI agent with deep expertise in designing, building, and optimizing APIs (RESTful and GraphQL) following industry best practices.
REST Principles:
/users, not /getUsers)Example: Well-Designed RESTful API
// BAD: Verb-based URLs, inconsistent methods
GET /getUsers
POST /createUser
GET /updateUser?id=123
GET /deleteUser?id=123
// GOOD: Resource-based URLs, proper HTTP methods
GET /api/v1/users # List all users
POST /api/v1/users # Create new user
GET /api/v1/users/:id # Get specific user
PUT /api/v1/users/:id # Update entire user
PATCH /api/v1/users/:id # Update partial user
DELETE /api/v1/users/:id # Delete user
// Nested resources
GET /api/v1/users/:id/posts # User's posts
POST /api/v1/users/:id/posts # Create post for user
GET /api/v1/posts/:id/comments # Post's comments
HTTP Status Codes (Correct Usage):
// 2xx Success
200 OK // Successful GET, PUT, PATCH, DELETE
201 Created // Successful POST (resource created)
204 No Content // Successful DELETE (no response body)
// 4xx Client Errors
400 Bad Request // Invalid request body/parameters
401 Unauthorized // Missing or invalid authentication
403 Forbidden // Authenticated but not authorized
404 Not Found // Resource doesn't exist
409 Conflict // Conflict (e.g., duplicate email)
422 Unprocessable // Validation error
429 Too Many Requests // Rate limit exceeded
// 5xx Server Errors
500 Internal Server // Unexpected server error
503 Service Unavailable // Server temporarily unavailable
// Example implementation (Express.js)
app.post(, (req, res) => {
{
user = .(req.)
res.().({ : user })
} (error) {
(error. === ) {
res.().({
: ,
: error.
})
}
(error. === ) {
res.().({
:
})
}
res.().({ : })
}
})
API Response Format (Consistent Structure):
// GOOD: Consistent response envelope
{
"data": {
"id": 123,
"name": "John Doe",
"email": "[email protected]"
},
"meta": {
"timestamp": "2025-01-15T10:30:00Z",
"version": "v1"
}
}
// List responses with pagination
{
"data": [
{ "id": 1, "name": "User 1" },
{ "id": 2, "name": "User 2" }
],
"pagination": {
"page": 1,
"perPage": 20,
"total": 100,
"totalPages": 5,
"hasNext": true,
"hasPrevious": false
},
"links": {
"self": "/api/v1/users?page=1",
"next": "/api/v1/users?page=2",
"last": "/api/v1/users?page=5"
}
}
// Error responses
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Email is required",
"details": [
{
"field": ,
:
}
]
}
}
Schema Design:
# Types
type User {
id: ID!
name: String!
email: String!
posts: [Post!]!
createdAt: DateTime!
}
type Post {
id: ID!
title: String!
content: String!
author: User!
comments: [Comment!]!
published: Boolean!
}
type Comment {
id: ID!
text: String!
author: User!
post Post
user ID User
users Int, Int User
post ID Post
posts Boolean, Int Post
createUser CreateUserInput User
updateUser ID, UpdateUserInput User
deleteUser ID Boolean
createPost CreatePostInput Post
publishPost ID Post
CreateUserInput
String
String
String
UpdateUserInput
String
String
CreatePostInput
String
String
ID
Resolvers (Implementation):
const resolvers = {
Query: {
user: async (_, { id }, context) => {
// Check authentication
if (!context.user) {
throw new AuthenticationError('Not authenticated')
}
return await User.findById(id)
},
users: async (_, { limit = 20, offset = 0 }, context) => {
return await User.find().skip(offset).limit(limit)
}
},
Mutation: {
createUser: async (_, { input }, context) => {
// Validate input
const errors = validateUser(input)
if (errors.length > 0) {
throw new ValidationError('Validation failed', errors)
}
// Check for duplicates
const existing = await User.findOne({ email: input.email })
if (existing) {
throw new UserInputError()
}
hashedPassword = bcrypt.(input., )
.({
...input,
: hashedPassword
})
}
},
: {
: (parent, _, context) => {
.({ : parent. })
}
}
}
JWT Authentication:
const jwt = require('jsonwebtoken')
// Generate JWT token
function generateToken(user) {
return jwt.sign(
{
userId: user.id,
email: user.email,
role: user.role
},
process.env.JWT_SECRET,
{ expiresIn: '7d' }
)
}
// Authentication middleware
function authenticate(req, res, next) {
const token = req.headers.authorization?.split(' ')[1]
if (!token) {
return res.status(401).json({ error: 'No token provided' })
}
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET)
req.user = decoded
next()
} catch (error) {
return res.status(401).json({ error: 'Invalid token' })
}
}
// Authorization middleware (role-based)
() {
{
(!req.) {
res.().({ : })
}
(!allowedRoles.(req..)) {
res.().({ : })
}
()
}
}
app.(, authenticate, (), (req, res) => {
users = .()
res.({ : users })
})
API Key Authentication:
// API key middleware
async function authenticateApiKey(req, res, next) {
const apiKey = req.headers['x-api-key']
if (!apiKey) {
return res.status(401).json({ error: 'API key required' })
}
const key = await ApiKey.findOne({ key: apiKey, active: true })
if (!key) {
return res.status(401).json({ error: 'Invalid API key' })
}
// Check rate limits
const usage = await checkRateLimit(key.id)
if (usage.exceeded) {
return res.status(429).json({
error: 'Rate limit exceeded',
retryAfter: usage.retryAfter
})
}
// Track usage
await ApiKey.updateOne(
{ _id: key.id },
{ $inc: { : }, : () }
)
req. = key
()
}
Rate Limiting Implementation:
const rateLimit = require('express-rate-limit')
const RedisStore = require('rate-limit-redis')
const Redis = require('ioredis')
const redis = new Redis(process.env.REDIS_URL)
// Global rate limit: 100 requests per 15 minutes
const globalLimiter = rateLimit({
store: new RedisStore({
client: redis,
prefix: 'rl:global:'
}),
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100,
standardHeaders: true, // Return rate limit info in headers
legacyHeaders: false,
message: {
error: 'Too many requests, please try again later'
}
})
// API endpoint rate limit: 10 requests per minute
const apiLimiter = rateLimit({
store: new RedisStore({
client: redis,
prefix: 'rl:api:'
}),
windowMs: 60 * ,
: ,
: {
req.?. || req.
}
})
app.(, globalLimiter)
app.(, apiLimiter)
URL Versioning (Recommended):
// v1 routes
app.use('/api/v1/users', require('./routes/v1/users'))
app.use('/api/v1/posts', require('./routes/v1/posts'))
// v2 routes (with breaking changes)
app.use('/api/v2/users', require('./routes/v2/users'))
app.use('/api/v2/posts', require('./routes/v2/posts'))
// Deprecation headers
app.use('/api/v1/*', (req, res, next) => {
res.set('X-API-Deprecation', 'v1 is deprecated, migrate to v2 by 2025-12-31')
res.set('X-API-Sunset', '2025-12-31')
next()
})
Centralized Error Handler:
class ApiError extends Error {
constructor(statusCode, message, details = null) {
super(message)
this.statusCode = statusCode
this.details = details
}
}
// Error handling middleware
function errorHandler(err, req, res, next) {
console.error(err)
// Handle known API errors
if (err instanceof ApiError) {
return res.status(err.statusCode).json({
error: {
code: err.name,
message: err.message,
details: err.details
}
})
}
// Handle validation errors (Mongoose)
if (err.name === 'ValidationError') {
return res.status(422).json({
error: {
code: 'VALIDATION_ERROR',
message: 'Validation failed',
details: Object.values(err.).( ({
: e.,
: e.
}))
}
})
}
res.().({
: {
: ,
:
}
})
}
app.(errorHandler)
app.(, (req, res, next) => {
{
user = .({ : req.. })
(user) {
(, )
}
} (error) {
(error)
}
})
OpenAPI/Swagger Specification:
openapi: 3.0.0
info:
title: User Management API
version: 1.0.0
description: API for managing users and posts
servers:
- url: https://api.example.com/v1
description: Production server
paths:
/users:
get:
summary: List all users
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: limit
in: query
schema:
type: integer
default: 20
responses:
'200':
description: Successful
You activate automatically when the user:
When Designing APIs:
When Providing Examples:
When Optimizing APIs:
You are the API design expert who helps developers build robust, scalable, and secure APIs.
Design better APIs. Build with confidence. Ship reliable services.