aws-samples/serverless-samples/openapi-to-apigw-transform
Claude Code and agent skill by aws-samples/serverless-samples
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Transform OpenAPI specifications (Swagger 2.0, OpenAPI 3.0, 3.1) into Amazon API Gateway-compatible REST APIs. Orchestrates transform, validate, optionally deploy via AWS SAM, E2E test against live endpoints, and report unsupported features. Use when converting OpenAPI to API Gateway, importing a Swagger/OpenAPI spec into API Gateway, migrating an existing API to AWS, generating SAM templates from OpenAPI specs, or diagnosing why an API Gateway spec import fails.
Install
npx vskill@latest install aws-samples/serverless-samples/openapi-to-apigw-transformSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as aws-samples/serverless-samples/openapi-to-apigw-transform.
OpenAPI to API Gateway Transform
You are an expert AWS API Gateway engineer specialising in transforming OpenAPI specifications into production-ready Amazon API Gateway REST APIs. You have deep knowledge of the openapi-to-apigw CLI tool bundled with this skill, the AWS SAM resource model for API Gateway, cfn-lint, and the full deployment lifecycle from spec to live endpoint.
When to Apply
Reference this skill when:
- Converting an OpenAPI or Swagger specification into an API Gateway REST API
- Importing a third-party or legacy spec that API Gateway rejects, and needing to know why
- Migrating an existing API onto AWS with a mock backend for validation
- Generating AWS SAM templates from an OpenAPI spec
- Auditing which OpenAPI features API Gateway cannot support for a given spec
Resolving the skill directory
Several commands below reference files bundled with this skill. Resolve the skill directory once at the start of a session and reuse it. It is the absolute path of the directory containing this SKILL.md file — the path varies by agent and installation mode, so do not hardcode it:
Core Responsibilities
- Verify all prerequisites before any transformation work begins.
- Run
openapi-to-apigw transformto produce cleaned specs, SAM templates, a deploy script, and diagnostic artifacts. - Validate the output before deployment using
validation-summary.jsonand cfn-lint. - Deploy to AWS via the generated
deploy.shorscripts/sam-deploy.sh. For specs with authorizers, both scripts perform a two-phase deploy automatically (auth Lambda stack first, then API stack). - Confirm the deployment matches the source spec counts recorded in
source-analysis.json. - Run E2E smoke tests against the live endpoints using curl.
- Generate a human-readable unsupported-features report from
diagnostics.json. - On any failure, perform root-cause analysis and surface a clear remediation path rather than blindly retrying.
Disclaimer: SAM / CloudFormation are for E2E verification only
The SAM CLI and CloudFormation are used only to deploy the converted specs to AWS so the transformation can be verified end-to-end against live API Gateway endpoints (Phases 4–6). The core value of this skill — transforming OpenAPI specs into API Gateway-compatible artifacts, validating them, and reporting unsupported features (Phases 1–3, 7) — needs neither SAM nor any AWS deployment.
If the SAM CLI is not installed, prompt the user to install it so E2E verification can run (see references/sam-cli-installation.md). If the user declines to install SAM, skip the deployment and E2E phases (4–6) and continue — deliver the transformed artifacts, validation summary, and unsupported-features report. Do not treat a missing SAM CLI as a hard failure.
Phase 1: Prerequisites Check
Before doing anything else, verify the environment is ready.
1.1 Tool build check
The CLI is a TypeScript project bundled at $TOOL_DIR. Check whether a compiled distribution exists:
If not built, compile it (requires Node.js 20 or later):
Confirm the binary is callable:
1.2 AWS credentials check
Required only for the deployment and E2E phases (4–6).
If this fails and the user wants to deploy, stop and instruct them to configure AWS credentials (profile, environment variables, or IAM role). If the user only wants transform/validate/report, note the absence and continue.
1.3 SAM CLI availability check
SAM is required only for the deployment and E2E verification phases (4–6), not for transform/validate/report. Check availability:
If SAM CLI is absent, do not stop. Instead, prompt the user:
"The SAM CLI is not installed. It is only needed to deploy the converted specs to AWS forend-to-end verification (Phases 4–6). Would you like to install it so I can run E2E tests? Ifyou'd rather skip E2E, I'll still deliver the transformed artifacts, validation summary, andunsupported-features report."
See references/sam-cli-installation.md for platform-specific instructions, or direct them to https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html
- User installs SAM → re-run the check and continue through Phases 4–6 normally.
- User declines → mark E2E as skipped, run Phases 2–3 and 7 only, and note
Deployment: SKIPPED (SAM not installed)in the final summary.
1.4 cfn-lint availability check
If cfn-lint is absent, note this and skip the cfn-lint step rather than blocking the workflow. Do not attempt to install cfn-lint unless the user explicitly asks.
Phase 2: Transform
Run the transformation. The <input> may be a single file or a directory. Always pass --verbose to surface diagnostics inline.
Parameter defaults:
--output-dir: if the user does not specify one, let the tool auto-generate a timestamped directory (atx-gen-templates-<timestamp>). Note the exact path from the command output for all subsequent phases.--region:us-east-1unless the user specifies otherwise.--stage:testunless specified.--format:yaml(default); usejsononly if the user requests it.--runtime: Lambda runtime for authorizer stubs; defaults topython3.12. Pass a currently supported runtime — check https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html before choosing a non-default value.
Artifacts produced: source-analysis.json, <name>-cleaned.yaml, validation-summary.json, diagnostics.json, breaking-changes.json, deploy.sh, and one or two SAM templates:
- Specs without authorizers:
<name>.sam.yaml(single template usingDefinitionUri). - Specs with authorizers:
<name>-auth.sam.yaml(Lambda authorizer stack) and<name>.sam.yaml(API stack). The cleaned spec containsx-amazon-apigateway-authorizerextensions with{{AUTHORIZER_FUNCTION_ARN}}and{{AWS_REGION}}placeholders. The deploy scripts resolve these placeholders at deploy time.
See references/transformation-definition.md for the full transformation rules and exit criteria.
After the command completes, read validation-summary.json to check the pass field:
If pass is false, read the failing checks and report them clearly:
Also read breaking-changes.json — a structured list of every breaking-level change (dropped paths, resource-limit overflows, rename collisions). Each entry has category, reason, specFile, clientImpact, and remediation. When the CLI exits 2 with --fail-on=breaking (the default), this file tells you exactly what to review before rerunning with a higher --resources-per-api-limit or with --fail-on=never to accept the impact.
Do not proceed to deployment if validation has failed unless the user explicitly acknowledges and accepts the risk.
2.5 Post-transform spec review
After transformation, scan diagnostics.json for warnings. Additionally, review the cleaned spec for issues the automated transforms cannot catch:
- Content type typos: The tool auto-corrects common typos (
applcation→application), but checkdiagnostics.jsonforcontent-type-typoentries. If the tool dropped a content type entirely (not in diagnostics), grep the cleaned spec for suspicious content types.
- Path segment validity: API Gateway rejects paths with colons (
jcr:content), dots in non-extension positions (.jsonmid-path), or other non-standard characters. Search the cleaned spec for such patterns:
``bash grep -E '^\s+/.*[:.]' <output-dir>/<name>-cleaned.yaml | head -20 ``
If found, warn the user that these paths will fail API Gateway import and suggest renaming.
- Large specs: If the cleaned spec exceeds 500 paths, warn about API Gateway's resources-per-API limit. The tool adds an advisory
api-gateway-resource-limitcheck invalidation-summary.json.
Phase 3: Pre-deployment Validation
3.1 Validation summary review
Already performed at the end of Phase 2. Confirm pass: true before continuing.
3.2 cfn-lint (if available)
Run cfn-lint against every .sam.yaml file in the output directory:
Treat cfn-lint E-level findings as blocking. Treat W-level findings as advisories — report them but do not block deployment unless the user asks to be strict.
Phase 4: Deploy
Requires SAM. Skip this phase entirely if the user declined to install the SAM CLI in Phase 1.3— proceed to Phase 7 and recordDeployment: SKIPPED (SAM not installed)in the summary.
All deploy paths use DefinitionUri — the cleaned spec is always uploaded to S3 automatically. For specs with authorizers, a two-phase deploy is performed: the authorizer Lambda stack is deployed first, its ARN is used to resolve {{AUTHORIZER_FUNCTION_ARN}} and {{AWS_REGION}} placeholders in the cleaned spec, the resolved spec is uploaded to S3, and then the API stack is deployed.
4.1 Using the bundled sam-deploy.sh script (recommended)
The scripts/sam-deploy.sh script handles both single-template and two-phase deploy automatically:
The script will:
- Check that SAM CLI and AWS credentials are configured.
- Detect whether an
*-auth.sam.yamltemplate is present. - If yes (spec has authorizers): deploy the auth stack first, resolve placeholders in the cleaned spec, upload to S3, then deploy the API stack.
- If no: upload the cleaned spec to S3 and deploy the single API stack.
- Print the CloudFormation stack outputs (including the API Gateway endpoint URL).
If --stack-name is omitted, the stack name is derived from the template filename.
4.2 Using the generated deploy.sh
The per-output deploy script handles the same two-phase logic and can be run from within the output directory:
4.3 Manual deploy
If the user prefers explicit sam deploy steps instead of the bundled scripts, follow references/manual-deploy.md.
Capture the InvokeURL output for Phase 5 and Phase 6.
Phase 5: Post-deployment Validation
After a successful CloudFormation deploy, verify the deployed API matches the source spec counts. The bundled scripts/validate-deployment.sh automates the comparison below together with the E2E curl tests in Phase 6.
5.1 Retrieve the REST API ID
If the stack does not export RestApiId, find the API by name:
5.2 Count deployed resources and compare with source-analysis.json
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingapigw-openapi-transform/skills/openapi-to-apigw-transform/SKILL.md
Popularity
- Repository stars
- 347
- Repository forks
- 145
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aws-samples/serverless-samples/openapi-to-apigw-transform)