ソース情報
- リポジトリ
- 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コマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
SOC 職業分類に基づく
SKILL.md を表示中
| 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.