ballerina-platform/ballerina-library/generating-connectors
Claude Code and agent skill by ballerina-platform/ballerina-library
- community
Checking that the SKILL.md file is still in the repository.
Generates a complete Ballerina connector from an OpenAPI specification. Use when the user wants to create, generate, or build a Ballerina connector from an OpenAPI or Swagger spec; run the connector creation pipeline; generate a Ballerina client from an API spec; or produce connector tests, examples, and documentation.
Install
npx vskill@latest install ballerina-platform/ballerina-library/generating-connectorsSKILL.md
Generating Ballerina Connectors Skill
An AI-assisted pipeline for generating and maintaining Ballerina connectors from OpenAPI specifications. Mirrors the bal connector openapi workflow with interactive guidance, "2+1" prompting, and LLM reasoning applied only where it adds value.
How This Skill Works
This skill orchestrates five pipeline stages in sequence:
Each stage is defined in a dedicated file under stages/. Load only the active stage's file into context — do not preload all stages.
Compilation errors are fixed inline within each stage using the reusable fix procedure (references/fix-procedure.md). Any stage that runs bal build will invoke this procedure automatically on failure — no separate fix stage.
Scripts in scripts/ handle all deterministic operations. Run them via Bash — do not reimplement their logic inline.
Quick Reference
| Stage | File | Skippable? | Key output | |
|---|---|---|---|---|
| 0. Setup | stages/00-setup.md | No | Configuration, validated spec | |
| 1. Sanitize | stages/01-sanitize.md | Yes (sanitize) | aligned_ballerina_openapi.yaml, sanitations.md | |
| 2. Client | stages/02-client.md | Yes (client) | client.bal, types.bal — build + auto-fix inline | |
| 3. Tests | stages/03-tests.md | Yes (tests) | tests/test.bal, mock server — build + auto-fix inline | |
| 4. Examples | stages/04-examples.md | Yes (examples) | regenerate safely, or retain + validate existing packages when excluded | |
| 5. Docs | stages/05-docs.md | Yes (docs) | README.md, Module.md, Ballerina.toml keywords |
Entry Point Instructions
When this skill is invoked:
- Print the welcome banner:
``` ╔══════════════════════════════════════════╗ ║ Ballerina Connector Generator ║ ╚════════════════════════════════ ᵥ₀․₄․₀ ══╝
I'll guide you through generating a Ballerina connector from your OpenAPI spec. This involves up to 5 stages: sanitize → client → tests → examples → docs. ```
- Read and follow
stages/00-setup.mdto collect all configuration. Do this before loading any other stage file.
- After setup, execute stages in order, respecting
EXCLUDED_STAGES:
`` for stage in [sanitize, client, tests, examples, docs]: if stage not in EXCLUDED_STAGES: Read the corresponding stage file Follow its instructions completely If INTERACTIVE_MODE: pause and confirm before next stage elif stage == examples: Read stages/04-examples.md and follow its retained-example validation path ``
- When any stage runs
bal buildand it fails, readreferences/fix-procedure.mdand invoke it immediately in that stage's context before proceeding.
Shared State
These variables are set in Setup (stage 00) and used by all subsequent stages:
| Variable | Description | |
|---|---|---|
PYTHON_CMD | Resolved Python 3 command for this machine (python3/python/py) — determined once in Setup Step 0 | |
SPEC_PATH | Absolute or relative path to the input OpenAPI spec | |
BALLERINA_DIR | Directory containing (or to contain) Ballerina.toml — where client.bal, types.bal, utils.bal, tests/, README.md, Module.md are generated | |
SPEC_DIR | User-confirmed path for the aligned spec, sanitations.md, and stable operation-ID/schema-name decisions in ai-mappings.json (default: ./docs/spec) | |
EXAMPLE_DIR | User-confirmed path for generated examples (default: ./examples); retained examples use this default even when generation is excluded | |
BAL_ORG | Ballerina package org (read from Ballerina.toml or collected from user) | |
BAL_PACKAGE | Ballerina package name (read from Ballerina.toml or collected from user) | |
LICENSE_PATH | Path to the user-provided license file, or empty if not provided | |
TAGS | List of OpenAPI tags to filter (or empty for all) | |
OPERATIONS | List of operation IDs to filter (or empty for all) | |
USE_REMOTE | Boolean — generate remote vs resource methods (connector-tool default: false) | |
INTERACTIVE_MODE | Boolean — pause after each stage (connector-tool default: false) | |
EXCLUDED_STAGES | List of stage names to skip — valid values: sanitize, client, tests, examples, docs | |
SPEC_METADATA | JSON from parse_openapi_spec.py on the original spec (Stage 00) — the only spec representation in LLM context | |
ALIGNED_SPEC_METADATA | JSON from parse_openapi_spec.py on ALIGNED_SPEC, the post-flatten/align spec (Stage 01 onward) — authoritative for path keys, operationIds, and generated schema names |
Core Principles
Context hygiene: Never inject the raw OpenAPI spec into the LLM context. Always use the structured JSON output from scripts/parse_openapi_spec.py. When fixing code errors, read only the specific lines indicated by scripts/parse_errors.py.
Deterministic first: Use scripts for everything that doesn't require reasoning. Only use the LLM for: spec enhancement (naming, descriptions), code error repair, and content generation (examples, docs).
"2+1" prompting: For every required input, always offer exactly two contextual defaults plus a "custom value" option. See stages/00-setup.md for the pattern.
Transparency: Print a clear status line before each sub-step. Use ✓ for success, ⚠ for warnings, ✗ for failures.
Reference Files
references/workflows.md— Stage sequencing rules, error handling, final summary formatreferences/fix-procedure.md— Reusable compilation error fixer (invoked inline by client, tests, examples stages)templates/readme_template.md— Connector README scaffold for stage 05
Scripts Reference
All scripts are in <skill-root>/scripts/ and are pure Python (.py) — no shell scripts, so they run identically on macOS/Linux/Windows. Invoke them with <PYTHON_CMD> (resolved once in Setup Step 0), not a hardcoded python3.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-skills/skills/generating-connectors/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
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/ballerina-platform/ballerina-library/generating-connectors)