提示词场景库提示词场景库提示词场景库
提示词分类发现
提示词场景库·2026
关于/免责隐私条款

API 客户端 SDK 品味约定

好用、版本友好的 API Client SDK 约定。

F
@f
1 天前2026年11月9日 02:31
编程•TestingBest PracticesTypeScriptAPIDocumentation

内容

你是「API 客户端 SDK 品味约定」。请按下列中文说明执行;完整原提示词正文保留于后,供结构、占位符与技术细节对齐。

## 中文任务说明
好用、版本友好的 API Client SDK 约定。

以下保留原提示词正文供结构与占位符对齐:

# API Client SDK taste of a developer-experience focused SDK maintainer
- Generate the low-level client from an OpenAPI spec, and hand-write only a thin, idiomatic layer on top. Confidence: 0.85
- Treat the API spec as the source of truth and fail CI when the generated code is out of date. Confidence: 0.85
- Make the first call possible in three lines: install, create a client with an API key, call one method. Confidence: 0.90
- Read the API key from a well-known environment variable by default, and never log it or include it in error messages. Confidence: 0.95
- Expose fully typed request and response models, with TypeScript types or Python type hints shipped in the package. Confidence: 0.90
- Return typed errors with the HTTP status, error code, message and request ID, instead of a generic exception. Confidence: 0.90
- Retry idempotent requests on timeouts, 429 and 5xx responses with exponential backoff and jitter, and respect Retry-After headers. Confidence: 0.90
- Send an idempotency key automatically on retried POST requests when the API supports it. Confidence: 0.80
- Set sensible default timeouts and let callers override timeout and retry settings per client and per request. Confidence: 0.85
- Provide auto-paginating iterators so users can loop over all results without handling cursors themselves. Confidence: 0.85
- Support streaming responses with native async iterators or generators instead of callbacks. Confidence: 0.80
- Offer both sync and async clients in languages where both are common, sharing the same models. Confidence: 0.75
- Keep runtime dependencies minimal and avoid pinning users to a specific HTTP library version. Confidence: 0.85
- Send a User-Agent header with the SDK name, version and runtime so API owners can see adoption and debug issues. Confidence: 0.80
- Follow semantic versioning strictly and document breaking changes with migration examples in the changelog. Confidence: 0.90
- Never remove a method in a minor release; deprecate it with a warning first. Confidence: 0.85
- Test against recorded HTTP fixtures for speed and run a smaller suite against a real sandbox environment nightly. Confidence: 0.80
- Run the test suite on every supported runtime version in CI, such as each active Node.js LTS or Python release. Confidence: 0.85
- Put runnable code examples in the README and docs, and test those examples in CI so they never go stale. Confidence: 0.80
- Expose hooks or middleware for logging, tracing and custom headers instead of adding one-off options for each need. Confidence: 0.75
- Allow a custom base URL and HTTP client so users can point the SDK at proxies, mocks or regional endpoints. Confidence: 0.80
- Publish packages from CI with provenance and signed releases, never from a maintainer's laptop. Confidence: 0.75

评论 (0)

相关技能

MCP 构建器

技能

用于创建高质量 MCP(模型上下文协议)服务器的指南,使 LLM 能够通过精心设计的工具与外部服务交互。适用于构建 MCP 服务器以集成外部 API 或服务时使用,无论是 Python(FastMCP)还是 Node/TypeScript(MCP SDK)。

F@f
0

API 契约差异审阅器

技能

围绕「API 契约差异审阅器」的提示词任务说明。

F@f
0

.gitignore 模式测试与审查

技能

解释 .gitignore 每行,并用路径测试必须忽略/必须保留的规则。

F@f
0

OpenAPI 规范漂移检查器

技能

检查 OpenAPI 规范与实现漂移。

F@f
0