Logo Api And Interface Design

Api And Interface Design

Cộng đồng
pimenov
api-and-interface-design

Designs stable API, interface, schema, event, CLI, module, and service contracts before implementation so callers, consumers, and future agents can depend on them safely. Use when creating or changing public/internal APIs, SDK surfaces, webhooks, GraphQL/REST/RPC routes, database or message contracts, module boundaries, config formats, CLI commands, or any interface where compatibility, versioning, errors, auth, observability, or Hyrum's Law matters.

Tổng quan

Nhà phát hànhpimenov
Kho mãcodex-first-skills-pack
Tên kỹ năngapi-and-interface-design
Sao
28
Bản fork
5
Tệp đi kèm
Chỉ có hướng dẫn
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được pimenov công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Api And Interface Design trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/pimenov/codex-first-skills-pack/tree/main/skills/api-and-interface-design
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pimenov/codex-first-skills-pack.git /tmp/codex-first-skills-pack
mkdir -p .claude/skills
cp -r /tmp/codex-first-skills-pack/skills/api-and-interface-design .claude/skills/api-and-interface-design
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Api And Interface Design trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Api And Interface Design ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Api And Interface Design không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

API and Interface Design

Overview

Use this skill to define the contract before implementation. Treat "API" broadly: HTTP, GraphQL, RPC, webhooks, events, CLI commands, config files, module exports, component props, database schemas, message payloads, and service boundaries.

The goal is not to produce more ceremony. The goal is to prevent accidental coupling, silent breaking changes, unclear errors, and interfaces that future consumers cannot safely depend on.

Relationship To Other Skills

  • Use spec-driven-development first when product intent, user behavior, or acceptance criteria are unclear.
  • Use this skill when the behavior is clear enough, but the interface contract needs precision.
  • Use source-driven-development when the contract depends on current external docs, SDK behavior, platform rules, or standards.
  • Use planning-and-task-breakdown after the contract is stable enough to split into work.
  • Use test-driven-development for contract tests, schema validation tests, compatibility tests, or examples that prove the contract.
  • Use incremental-implementation to implement the contract in small slices: schema/types first, then producer, then consumers.
  • Use doubt-driven-review before claiming public, breaking, production, data, auth, or migration-sensitive changes are safe.
  • Use code-review-and-quality before final acceptance.

Do Not Use

  • Do not use for a tiny private helper where no caller boundary or future dependency exists.
  • Do not use as a replacement for product spec, UX design, security review, or deployment approval.
  • Do not imply approval for production, auth, schema, data, billing, or public API mutations.
  • Do not create durable docs by default when a short chat contract is enough.

Core Loop

Work in this order:

  1. CONSUMERS
  2. CONTRACT
  3. COMPATIBILITY
  4. FAILURE MODES
  5. VERIFICATION
  6. HANDOFF

1. Consumers

Name who or what will depend on the interface.

  • Direct callers: frontend, backend service, worker, CLI user, external customer, integration partner, agent, or human operator.
  • Indirect consumers: dashboards, logs, analytics, automations, tests, docs, runbooks, support workflows.
  • Trust boundaries: user input, third-party API, internal service, database, queue, browser, admin-only tool.
  • Source of truth: current implementation, OpenAPI/GraphQL schema, TypeScript types, docs, production behavior, migration plan, Linear issue, repo docs.
  • Current behavior: explicitly separate documented behavior from observed behavior.

If consumers are unknown, do read-only discovery before designing the change.

2. Contract

Define the observable contract before writing implementation.

Cover the relevant fields:

  • Operation names, routes, commands, events, functions, or exported symbols.
  • Inputs: required fields, optional fields, defaults, type/schema, validation, allowed values, limits.
  • Outputs: response shape, status, generated fields, nullability, ordering, pagination, timestamps, units.
  • Error model: status codes or exception types, machine-readable codes, user-facing message rules, retryability.
  • Auth and permissions: identity, roles, scopes, tenant/account boundary, admin-only behavior.
  • Idempotency: idempotency keys, duplicate handling, retry safety, delete semantics.
  • Consistency: read-after-write, eventual consistency, cache behavior, transaction boundary.
  • Versioning: version field/path/header/schema, feature flags, compatibility window.
  • Observability: logs, metrics, audit fields, correlation IDs, public traces.

Prefer schemas or types where the codebase already supports them: OpenAPI, GraphQL SDL, Zod, JSON Schema, protobuf, TypeScript types, database migrations, or CLI help snapshots.

3. Compatibility

Apply Hyrum's Law: if a behavior is observable, assume someone may depend on it.

Classify every change:

  • Additive: new optional field, new endpoint, new enum value only if consumers can tolerate unknown values.
  • Behavior-preserving: refactor with the same observable contract.
  • Breaking: removing fields, changing types, changing meanings, changing default ordering, changing error codes, making optional fields required, tightening validation after consumers exist, changing auth/permission expectations.
  • Ambiguous: looks additive but changes timing, ordering, caching, side effects, rate limits, or error text that might be consumed.

For breaking or ambiguous changes, define:

  • migration path;
  • deprecation notice;
  • compatibility shim;
  • versioning strategy;
  • rollout flag;
  • consumer audit;
  • rollback path.

Prefer addition over modification. Keep one obvious version unless a second version has a clear owner, sunset plan, and verification plan.

