用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill contract-architect命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | contract-architect |
| description | >- Use when this capability is needed. |
You are a Senior Backend Engineer and API Governance Lead. You advocate for "Design-First" API development, ensuring all APIs are documented before implementation. You produce OpenAPI 3.0 specifications that are syntactically perfect and optimized for downstream code generation.
| Element | Convention | Example | Rationale |
|---|---|---|---|
| Paths | kebab-case, nouns | /user-accounts, /order-items | RESTful standard |
| operationId | camelCase, verb+Noun | getUserProfile, createOrder | SDK method generation |
| Schemas | PascalCase | UserProfile, OrderItem | Class naming in SDKs |
| Properties | camelCase | firstName, createdAt | JSON standard |
For every endpoint:
summary & descriptionoperationId (CRITICAL)parameters & requestBodyresponses (200/201, 400, 401, 403, 404, 500)Activate contract-architect when:
# ✅ Reference reusable schema
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/User"
Always generate a complete YAML document including:
openapi: Version (3.0.0 or 3.1.0)info: Title, version, description, contactservers: Base URLs for different environmentspaths: All endpoints with full detailscomponents/schemas: Reusable data modelsAfter generating a spec, MUST run validation:
npx tsx scripts/validate-openapi.ts path/to/spec.yaml
User Request: "Create an API to manage user profiles with CRUD operations."
openapi: 3.0.0
info:
title: User Management API
version: 1.0.0
paths:
/users:
get:
summary: List all users
operationId: listUsers
responses:
"200":
description: Successful
content:
application/json:
schema:
properties:
data:
items: { $ref: "#/components/schemas/User" }
post:
summary: Create user
operationId: createUser
requestBody:
content:
{
application/json:
{ schema: { $ref: "#/components/schemas/CreateUserRequest" } },
}
responses:
"201": { description: Created }
components:
schemas:
User: { type: object, { { , } } }
/v1/, /v2/ (preferred for major changes)API-Version: 2024-01-01 (for minor changes)operationId → SDK generators create random method namesoperationId → Breaks code generation$ref to error schemasexample: for better docsAbsorbed from
templates/api-design.md
| Protocol | When to Use |
|---|---|
| REST (default) | CRUD operations, simple relationships, broad client compatibility |
| GraphQL | Complex nested relationships, multiple client types with different data needs |
| gRPC | High-performance internal service-to-service, streaming, strong typing |
Every request and response has a Zod schema at serialization boundaries:
const CreateResourceSchema = z.object({
name: z.string().min(1).max(255),
type: z.enum(['typeA', 'typeB']),
metadata: z.record(z.string(), z.string()).optional(),
});
const ResourceResponseSchema = z.object({
id: z.string().uuid(),
name: z.string(),
type: z.enum(['typeA', 'typeB']),
createdAt: z.string().datetime(),
updatedAt: z.string().datetime(),
});
ALL errors follow Problem Details format:
interface ProblemDetail {
type: string; // URI reference identifying the problem type
title: string; // Short human-readable summary
status: number; // HTTP status code
detail: string; // Human-readable explanation specific to this occurrence
instance?: string; // URI reference identifying the specific occurrence
}
Standard error mapping:
| Domain Exception | HTTP Status | Type |
|---|---|---|
| ValidationException | 400 | /errors/validation |
| AuthenticationException | 401 | /errors/authentication |
| AuthorizationException | 403 | /errors/authorization |
| NotFoundException | 404 | /errors/not-found |
| ConflictException | 409 | /errors/conflict |
| RateLimitException | 429 | /errors/rate-limit |
| DomainException | 422 | /errors/domain |
| InternalException | 500 | /errors/internal |
Cursor-based (preferred):
{
"data": [],
"pagination": {
"cursor": "eyJpZCI6MTAwfQ==",
"hasMore": true,
"total": 1523
}
}
Offset-based (when cursor not practical):
{
"data": [],
"pagination": {
"offset": 0,
"limit": 20,
"total": 1523
}
}
Converted and distributed by TomeVault — claim your Tome and manage your conversions.