.claude/skills/openapi-analyze/SKILL.md
Analyze an OpenAPI specification and generate a destination implementation plan with action recommendations
npx skillsauth add segmentio/action-destinations openapi-analyzeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill analyzes OpenAPI specifications (2.0/3.x) and generates comprehensive implementation plans for Segment action-destinations.
Ask the user where their OpenAPI spec is located (URL or file path). If URL, use WebFetch to retrieve it. If file path, use Read to load it.
Validate that the content is a valid OpenAPI/Swagger specification by checking for:
openapi field starting with "3."swagger field with value "2.0"Extract these key sections:
info - API name, version, descriptionservers (3.x) or host + basePath (2.0) - Base URLspaths - All available endpointscomponents.schemas (3.x) or definitions (2.0) - Data modelssecuritySchemes - Authentication methodssecurity - Global security requirementsMap OpenAPI security schemes to Segment authentication schemes:
OpenAPI → Segment Mapping:
apiKey in header → custom auth with string fieldapiKey in query → custom auth (note: less common, may need manual setup)http with scheme basic → basic authhttp with scheme bearer → custom auth with password fieldoauth2 → oauth2 or oauth-managed auth (recommend oauth-managed for simplicity)Extract required credential field names and descriptions.
Find Test Endpoint: Look for authentication test endpoints in paths:
/me, /user, /account, /profile/auth/verify, /token/verify, /validateScan all endpoints in paths and prioritize using these heuristics:
Priority: HIGH
/events, /track, /identify, /users, /contacts, /leads, /customersPriority: MEDIUM
Priority: LOW
Batch Support Detection:
array/batch, /bulk, batch, bulkFor each recommended action, note:
For each action's request body schema, map OpenAPI types to Segment field types:
Type Mapping:
string → stringstring with format: email → string (but note email validation)string with format: date-time → datetimestring with format: date → datetimestring with format: uri → stringinteger → integernumber → numberboolean → booleanobject → object with propertiesarray → string with multiple: true or object with multiple: trueenum → string with choices arrayRequired Fields:
required arrays from schema to required: true in fieldsDefault Value Suggestions: Suggest Segment default paths based on field names:
email, user_email → $.traits.email or $.properties.emailuserId, user_id, external_id → $.userIdtimestamp, created_at, occurred_at → $.timestampevent, event_name, event_type → $.eventname, full_name → $.traits.namephone, phone_number → $.traits.phoneproperties, traits, attributes → $.properties or $.traitsCreate a markdown document at: packages/destination-actions/.claude/openapi-analyses/[api-slug]-analysis.md
The API slug should be derived from the API name (lowercase, hyphens instead of spaces).
IMPORTANT: Follow the Standard Analysis Format defined in .claude/skills/implement-destination/analysis-format.md to ensure compatibility with implement-destination. The format below is the OpenAPI-specific implementation of that standard.
Document Structure:
# OpenAPI Destination Analysis: [API Name]
## Summary
- **API Name:** [from info.title]
- **Version:** [from info.version]
- **Base URL:** [from servers[0].url or host+basePath]
- **Authentication:** [recommended Segment scheme]
- **Analysis Date:** [current date]
- **Analysis Source:** OpenAPI Specification
## Authentication Setup
### Recommended Scheme: [custom|basic|oauth2|oauth-managed]
**OpenAPI Security Scheme:** [name and type from spec]
**Required Settings:**
1. **[fieldName]** (type: [string|password])
- Description: [from security scheme description]
- Where to find: [instructions for user]
- Applied as: [header/query parameter details]
**Test Authentication Endpoint:**
- Endpoint: `GET [endpoint]`
- Purpose: [what it returns]
- Fallback: TODO - Manual identification needed
## Recommended Actions
### Priority: High
#### 1. [Action Name] - [One-line summary]
- **Endpoint:** `[METHOD] [path]`
- **Operation ID:** [operationId]
- **Purpose:** [description from OpenAPI]
- **Segment Event Type:** [track|identify|group]
- **Default Subscription:** `type = "[track|identify|group]"` [and additional filters if applicable]
- **Batch Support:** [Yes/No]
- **Reasoning:** [Why this is high priority]
**Field Mappings:**
| Field Name | Type | Required | Description | Suggested Default Path |
| ---------- | ------ | -------- | ------------- | ---------------------- |
| [field] | [type] | [Yes/No] | [description] | [$.path] |
**Request Body Schema:**
```json
[Pretty-printed JSON schema from OpenAPI]
```
Additional Notes:
[Repeat for each high-priority action]
[Medium-priority actions with same structure]
[Low-priority actions with same structure]
[If there are common parameters across actions that should be destination-level settings]
Recommended destination-level settings:
[If multiple servers are detected or regions mentioned]
The API supports multiple regions:
Recommendation: Add a region selector field in authentication.
[If rate limit information is available in OpenAPI extensions or descriptions]
/implement-destination skill with your selections to generate the destination code
### Step 7: Present Results
After generating the analysis document, show the user:
1. A summary of findings:
- Authentication method
- Number of actions found (by priority)
- Base URL and API name
2. Where the analysis was saved
3. Next steps:
- Review the analysis document
- Shortlist actions to implement
- Run `/implement-destination` to generate code
## Tips
- If the OpenAPI spec is malformed or unclear, ask the user for clarification
- When suggesting default paths, consider both track and identify event structures
- For complex nested schemas, flatten them into dot-notation fields where possible
- If you can't determine a good test authentication endpoint, explicitly mark it as TODO
- Prioritize actions that align with common Segment use cases (tracking events, updating user profiles)
- Look for batch endpoints specifically - they're valuable for high-volume use cases
development
Analyze API documentation from a website and generate a destination implementation plan
development
Generate destination code from analysis documents (OpenAPI or web-based) and user-selected actions
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.