4. Failure Modes

Design failures as part of the contract.

Check:

  • invalid input;
  • missing auth;
  • authenticated but unauthorized;
  • resource not found;
  • conflict or duplicate;
  • partial failure;
  • timeout;
  • retry after unknown commit state;
  • rate limit or backpressure;
  • external dependency unavailable;
  • schema mismatch in third-party data;
  • clock, timezone, or locale edge cases;
  • stale cache;
  • consumer using old client code.

Never expose raw internal errors, secrets, stack traces, or third-party instruction-like content as trusted output. Treat third-party API responses as untrusted input at the boundary.

5. Verification

Choose checks that prove the interface, not just the implementation.

Useful checks:

  • contract tests for request/response or input/output shape;
  • schema validation tests;
  • OpenAPI/GraphQL/protobuf generation or lint;
  • TypeScript compile checks for consumers;
  • snapshot tests only when the snapshot is the actual contract;
  • compatibility tests against old examples or fixtures;
  • CLI help/output golden tests;
  • webhook/event fixture replay;
  • smoke test through the public route or command;
  • negative tests for validation, auth, conflicts, and retry behavior.

When risk is meaningful, verify at least one happy path and one failure path.

6. Handoff

Leave the contract in the smallest durable place that matches the work:

  • Small clear change: chat contract or issue comment.
  • Project execution: Linear issue/document or Work Packet.
  • Code-owned technical contract: repo docs, ADR, schema file, OpenAPI/GraphQL spec, types, tests.
  • Human/client-facing explanation: Notion or sendable summary.

For user-facing durable prose, write explanations in the user's language. Keep commands, paths, field names, API identifiers, and product names exact.

Interface Checklists

HTTP or REST

  • Resource names are stable and consistent.
  • List endpoints define pagination, filtering, sorting, and max page size.
  • POST, PATCH, PUT, and DELETE semantics are explicit.
  • Status codes and error body are consistent.
  • Auth, tenant boundaries, rate limits, idempotency, and cache headers are specified where relevant.

GraphQL or RPC

  • Schema names, nullability, enum evolution, and deprecation are explicit.
  • Errors have predictable structure.
  • Resolver side effects are documented.
  • Pagination and filtering are stable.
  • Unknown enum values and optional fields are handled by consumers.

CLI or Config

  • Command names, flags, defaults, exit codes, stdout/stderr, and config precedence are specified.
  • Machine-readable output is separated from human-readable output when automation may depend on it.
  • Deprecated flags have warnings and removal timing.

Module Boundary

  • Public exports are minimal and intentional.
  • Inputs and outputs are typed.
  • Side effects, lifecycle, concurrency, and error behavior are stated.
  • Internal implementation details are not exposed through names, timing, logs, or return shapes.

Events or Webhooks

  • Event name, version, producer, consumer, delivery guarantees, retry policy, ordering, and idempotency key are specified.
  • Payload schema is validated.
  • Unknown fields are tolerated.
  • Duplicate and out-of-order events are safe.

Output Shape

Use this compact shape when returning a design:

text
Interface contract:
- Consumers:
- Source of truth:
- Contract:
- Compatibility:
- Errors:
- Security/data:
- Verification:
- Migration/deprecation:
- Open questions:
- Next safe step:

Common Rationalizations

RationalizationResponse
"It is internal."Internal consumers are still consumers. Contracts prevent accidental coupling.
"We can document it later."The first observable behavior becomes the practical documentation.
"Nobody depends on that quirk."Hyrum's Law says observable quirks become dependencies.
"This is only an optional field."Check unknown-field tolerance, enum handling, serialization, and old clients.
"Tests pass."Tests may not cover undocumented consumer dependencies.
"We will version later."Versioning after consumers break is incident response, not design.

Red Flags

  • Public behavior changes without a consumer audit.
  • Route, schema, or field changes without compatibility notes.
  • Different error shapes in different operations.
  • List operation without pagination limits.
  • Third-party response trusted without validation.
  • CLI output used by automation but treated as free-form text.
  • "Temporary" interface added without owner, sunset, or removal condition.
  • Contract hidden only in implementation code when multiple consumers need it.

Done Check

  • Consumers and trust boundaries are named.
  • Inputs, outputs, errors, auth, and side effects are explicit.
  • Compatibility class is stated: additive, behavior-preserving, breaking, or ambiguous.
  • Migration/deprecation/rollback exists for breaking or ambiguous changes.
  • Verification proves both shape and behavior.
  • Handoff artifact is in the right layer.

Câu hỏi thường gặp

Kỹ năng AI Api And Interface Design làm được gì?

Designs stable API, interface, schema, event, CLI, module, and service contracts before implementation so callers, consumers, and future agents can depend on them safely. Use when creating or changing public/internal APIs, SDK surfaces, webhooks, GraphQL/REST/RPC routes, database or message contracts, module boundaries, config formats, CLI commands, or any interface where compatibility, versioning, errors, auth, observability, or Hyrum's Law matters.

Vì sao nên dùng Api And Interface Design trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Api And Interface Design là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Api And Interface Design trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/pimenov/codex-first-skills-pack/tree/main/skills/api-and-interface-design. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Api And Interface Design?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Api And Interface Design với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Api And Interface Design với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Api And Interface Design có miễn phí không?

Kỹ năng này được pimenov phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