This directory contains skills that automate the creation of Segment action-destinations from various sources (OpenAPI specs, website documentation, PRDs, etc.).
The fastest way to build a destination is the /orchestrate command. It runs the entire pipeline end-to-end — analysis → mapping → spec → code → tests → deploy → staging tests — pausing for your review between steps and passing outputs between skills for you.
/orchestrate <destination-name>
Example:
/orchestrate Vibe Actions
What it does (7 steps):
| Step | Skill | Output |
|---|---|---|
| 1. Refine | /refined-actions |
refined-actions.md / .json |
| 2. Map | /endpoint-mapping |
endpoint-mapping.md / .json |
| 3. Spec | /spec-generator |
final-spec.md |
| 4. Generate | /generate-destination |
code in packages/destination-actions/src/destinations/<slug>/ |
| 5. Test (local) | /test-destination-e2e |
local e2e results |
| 6. Deploy | /deploy-staging |
staging deploy |
| 7. Test (staging) | /test-destination-e2e |
staging e2e results |
How to use it:
- Type
/orchestrate <destination-name>in Claude Code. - When asked, provide the API source — a docs URL, an OpenAPI spec path, or a PRD/markdown doc.
- Confirm (or change) the output directory for intermediate files (default
/tmp/<slug>/). - Review each step's output when the orchestrator pauses, and approve to continue.
The orchestrator asks questions only a human can answer (scope, ambiguous mappings), answers what it can from prior outputs, and remembers where it left off if interrupted. Everything intermediate is written to the output directory so nothing is lost between steps.
Prefer running the pipeline yourself step-by-step, or only have an OpenAPI spec / website? The individual skills below still work standalone.
Building a new Segment destination typically involves:
- Manually analyzing API documentation
- Understanding authentication mechanisms
- Identifying suitable endpoints for actions
- Writing boilerplate TypeScript code
- Defining field mappings from Segment events to API schemas
- Setting up tests
These skills automate 70-80% of this process by:
- Analyzing API documentation (OpenAPI specs, websites, or PRDs) to identify suitable actions
- Generating TypeScript destination code with proper types, batching, and tests
Purpose: Parse an OpenAPI spec, identify suitable actions, and generate a comprehensive analysis document.
Best for: APIs with published OpenAPI 2.0/3.x specifications
Usage:
/openapi-analyze
What it does:
- Prompts for OpenAPI spec location (URL or file path)
- Parses the OpenAPI specification
- Analyzes authentication methods
- Identifies high/medium/low priority action candidates
- Extracts field mappings and schemas
- Generates a detailed analysis document
Output:
- Analysis document saved to:
packages/destination-actions/.claude/openapi-analyses/[api-name]-analysis.md - Contains authentication setup, recommended actions, field mappings, and implementation notes
Next Step: Review the analysis document and shortlist 3-5 actions to implement.
Purpose: Parse API documentation from a website, identify suitable actions, and generate a comprehensive analysis document.
Best for: APIs without OpenAPI specs but with good website documentation
Usage:
/web-analyze
What it does:
- Prompts for API documentation URL(s)
- Fetches and analyzes the documentation pages
- Extracts authentication methods, endpoints, and field schemas
- Identifies high/medium/low priority action candidates
- Maps fields to Segment event patterns
- Generates a detailed analysis document (same format as OpenAPI analysis)
Output:
- Analysis document saved to:
packages/destination-actions/.claude/openapi-analyses/[api-name]-analysis.md - Contains authentication setup, recommended actions, field mappings, and implementation notes
Next Step: Review and verify the analysis document, then shortlist 3-5 actions to implement.
Note: Web-based analysis may require more manual verification than OpenAPI-based analysis.
Purpose: Generate complete destination code from any analysis document (OpenAPI or web-based) and user-selected actions.
Works with: Analysis documents from /openapi-analyze or /web-analyze
Usage:
/implement-destination
What it does:
- Prompts for analysis document path (from either analysis skill)
- Prompts for destination name and slug
- Prompts for selected actions to implement
- Generates complete destination structure:
- Destination
index.tswith authentication - Action files with field definitions
- TypeScript type placeholders
- Basic test files
- Implementation notes with TODOs
- Destination
Output:
- Complete destination at:
packages/destination-actions/src/destinations/[slug]/ - Generated TypeScript types
- Test files for destination and actions
IMPLEMENTATION_NOTES.mdwith TODOs
Next Step: Review generated code, complete TODOs, and test with real API credentials.
Choose the appropriate analysis skill:
Option A: OpenAPI Specification
/openapi-analyzeWhen prompted:
- Provide OpenAPI spec URL or file path
- Wait for analysis to complete
- Review the generated analysis document
Option B: Website Documentation
/web-analyzeWhen prompted:
- Provide API documentation URL(s)
- Provide API name
- Wait for analysis to complete
- Review and verify the generated analysis document
Open the analysis document:
packages/destination-actions/.claude/openapi-analyses/your-api-analysis.mdReview:
- Authentication requirements
- High-priority action recommendations
- Field mappings
- Batch support
Shortlist 3-5 actions you want to implement.
# Run the implement skill
/implement-destinationWhen prompted:
- Provide the analysis document path
- Enter destination name (e.g., "Acme Marketing")
- Confirm or customize the slug (e.g., "acme-marketing")
- List the selected actions (comma-separated)
-
Navigate to the generated destination:
cd packages/destination-actions/src/destinations/[your-slug] -
Review the generated code:
cat index.ts cat */index.ts -
Generate TypeScript types:
./bin/run generate:types --path packages/destination-actions/src/destinations/[your-slug]/index.ts
-
Build the project:
yarn build
-
Fix any TypeScript errors
-
Review
IMPLEMENTATION_NOTES.mdand complete TODOs:- Implement
testAuthenticationlogic - Verify field mappings
- Add error handling
- Customize complex transformations
- Implement
-
Run tests:
yarn test packages/destination-actions/src/destinations/[your-slug] -
Test with real API credentials
packages/destination-actions/src/destinations/[slug]/
├── index.ts # Destination definition
├── generated-types.ts # Auto-generated Settings types
├── constants.ts # Base URL, endpoint paths, enums
├── types.ts # Hand-written request/response interfaces
├── utils.ts # Send-event logic, transforms, batch builders
├── __tests__/
│ ├── index.test.ts # Destination tests
│ └── snapshot.test.ts # Snapshot tests (loops all actions)
├── [action-1]/
│ ├── index.ts # Action definition (perform + performBatch)
│ ├── generated-types.ts # Action payload types
│ └── __tests__/
│ └── index.test.ts # Action tests
└── [action-2]/
└── ... (same structure)
Conventions enforced by
/generate-destination:
- Endpoints/enums in
constants.ts, request+response interfaces intypes.ts, send logic inutils.ts— not inlined into the action.- Event-sending actions implement
performBatchwithenable_batching/batch_size(+batch_keyswhen grouping is needed).- All request bodies and API responses are typed (no inline untyped objects, no
anyresponses).- Snapshot tests are generated alongside unit tests.
- The destination is not registered in
destinations/index.tswith a placeholder ID — registration is left as a TODO for the production-assigned metadata ID (IDs must match across environments, created in production and synced viasprout).
✅ Fully Automated (70-80%):
- Destination file structure
- Authentication configuration
- Action definitions
- Field definitions with types
- Default field mappings (e.g.,
$.userId,$.traits.email) - Basic test scaffolding
- TypeScript type generation
- Test authentication logic (may need specific endpoint)
- Complex data transformations
- API-specific error handling
- Conditional field logic
- Custom validation
- Rate limiting
- Retry logic
- Use Official OpenAPI Specs: The more complete the spec, the better the analysis
- Check for Batch Endpoints: Look for
/batchor/bulkpaths - Review Auth Carefully: Ensure the detected auth scheme matches your API
- Consider Regional Endpoints: Note if the API has multiple regions
- Start Small: Implement 3-5 core actions first
- Test Incrementally: Test each action as you complete it
- Review Field Mappings: Ensure Segment event paths match your data model
- Read Existing Destinations: Look at similar destinations in the codebase for patterns
- Check API Docs: OpenAPI specs may not capture all nuances
Issue: TypeScript errors after generation
Solution: Run ./bin/run generate:types and rebuild
Issue: Authentication test not working
Solution: Check IMPLEMENTATION_NOTES.md for TODO - may need to implement custom logic
Issue: Field mappings don't match my data
Solution: Customize the default paths in action field definitions
Issue: API requires complex transformation
Solution: Add custom logic in the perform function - TODOs mark these areas
| OpenAPI Scheme | Segment Scheme | Generated Code |
|---|---|---|
apiKey (header) |
custom |
API key in header |
apiKey (query) |
custom |
API key in query param |
http (basic) |
basic |
Username/password |
http (bearer) |
custom |
Bearer token |
oauth2 |
oauth-managed |
Managed OAuth flow |
/openapi-analyzeInput: https://api.example.com/openapi.json
Output: packages/destination-actions/.claude/openapi-analyses/example-api-analysis.md
/web-analyzeInputs:
- Documentation URL:
https://docs.example.com/api-reference - API Name:
Example API
Output: packages/destination-actions/.claude/openapi-analyses/example-api-analysis.md
/implement-destinationInputs:
- Analysis:
packages/destination-actions/.claude/openapi-analyses/example-api-analysis.md - Name:
Example API - Slug:
example-api(auto-suggested) - Actions:
trackEvent, identifyUser, updateProfile
Output: Complete destination at packages/destination-actions/src/destinations/example-api/
Destination Examples:
packages/destination-actions/src/destinations/courier/- Custom auth with regionspackages/destination-actions/src/destinations/attio/- OAuth-managedpackages/destination-actions/src/destinations/apolloio/- Good action examples
Core Types:
packages/core/src/destination-kit/index.ts- DestinationDefinition, ActionDefinitionpackages/core/src/destination-kit/types.ts- InputField, field types
Testing:
packages/actions-core/src/create-test-integration.ts- Test utilities
- Complex Auth Flows: Multi-step OAuth or custom token refresh requires manual implementation
- Advanced Schemas:
allOf,oneOf,anyOfare simplified - may need refinement - Dynamic Fields: Cannot auto-generate fields that depend on API calls
- Error Mapping: API-specific error codes not automatically mapped
- OpenAPI 2.0: Best results with OpenAPI 3.x (2.0 supported but may be less accurate)
- Interactive field mapping refinement
- Preview generated code before writing
- Integration test generation with realistic mocks
- Documentation generation for Segment docs site
- Support for more complex auth patterns
If you encounter issues or have suggestions:
- Check
IMPLEMENTATION_NOTES.mdin generated destinations - Review existing destinations for patterns
- Consult OpenAPI specification for API details
- Ask for help with specific TODO items
Happy Destination Building! 🚀