[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6PHNAPEGK65CKG9QXEHP131":3,"skill-same:01M6PHNAPEGK65CKG9QXEHP131":95},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":54,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M6PHNAPEGK65CKG9QXEHP131","api-gateway-openapi-spec-authoring",null,"Writes, migrates, and fixes OpenAPI specs for Google Cloud API Gateway. Use when converting an OpenAPI 2.0 (Swagger) spec to OpenAPI 3.x, writing a new OpenAPI 3.x spec, or fixing a failed \"gcloud api-gateway api-configs create\", such as \"extension is only supported in OpenAPI 2.x\". Also use when quotas set with x-google-quota are never enforced, or when a backend receives path parameters as query parameters. Don't use for adding or debugging MCP tools (use api-gateway-mcp-server), backend lockdown or HTTP 429 tuning (use api-gateway-backend-security-and-rate-limiting), Cloud Endpoints, Apigee, or GKE Gateway API.","google\u002Fskills","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M698WR0H76ENHE587T9EJT89",24235,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"spec","api gateway openapi spec authoring","openapi spec","api gateway","gateway","spec authoring","authoring","openapi","api","when","MCP","mcp-server","query","only","never","SET","server","create","debugging","google cloud","writing","2026-11-10 10:12:30",false,"---\nname: api-gateway-openapi-spec-authoring\nmetadata:\n  version: \"1.0.0\"\n  category: ApplicationDevelopment\ndescription: >-\n  Writes, migrates, and fixes OpenAPI specs for Google Cloud API Gateway. Use\n  when converting an OpenAPI 2.0 (Swagger) spec to OpenAPI 3.x, writing a new\n  OpenAPI 3.x spec, or fixing a failed \"gcloud api-gateway api-configs create\",\n  such as \"extension is only supported in OpenAPI 2.x\". Also use when quotas\n  set with x-google-quota are never enforced, or when a backend receives path\n  parameters as query parameters. Don't use for adding or debugging MCP tools\n  (use api-gateway-mcp-server), backend lockdown or HTTP 429 tuning (use\n  api-gateway-backend-security-and-rate-limiting), Cloud Endpoints, Apigee, or\n  GKE Gateway API.\n---\n\n# API Gateway OpenAPI Spec Authoring\n\nAPI Gateway accepts API configs in OpenAPI 2.0, 3.0.x, and 3.1.x. The Google extensions in OpenAPI 3.x have a different structure from the OpenAPI 2.0 extensions:\n\n- A required root `x-google-api-management` block names the backends.\n- `x-google-backend` is a string that references one of these backends.\n- The JWT settings move into `x-google-auth`. The metrics and quotas move into `x-google-api-management`.\n\nUse this skill to migrate an OpenAPI 2.0 spec, write a new OpenAPI 3.x spec, or fix an API config that fails to create.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:api-gateway-openapi-spec-authoring)\"`\nand append `agent-skills\u002F1.0 (skill:api-gateway-openapi-spec-authoring)` to `User-Agent` headers.\n\n## Prerequisites\n\n1. **Install the tools:**\n   - Install the [Google Cloud CLI](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk.md.txt). Then update it with `gcloud components update`. **Rationale:** an old CLI can fail when it uploads an OpenAPI 3.x API config.\n   - Install Python 3.10 or later and PyYAML for the validator script. A JSON spec does not need PyYAML.\n     ```bash\n     pip install \"PyYAML>=6.0,\u003C7.0\"\n     ```\n2. **Authenticate, and select the project, billing, and location:**\n   - Run `gcloud auth login`.\n   - Select a project with `gcloud config set project {project_id}`, or create one with `gcloud projects create {project_id}`.\n   - Make sure that an active billing account is linked to `{project_id}`. API Gateway has a free monthly allowance of API calls, but it still needs an active billing account. For current prices, see [API Gateway pricing](https:\u002F\u002Fcloud.google.com\u002Fapi-gateway\u002Fpricing).\n   - Use `us-central1` as the default `--location` for gateway commands. For the other supported regions, see [API Gateway deployment model](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-gateway\u002Fdocs\u002Fdeployment-model.md.txt).\n3. **Enable the required Google Cloud APIs:**\n   ```bash\n   gcloud services enable \\\n     apigateway.googleapis.com \\\n     servicemanagement.googleapis.com \\\n     servicecontrol.googleapis.com \\\n     --project={project_id}\n   ```\n4. **Verify the IAM roles (use the most restrictive role for each step):**\n   - To create and update the API, API configs, and gateways: API Gateway Admin (`roles\u002Fapigateway.admin`) on `{project_id}`.\n   - To run the `gcloud services enable` commands: Service Usage Admin (`roles\u002Fserviceusage.serviceUsageAdmin`) on `{project_id}`.\n   - To reference the gateway service account in an API config: Service Account User (`roles\u002Fiam.serviceAccountUser`) on `{gateway_sa_email}`.\n   - For a Cloud Run backend that requires authentication: grant `{gateway_sa_email}` the Cloud Run Invoker role (`roles\u002Frun.invoker`) on the service.\n\n## Decision Matrix\n\n| Task | Required Mechanism | Critical Guardrail | Detailed Reference |\n| --- | --- | --- | --- |\n| Migrate an OpenAPI 2.0 (`swagger: \"2.0\"`) config | Convert the standard fields, then move each Google extension to its OpenAPI 3.x form. | A converter such as Swagger Editor leaves every `x-google-*` extension in its OpenAPI 2.0 form. It also writes `servers` without `x-google-endpoint`, so the API loses its base path. **Rationale:** API Gateway rejects most OpenAPI 2.0 extensions in a 3.x spec with `The '{extension}' extension is only supported in OpenAPI 2.x`. | [OpenAPI 2.0 to 3.x Migration](references\u002Fopenapi-2-to-3-migration.md) |\n| Route requests to backends | Root `x-google-api-management.backends.{backend_name}` + `x-google-backend: {backend_name}` at the root or on an operation | Set `pathTranslation` on every backend. **Rationale:** the default is `APPEND_PATH_TO_ADDRESS` for a root `x-google-backend`, but `CONSTANT_ADDRESS` for an operation-level one. `CONSTANT_ADDRESS` sends every request to the address unchanged, and sends path parameters as query parameters. `APPEND_PATH_TO_ADDRESS` appends the full request path, with the base path. NEVER set `x-google-backend` on a path item: API Gateway rejects it. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#backends) |\n| Authenticate callers | JWT: `type: oauth2` scheme with `x-google-auth` (`issuer`, `jwksUri`, `audiences`). API key: `type: apiKey` scheme with `x-api-key` in a header, or `key` or `api_key` in the query. | API Gateway does not check OAuth scopes. In a `security` list, put an API key in every alternative (OR) or in none. NEVER put two JWT schemes in one requirement object (AND). **Rationale:** API Gateway rejects these combinations. If the user asks for one of them, such as a JWT or an API key as alternatives, do not write it in the spec. Explain the rule, and write a supported option, such as an API key in every alternative or a separate path for each kind of caller. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#security) |\n| Add quotas | `x-google-api-management.metrics` and `quota.limits` + `x-google-quota: {metric_name: cost}` on each operation | NEVER rely on `x-google-quota` at the root or path level. **Rationale:** in OpenAPI 3.x, API Gateway ignores it there without an error. Require an API key on each operation that has a quota, and keep each metric name the same in every API config. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#quotas) |\n| Set the base path and CORS | One `servers` entry with `x-google-endpoint`, such as `url: \u002Fv1` | API Gateway ignores `servers` entries without `x-google-endpoint`. `allowCors: true` only passes CORS requests to the backend. **Rationale:** the gateway does not add CORS headers, so the backend must answer them. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#servers-base-path-and-cors) |\n| Fix a failed `api-configs create` | Match the error text to the error table, and fix the spec. | Fix the spec before you retry, unless the error is about IAM or another `api-configs create` that runs. **Rationale:** API Gateway returns the same error for the same spec. | [API Config Errors](references\u002Fapi-config-errors.md) |\n| Expose operations as MCP tools | The `api-gateway-mcp-server` skill | MCP adds rules for tool names, descriptions, and `tools\u002Flist` security. If that skill is not installed, use this skill for the OpenAPI 3.x spec, and follow the [Configure MCP](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-gateway\u002Fdocs\u002Fmcp-configure.md.txt) guide for the MCP extensions. | - |\n\n## Execution Workflow and Validation Loop\n\n1. **Get the current spec:**\n   - Use the spec file in the user's repository. If there is no file, find the active API config of the gateway:\n     ```bash\n     gcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format=\"value(apiConfig)\"\n     ```\n   - The output is `projects\u002F{project}\u002Flocations\u002Fglobal\u002Fapis\u002F{api_id}\u002Fconfigs\u002F{config_id}`. Print the spec of that config:\n     ```bash\n     gcloud api-gateway api-configs describe {config_id} --api={api_id} --project={project_id} --view=FULL \\\n       --format=\"value(openapiDocuments[0].document.contents)\" | tr '_-' '\u002F+' | base64 --decode\n     ```\n   - gcloud prints the contents in URL-safe base64, so `tr` changes two characters before `base64 --decode`. If the config has more than one OpenAPI document, change `[0]` to `[1]`, `[2]`, and so on.\n2. **Write the OpenAPI 3.x spec:**\n   - For an OpenAPI 2.0 spec, follow [OpenAPI 2.0 to 3.x Migration](references\u002Fopenapi-2-to-3-migration.md), and compare your result with its complete converted example.\n   - For a new spec, start from the template in [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#new-spec-template).\n   - Set `openapi` to a 3.0.x or 3.1.x version. The examples use `3.0.4`. In OpenAPI 3.1, give each schema one `type`. **Rationale:** API Gateway rejects a type list such as `type: [\"string\", \"null\"]`.\n   - Give every operation a unique `operationId` and a `responses` object, and use only local `$ref` values. **Rationale:** API Gateway rejects an operation without `operationId` or `responses`, two `operationId` values that give the same method name, such as `getItem` and `get-Item`, and a `$ref` to a URL.\n3. **Run the deterministic validation loop on every spec that you write or change, before you answer or create the API config:**\n   ```bash\n   python3 scripts\u002Fvalidate_apigw_openapi.py --spec={spec_file}\n   ```\n   - The script path is relative to the directory of this skill. If you only return the spec in your reply, write it to a temporary file, and run the script on that file before you answer.\n   - If the script exits with code `1` (`\"status\": \"FAIL\"`), fix every error in `{spec_file}`, and run the script again. Continue until it exits with code `0` (`\"status\": \"PASS\"`).\n   - If the script exits with code `2`, fix the file path or the YAML\u002FJSON syntax error that stderr shows, or install PyYAML.\n   - Read every warning, such as a backend without `pathTranslation`, a quota on an operation without an API key, or `allowCors`. Fix it, or tell the user why you keep it.\n   - The script does not check every rule. A PASS means that it found none of the API Gateway problems that this skill describes. It does not check general OpenAPI validity, such as a `$ref` to a schema that does not exist. **Rationale:** only `api-configs create` in step 5 shows that API Gateway accepts the spec. Do not tell the user that the spec deploys because the script passed.\n4. **Summarize the spec for the user, and get approval before you deploy.** State each of these points:\n   - Each OpenAPI 2.0 extension that you moved or removed, such as `x-google-allow`, which OpenAPI 3.x does not support. Also state each other change, such as an added `operationId` or a fixed address.\n   - The `pathTranslation` of each backend (`backend_path_translation` in the script output), and each operation whose path parameters now go to the backend as query parameters (`path_parameters_as_query`). With `APPEND_PATH_TO_ADDRESS`, the backend also receives the base path.\n   - Which operations need a JWT or an API key, which backends receive an ID token and with which audience, and that API Gateway does not check OAuth scopes.\n   - The quota metrics and limits, and that each metric name matches the current API config.\n5. **Create a new API config and update the gateway** (request human approval before you update a production gateway):\n   ```bash\n   gcloud api-gateway api-configs create {new_config_id} \\\n     --api={api_id} \\\n     --openapi-spec={spec_file} \\\n     --backend-auth-service-account={gateway_sa_email} \\\n     --project={project_id}\n\n   gcloud api-gateway gateways update {gateway_id} \\\n     --api={api_id} \\\n     --api-config={new_config_id} \\\n     --location={region} \\\n     --project={project_id}\n   ```\n   - For a new gateway, run `gcloud api-gateway gateways create {gateway_id}` with the same flags instead of `gateways update`. `api-configs create` creates the API if it does not exist.\n   - If an operation requires an API key, enable the managed service of the API. Get its name with `gcloud api-gateway apis describe {api_id} --project={project_id} --format=\"value(managedService)\"`, and then run `gcloud services enable {managed_service} --project={project_id}`. Also enable it in each project that creates API keys for the API.\n   - Use a new config ID for each change, because you cannot change the spec of an existing API config.\n   - Run one `api-configs create` at a time for each API, and wait for it to finish. A large API config can take up to ten minutes to create.\n   - If `api-configs create` fails, find the error text in [API Config Errors](references\u002Fapi-config-errors.md), fix the spec, and go back to step 3.\n   - Keep the previous API config until the new one serves traffic. To roll back, run `gateways update` with the previous config ID.\n6. **Verify the gateway:**\n   - Run `gcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format=\"value(state,defaultHostname)\"`, and wait until the state is `ACTIVE`.\n   - Send a request to each changed path at `https:\u002F\u002F{default_hostname}{base_path}{path}`, with the credential that the operation requires. Check that the backend receives the path and parameters that you expect.\n   - An HTML `404 Page not found` means that the gateway is not ready. Check that the last create or update finished, and retry before you change the config. During a gateway update, some requests can still reach the previous API config. A JSON 404 (`The current request is not defined by this API.`) means that the active API config does not define the path.\n\n## Pre-Deployment Checklist\n\n- [ ] `openapi` is `3.0.x` or `3.1.x`, and the spec has no OpenAPI 2.0 extension, such as `x-google-management`, `x-google-endpoints`, `x-google-api-name`, `x-google-allow`, or `x-google-issuer` on a security scheme.\n- [ ] `x-google-api-management.backends` defines every backend, every `x-google-backend` is a string that names one, and no path item sets `x-google-backend`.\n- [ ] Every backend sets `pathTranslation`.\n- [ ] Every operation has a unique `operationId` and a `responses` object, and each path variable has a parameter with `in: path` and `required: true`.\n- [ ] Every `x-google-quota` is on an operation that requires an API key, and every metric name matches the current API config.\n- [ ] At most one `servers` entry has `x-google-endpoint`, and its URL has no custom port.\n- [ ] `python3 scripts\u002Fvalidate_apigw_openapi.py --spec={spec_file}` returns `\"status\": \"PASS\"` (exit code `0`).\n\n## Resource Cleanup\n\nTo avoid ongoing charges when you tear down a test environment, request human approval, and delete the resources in dependency order:\n\n```bash\ngcloud api-gateway gateways delete {gateway_id} --location={region} --project={project_id}\ngcloud api-gateway api-configs delete {config_id} --api={api_id} --project={project_id}\ngcloud api-gateway apis delete {api_id} --project={project_id}\n```\n","# API Gateway OpenAPI Spec Authoring\n\nAPI Gateway accepts API configs in OpenAPI 2.0, 3.0.x, and 3.1.x. The Google extensions in OpenAPI 3.x have a different structure from the OpenAPI 2.0 extensions:\n\n- A required root `x-google-api-management` block names the backends.\n- `x-google-backend` is a string that references one of these backends.\n- The JWT settings move into `x-google-auth`. The metrics and quotas move into `x-google-api-management`.\n\nUse this skill to migrate an OpenAPI 2.0 spec, write a new OpenAPI 3.x spec, or fix an API config that fails to create.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:api-gateway-openapi-spec-authoring)\"`\nand append `agent-skills\u002F1.0 (skill:api-gateway-openapi-spec-authoring)` to `User-Agent` headers.\n\n## Prerequisites\n\n1. **Install the tools:**\n   - Install the [Google Cloud CLI](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk.md.txt). Then update it with `gcloud components update`. **Rationale:** an old CLI can fail when it uploads an OpenAPI 3.x API config.\n   - Install Python 3.10 or later and PyYAML for the validator script. A JSON spec does not need PyYAML.\n     ```bash\n     pip install \"PyYAML>=6.0,\u003C7.0\"\n     ```\n2. **Authenticate, and select the project, billing, and location:**\n   - Run `gcloud auth login`.\n   - Select a project with `gcloud config set project {project_id}`, or create one with `gcloud projects create {project_id}`.\n   - Make sure that an active billing account is linked to `{project_id}`. API Gateway has a free monthly allowance of API calls, but it still needs an active billing account. For current prices, see [API Gateway pricing](https:\u002F\u002Fcloud.google.com\u002Fapi-gateway\u002Fpricing).\n   - Use `us-central1` as the default `--location` for gateway commands. For the other supported regions, see [API Gateway deployment model](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-gateway\u002Fdocs\u002Fdeployment-model.md.txt).\n3. **Enable the required Google Cloud APIs:**\n   ```bash\n   gcloud services enable \\\n     apigateway.googleapis.com \\\n     servicemanagement.googleapis.com \\\n     servicecontrol.googleapis.com \\\n     --project={project_id}\n   ```\n4. **Verify the IAM roles (use the most restrictive role for each step):**\n   - To create and update the API, API configs, and gateways: API Gateway Admin (`roles\u002Fapigateway.admin`) on `{project_id}`.\n   - To run the `gcloud services enable` commands: Service Usage Admin (`roles\u002Fserviceusage.serviceUsageAdmin`) on `{project_id}`.\n   - To reference the gateway service account in an API config: Service Account User (`roles\u002Fiam.serviceAccountUser`) on `{gateway_sa_email}`.\n   - For a Cloud Run backend that requires authentication: grant `{gateway_sa_email}` the Cloud Run Invoker role (`roles\u002Frun.invoker`) on the service.\n\n## Decision Matrix\n\n| Task | Required Mechanism | Critical Guardrail | Detailed Reference |\n| --- | --- | --- | --- |\n| Migrate an OpenAPI 2.0 (`swagger: \"2.0\"`) config | Convert the standard fields, then move each Google extension to its OpenAPI 3.x form. | A converter such as Swagger Editor leaves every `x-google-*` extension in its OpenAPI 2.0 form. It also writes `servers` without `x-google-endpoint`, so the API loses its base path. **Rationale:** API Gateway rejects most OpenAPI 2.0 extensions in a 3.x spec with `The '{extension}' extension is only supported in OpenAPI 2.x`. | [OpenAPI 2.0 to 3.x Migration](references\u002Fopenapi-2-to-3-migration.md) |\n| Route requests to backends | Root `x-google-api-management.backends.{backend_name}` + `x-google-backend: {backend_name}` at the root or on an operation | Set `pathTranslation` on every backend. **Rationale:** the default is `APPEND_PATH_TO_ADDRESS` for a root `x-google-backend`, but `CONSTANT_ADDRESS` for an operation-level one. `CONSTANT_ADDRESS` sends every request to the address unchanged, and sends path parameters as query parameters. `APPEND_PATH_TO_ADDRESS` appends the full request path, with the base path. NEVER set `x-google-backend` on a path item: API Gateway rejects it. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#backends) |\n| Authenticate callers | JWT: `type: oauth2` scheme with `x-google-auth` (`issuer`, `jwksUri`, `audiences`). API key: `type: apiKey` scheme with `x-api-key` in a header, or `key` or `api_key` in the query. | API Gateway does not check OAuth scopes. In a `security` list, put an API key in every alternative (OR) or in none. NEVER put two JWT schemes in one requirement object (AND). **Rationale:** API Gateway rejects these combinations. If the user asks for one of them, such as a JWT or an API key as alternatives, do not write it in the spec. Explain the rule, and write a supported option, such as an API key in every alternative or a separate path for each kind of caller. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#security) |\n| Add quotas | `x-google-api-management.metrics` and `quota.limits` + `x-google-quota: {metric_name: cost}` on each operation | NEVER rely on `x-google-quota` at the root or path level. **Rationale:** in OpenAPI 3.x, API Gateway ignores it there without an error. Require an API key on each operation that has a quota, and keep each metric name the same in every API config. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#quotas) |\n| Set the base path and CORS | One `servers` entry with `x-google-endpoint`, such as `url: \u002Fv1` | API Gateway ignores `servers` entries without `x-google-endpoint`. `allowCors: true` only passes CORS requests to the backend. **Rationale:** the gateway does not add CORS headers, so the backend must answer them. | [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#servers-base-path-and-cors) |\n| Fix a failed `api-configs create` | Match the error text to the error table, and fix the spec. | Fix the spec before you retry, unless the error is about IAM or another `api-configs create` that runs. **Rationale:** API Gateway returns the same error for the same spec. | [API Config Errors](references\u002Fapi-config-errors.md) |\n| Expose operations as MCP tools | The `api-gateway-mcp-server` skill | MCP adds rules for tool names, descriptions, and `tools\u002Flist` security. If that skill is not installed, use this skill for the OpenAPI 3.x spec, and follow the [Configure MCP](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-gateway\u002Fdocs\u002Fmcp-configure.md.txt) guide for the MCP extensions. | - |\n\n## Execution Workflow and Validation Loop\n\n1. **Get the current spec:**\n   - Use the spec file in the user's repository. If there is no file, find the active API config of the gateway:\n     ```bash\n     gcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format=\"value(apiConfig)\"\n     ```\n   - The output is `projects\u002F{project}\u002Flocations\u002Fglobal\u002Fapis\u002F{api_id}\u002Fconfigs\u002F{config_id}`. Print the spec of that config:\n     ```bash\n     gcloud api-gateway api-configs describe {config_id} --api={api_id} --project={project_id} --view=FULL \\\n       --format=\"value(openapiDocuments[0].document.contents)\" | tr '_-' '\u002F+' | base64 --decode\n     ```\n   - gcloud prints the contents in URL-safe base64, so `tr` changes two characters before `base64 --decode`. If the config has more than one OpenAPI document, change `[0]` to `[1]`, `[2]`, and so on.\n2. **Write the OpenAPI 3.x spec:**\n   - For an OpenAPI 2.0 spec, follow [OpenAPI 2.0 to 3.x Migration](references\u002Fopenapi-2-to-3-migration.md), and compare your result with its complete converted example.\n   - For a new spec, start from the template in [Extensions and Limits](references\u002Fopenapi-3-extensions-and-limits.md#new-spec-template).\n   - Set `openapi` to a 3.0.x or 3.1.x version. The examples use `3.0.4`. In OpenAPI 3.1, give each schema one `type`. **Rationale:** API Gateway rejects a type list such as `type: [\"string\", \"null\"]`.\n   - Give every operation a unique `operationId` and a `responses` object, and use only local `$ref` values. **Rationale:** API Gateway rejects an operation without `operationId` or `responses`, two `operationId` values that give the same method name, such as `getItem` and `get-Item`, and a `$ref` to a URL.\n3. **Run the deterministic validation loop on every spec that you write or change, before you answer or create the API config:**\n   ```bash\n   python3 scripts\u002Fvalidate_apigw_openapi.py --spec={spec_file}\n   ```\n   - The script path is relative to the directory of this skill. If you only return the spec in your reply, write it to a temporary file, and run the script on that file before you answer.\n   - If the script exits with code `1` (`\"status\": \"FAIL\"`), fix every error in `{spec_file}`, and run the script again. Continue until it exits with code `0` (`\"status\": \"PASS\"`).\n   - If the script exits with code `2`, fix the file path or the YAML\u002FJSON syntax error that stderr shows, or install PyYAML.\n   - Read every warning, such as a backend without `pathTranslation`, a quota on an operation without an API key, or `allowCors`. Fix it, or tell the user why you keep it.\n   - The script does not check every rule. A PASS means that it found none of the API Gateway problems that this skill describes. It does not check general OpenAPI validity, such as a `$ref` to a schema that does not exist. **Rationale:** only `api-configs create` in step 5 shows that API Gateway accepts the spec. Do not tell the user that the spec deploys because the script passed.\n4. **Summarize the spec for the user, and get approval before you deploy.** State each of these points:\n   - Each OpenAPI 2.0 extension that you moved or removed, such as `x-google-allow`, which OpenAPI 3.x does not support. Also state each other change, such as an added `operationId` or a fixed address.\n   - The `pathTranslation` of each backend (`backend_path_translation` in the script output), and each operation whose path parameters now go to the backend as query parameters (`path_parameters_as_query`). With `APPEND_PATH_TO_ADDRESS`, the backend also receives the base path.\n   - Which operations need a JWT or an API key, which backends receive an ID token and with which audience, and that API Gateway does not check OAuth scopes.\n   - The quota metrics and limits, and that each metric name matches the current API config.\n5. **Create a new API config and update the gateway** (request human approval before you update a production gateway):\n   ```bash\n   gcloud api-gateway api-configs create {new_config_id} \\\n     --api={api_id} \\\n     --openapi-spec={spec_file} \\\n     --backend-auth-service-account={gateway_sa_email} \\\n     --project={project_id}\n\n   gcloud api-gateway gateways update {gateway_id} \\\n     --api={api_id} \\\n     --api-config={new_config_id} \\\n     --location={region} \\\n     --project={project_id}\n   ```\n   - For a new gateway, run `gcloud api-gateway gateways create {gateway_id}` with the same flags instead of `gateways update`. `api-configs create` creates the API if it does not exist.\n   - If an operation requires an API key, enable the managed service of the API. Get its name with `gcloud api-gateway apis describe {api_id} --project={project_id} --format=\"value(managedService)\"`, and then run `gcloud services enable {managed_service} --project={project_id}`. Also enable it in each project that creates API keys for the API.\n   - Use a new config ID for each change, because you cannot change the spec of an existing API config.\n   - Run one `api-configs create` at a time for each API, and wait for it to finish. A large API config can take up to ten minutes to create.\n   - If `api-configs create` fails, find the error text in [API Config Errors](references\u002Fapi-config-errors.md), fix the spec, and go back to step 3.\n   - Keep the previous API config until the new one serves traffic. To roll back, run `gateways update` with the previous config ID.\n6. **Verify the gateway:**\n   - Run `gcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format=\"value(state,defaultHostname)\"`, and wait until the state is `ACTIVE`.\n   - Send a request to each changed path at `https:\u002F\u002F{default_hostname}{base_path}{path}`, with the credential that the operation requires. Check that the backend receives the path and parameters that you expect.\n   - An HTML `404 Page not found` means that the gateway is not ready. Check that the last create or update finished, and retry before you change the config. During a gateway update, some requests can still reach the previous API config. A JSON 404 (`The current request is not defined by this API.`) means that the active API config does not define the path.\n\n## Pre-Deployment Checklist\n\n- [ ] `openapi` is `3.0.x` or `3.1.x`, and the spec has no OpenAPI 2.0 extension, such as `x-google-management`, `x-google-endpoints`, `x-google-api-name`, `x-google-allow`, or `x-google-issuer` on a security scheme.\n- [ ] `x-google-api-management.backends` defines every backend, every `x-google-backend` is a string that names one, and no path item sets `x-google-backend`.\n- [ ] Every backend sets `pathTranslation`.\n- [ ] Every operation has a unique `operationId` and a `responses` object, and each path variable has a parameter with `in: path` and `required: true`.\n- [ ] Every `x-google-quota` is on an operation that requires an API key, and every metric name matches the current API config.\n- [ ] At most one `servers` entry has `x-google-endpoint`, and its URL has no custom port.\n- [ ] `python3 scripts\u002Fvalidate_apigw_openapi.py --spec={spec_file}` returns `\"status\": \"PASS\"` (exit code `0`).\n\n## Resource Cleanup\n\nTo avoid ongoing charges when you tear down a test environment, request human approval, and delete the resources in dependency order:\n\n```bash\ngcloud api-gateway gateways delete {gateway_id} --location={region} --project={project_id}\ngcloud api-gateway api-configs delete {config_id} --api={api_id} --project={project_id}\ngcloud api-gateway apis delete {api_id} --project={project_id}\n```\n",{"name":5,"metadata":45,"description":7},{"version":46,"category":47},"1.0.0","ApplicationDevelopment","main","cd6fde0b299b34bbad05f64ad1ed5bd2ed05e634","skills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring",2014,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 23:31:00",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add google\u002Fskills --skill api-gateway-openapi-spec-authoring",{"tool":63,"command":64},"bunx","bunx skills add google\u002Fskills --skill api-gateway-openapi-spec-authoring",{"tool":66,"command":67},"pnpm","pnpm dlx skills add google\u002Fskills --skill api-gateway-openapi-spec-authoring","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002FSKILL.md",true,[71,77,81,85,89],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fapi-config-errors.md","REFERENCE","参考文档",14475,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002Freferences\u002Fapi-config-errors.md",{"path":78,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fattribution.md",1942,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002Freferences\u002Fattribution.md",{"path":82,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fopenapi-2-to-3-migration.md",16867,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002Freferences\u002Fopenapi-2-to-3-migration.md",{"path":86,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fopenapi-3-extensions-and-limits.md",14544,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002Freferences\u002Fopenapi-3-extensions-and-limits.md",{"path":90,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"scripts\u002Fvalidate_apigw_openapi.py","SCRIPT","脚本",59129,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fapi-gateway-openapi-spec-authoring\u002Fscripts\u002Fvalidate_apigw_openapi.py",[96,104,111,118,125,132],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":103},"01M7DQ9K7JF4T7NJZ2K1MQZ44Q","cloud-operator-share-context","Shares Google Cloud operating context the user or their team already have — environments, projects, services and regions, product preferences, best practices, architecture guidance, runbooks — found in agent instruction files, local memory, skills and workflows, and the repository's GCP docs, with the operator agent's memory after the user reviews the list. Use when the user runs this skill, accepts the cloud-operator or cloud-operator-setup skill's offer to share their existing Google Cloud context, or asks to share, import or save that context or a GCP fact for the operator agent. Don't use for ordinary GCP requests, which go to the cloud-operator skill.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-share-context\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":103},"01M7DQ9ERFGGQCFAWQW0KRKYBY","cloud-operator-setup","Sets up the operator agent in a Google Cloud project via the autocloud MCP server: picks the operator project, creates or checks the user's operator agent, saves the project, and offers to share the user's existing Google Cloud operating context with the operator agent's memory. Use when the user runs this skill, asks to set up the operator or create their operator agent, or chooses setup when the cloud-operator skill asks. Don't use for ordinary GCP requests or installing gcloud.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-setup\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":103},"01M7B4RHQCM0DK2XQ7S7ZXVN8D","developer-device-platform-device-run","Runs automated, non-interactive jobs on remote Android devices with Developer Device Platform (DDP) Device Run using `gcloud beta device-run sessions`: native Android executables or shell scripts (for example CLI tools, custom runners, test harnesses or benchmarks) and Android instrumentation tests, on one or many devices, then waits for completion and collects per-device outputs and logs. Use when running a binary or test suite on remote devices without an interactive connection. Don't use it for interactive device reservations, adb tunnels or screen streaming (use developer-device-platform-basics), or for local devices.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fdeveloper-device-platform-device-run\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":103},"01M7B4R9YXMRW7RZP9Q9FMZJ2P","compute-vm-creation","Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcompute-vm-creation\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":103},"01M7B4QD02N0YBVT0838Z5K5VC","agent-platform-autorater-customization","Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent wrong, or wants an autorater to agree with human labels (autorater hillclimbing, judge calibration). Don't use for quick evals with built-in metrics or for improving the agent itself (use agent-platform-eval-flywheel).","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fagent-platform-autorater-customization\u002FSKILL.md",[],[],{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":103},"01M78JP22K73KK96JH0JNDT5C4","iap-agent-platform-troubleshooting","Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests from Gemini Enterprise Agent Platform agents that run on Agent Runtime and send traffic through Agent Gateway. Use when an agent request fails with \"Egress request is not authorized\", when Cloud Audit Logs show an IAP egressViaIAP decision with granted false, when IAP audit entries are missing while debugging agent egress, or when Access policies, IAP allow policies, policy bindings, or Agent Registry entries might block agent egress. Don't use for Gemini model IAM permission errors (such as aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime deployment or 500 errors (use agent-platform-troubleshooting instead). Don't use for setting up, creating, or connecting an Agent Gateway, or for IAP web apps, IAP TCP forwarding, or SSH.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fiap-agent-platform-troubleshooting\u002FSKILL.md",[],[]]