AgentSkillsCN

aip-knowledge

当用户询问“AIP 规则”“API 改进建议”“Google API 指南”“AIP-158”“AIP-193”,或任何具体的 AIP 编号时,应使用此技能。此外,当用户询问“我该如何实现分页?”“正确的错误格式是什么?”“我该如何按照 Google 的标准设计 REST API?”或者需要在 REST/OpenAPI API 中获取关于错误处理、分页、过滤、字段掩码、长时运行操作或批量操作的指导时,也应使用此技能。

SKILL.md
--- frontmatter
name: aip-knowledge
description: This skill should be used when the user asks about "AIP rules", "API Improvement Proposals", "Google API guidelines", "AIP-158", "AIP-193", or any specific AIP number. Also use when user asks "how should I implement pagination", "what's the right error format", "how do I design a REST API following Google's standards", or needs guidance on errors, pagination, filtering, field masks, long-running operations, or batch operations in REST/OpenAPI APIs.

AIP Knowledge

Quick reference for Google API Improvement Proposals adapted to REST/OpenAPI.

How to Use This Skill

  1. For quick patterns: Use the Quick Reference section below
  2. For detailed guidance: Load the relevant reference file from the table
  3. For AIP rule violations: See linter-rules.md for all 17 automated rules
  4. For deeper explanation: Use the baume-lookup agent to fetch from google.aip.dev

Reference Files

Load the relevant reference file based on the task:

TopicReference FileWhen to Use
Error responseserrors.mdDesigning error schema, reviewing error handling
Paginationpagination.mdAdding pagination to list endpoints
Filtering & sortingfiltering.mdAdding filter/order_by parameters
Long-running opslro.mdAsync operations, jobs, polling
Partial updatesfield-masks.mdPATCH implementation, update semantics
Batch operationsbatch.mdBatch create/update/delete
Proto → REST mappingrest-mapping.mdTranslating AIP concepts to REST
Linter ruleslinter-rules.mdAll 17 automated AIP rules with skip options

Quick Reference

Standard Methods → HTTP

MethodHTTPPathIdempotentRelated Rules
GetGET/resources/{id}Yesaip131/get-no-body
ListGET/resourcesYesaip158/list-paginated, aip132/has-filtering, aip132/has-ordering
CreatePOST/resourcesNo*aip133/post-returns-201, aip155/idempotency-key
UpdatePATCH/resources/{id}Yesaip134/patch-over-put
DeleteDELETE/resources/{id}Yesaip135/delete-idempotent

*Use Idempotency-Key header for safe retries

Naming Rules (AIP-122)

  • /users, /orders, /products (plural nouns)
  • /user, /order (singular - triggers aip122/plural-resources)
  • /getUsers, /createOrder (verbs - triggers aip122/no-verbs)
  • /users/{id}/orders (nested ownership)

Pagination (AIP-158)

Request: ?page_size=20&page_token=xxx

Response:

json
{
  "data": [...],
  "next_page_token": "yyy"
}

Error Response (AIP-193)

json
{
  "error": {
    "code": "INVALID_ARGUMENT",
    "message": "Human-readable message",
    "details": [...],
    "request_id": "req_abc123"
  }
}

Fetch AIPs On Demand

For detailed guidance, fetch from:

  • https://google.aip.dev/{number} (e.g., /158 for pagination)
  • Only fetch when user needs deeper explanation