api-spec-analyzer
БесплатноБез исполняемых скриптовНе проверенAnalyzes API documentation from OpenAPI specs to provide TypeScript interfaces, request/response formats, and implementation guidance. Use when implementing…
Об этом скилле
API Specification Analyzer
This Skill analyzes OpenAPI specifications to provide accurate API documentation, TypeScript interfaces, and implementation guidance for the caremaster-tenant-frontend project.
When to use this Skill
Claude should invoke this Skill when:
- User is implementing a new API integration
- User encounters API errors (400 Bad Request, 401 Unauthorized, 404 Not Found, etc.)
- User wants to replace mock API with real backend
- User asks about data types, required fields, or API formats
- User mentions endpoints like "/api/users" or "/api/tenants"
- Before implementing any feature that requires API calls
- When debugging type mismatches between frontend and backend
Instructions
Step 1: Fetch API Documentation
Use the MCP server tools to get the OpenAPI specification:
mcp__Tenant_Management_Portal_API__read_project_oas_f4bjy4
If user requests fresh data or if documentation seems outdated:
mcp__Tenant_Management_Portal_API__refresh_project_oas_f4bjy4
For referenced schemas (when $ref is used):
mcp__Tenant_Management_Portal_API__read_project_oas_ref_resources_f4bjy4
Step 2: Analyze the Specification
Extract the following information for each relevant endpoint:
- HTTP Method and Path: GET /api/users, POST /api/tenants, etc.
- Authentication: Bearer token, API key, etc.
- Request Parameters:
- Path parameters (e.g.,
:id) - Query parameters (e.g.,
?page=1&limit=10) - Request body schema
- Required headers
- Path parameters (e.g.,
- Response Specification:
- Success response structure (200, 201, etc.)
- Error response formats (400, 401, 404, 500)
- Status codes and their meanings
- Data Types:
- Exact types (string, number, boolean, array, object)
- Format specifications (ISO 8601, UUID, email)
- Required vs optional fields
- Enum values and constraints
- Default values
Step 3: Generate TypeScript Interfaces
Create ready-to-use TypeScript interfaces that match the API specification exactly:
/**
* User creation input
* Required fields: email, name, role
*/
export interface UserCreateInput {
/** User's email address - must be unique */
email: string
/** Full name of the user (2-100 characters) */
name: string
/** User role - determines access permissions */
role: "admin" | "manager" | "user"
/** Account status - defaults to "active" */
status?: "active" | "inactive"
}
/**
* User entity returned from API
*/
export interface User {
/** Unique identifier (UUID format) */
id: string
email: string
name: string
role: "admin" | "manager" | "user"
status: "active" | "inactive"
/** ISO 8601 timestamp */
createdAt: string
/** ISO 8601 timestamp */
updatedAt: string
}
Step 4: Provide Implementation Guidance
API Service Pattern
// src/api/userApi.ts
export async function createUser(input: UserCreateInput): Promise<User> {
const response = await fetch("/api/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${getToken()}`,
},
body: JSON.stringify(input),
})
if (!response.ok) {
const error = await response.json()
throw new Error(error.message)
}
return response.json()
}
TanStack Query Hook Pattern
// src/hooks/useCreateUser.ts
import { useMutation, useQueryClient } from "@tanstack/react-query"
import { createUser } from "@/api/userApi"
import { userKeys } from "@/lib/queryKeys"
import { toast } from "sonner"
export function useCreateUser() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: createUser,
onSuccess: (newUser) => {
// Invalidate queries to refetch updated data
queryClient.invalidateQueries({ queryKey: userKeys.all() })
toast.success("User created successfully")
},
onError: (error) => {
toast.error(`Failed to create user: ${error.message}`)
},
})
}
Query Key Pattern
// src/lib/queryKeys.ts
export const userKeys = {
all: () => ["users"] as const,
lists: () => [...userKeys.all(), "list"] as const,
list: (filters: UserFilters) => [...userKeys.lists(), filters] as const,
details: () => [...userKeys.all(), "detail"] as const,
detail: (id: string) => [...userKeys.details(), id] as const,
}
Step 5: Document Security and Validation
- OWASP Considerations: SQL injection, XSS, CSRF protection
- Input Validation: Required field validation, format validation
- Authentication: Token handling, refresh logic
- Error Handling: Proper HTTP status code handling
- Rate Limiting: Retry logic, exponential backoff
Step 6: Provide Test Recommendations
// Example test cases based on API spec
describe("createUser", () => {
it("should create user with valid data", async () => {
// Test success case
})
it("should reject duplicate email", async () => {
// Test 409 Conflict
})
it("should validate email format", async () => {
// Te
Установить api-spec-analyzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл api-spec-analyzer?
Analyzes API documentation from OpenAPI specs to provide TypeScript interfaces, request/response formats, and implementation guidance. Use when implementing API integrations, debugging API errors (400, 401, 404), replacing mock APIs, verifying data types, or when user mentions endpoints, API calls, or backend integration.
Как установить скилл api-spec-analyzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-spec-analyzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic