Agent Skill · APIMatic

apimatic-sdk

Use for any task involving APIMatic's SDK generation toolchain. Use when a user wants to generate, create, customize, download, or publish an SDK using the APIMatic CLI. Also use when the user has already customized a generated SDK and wants to save those changes, when the user wants to make a specific change to an SDK (e.g. "change the analyzer", "switch the linter"), when the user asks about CodeGen settings, SDK configuration, or APIMATIC-META.json (e.g. "enable retry on timeout", "disable linting", "set the project name"), or when the user wants to publish an SDK to a package registry or source repository, or wants to list publishing profiles.

Provider: APIMatic Path in repo: skills/apimatic-sdk/SKILL.md

Skill body

APIMatic SDK

Generate SDKs for your APIs in multiple languages using the APIMatic CLI.

When to Use

Red Flags — STOP and re-read the relevant section

Communication Guidelines

This skill is used by developers of all experience levels. All messages shown to the user must be clear, non-technical, and action-oriented. Follow these rules in every response:

Customize an SDK

Fast Path — Already-Customized SDK

If the user’s message indicates they have already made customizations to a generated SDK and want to save those changes (e.g. “I customized my SDK”, “I made changes to the generated SDK”, “save my SDK changes”, “save changes in it”):

  1. Confirm the Prerequisites section below is satisfied (Node.js, CLI installed).
  2. Complete Step 1: Authenticate with APIMatic below.
  3. Check for sdk-source-tree — see the SDK Source Tree Check section below.

Fast Path — Apply a Specific Customization to an SDK

If the user asks Claude to make a specific change to an SDK (e.g. “change the phan analyzer to something else”, “switch the linter in my PHP SDK”, “update the test framework in my TypeScript SDK”):

  1. Confirm the Prerequisites section below is satisfied (Node.js, CLI installed).
  2. Complete Step 1: Authenticate with APIMatic below.
  3. Check if the change is a CodeGen setting first — see the CodeGen Settings Check section below. If the change maps to a CodeGen setting, follow that path instead.
  4. If the change is not a CodeGen setting, check for sdk-source-tree — see the SDK Source Tree Check section below.

Do not ask whether the user wants to customize or save — they have already told you what change to make. Proceed without prompting unless something is genuinely unknown.

CodeGen Settings Check

Before editing any generated SDK files for a customization, check whether the change can be applied as a CodeGen setting in APIMATIC-META.json.

Read each of the following reference files one by one and check whether the requested change maps to a setting described in that file. Read all of them before deciding — pick the most suitable match:

If a matching setting is found in any of those files:

Follow the numbered steps in that reference file to apply the setting and verify the output. Then continue below:

  1. If the input directory is not already known, ask: “What is the path to the directory that contains the src/ folder?”
  2. Open <input-dir>/src/spec/APIMATIC-META.json. If this is a fresh project being scaffolded (the main Step 2 — Determine the input directory — is in progress), note the setting and apply it to APIMATIC-META.json as part of scaffolding — then continue to generation. If the file does not exist and the project should already have it, follow references/first-time-setup.md to scaffold the project first.
  3. Locate the CodeGenSettings object. Add or update the relevant key with the appropriate value.
  4. Save the file.
  5. Regenerate the SDK — proceed from Step 3 to Step 7, skip the steps for which you have the values already known (language, destination, and API version).

This is always the preferred approach when a CodeGen setting covers the request. Settings applied this way are baked into the generation config and survive every future regeneration — no manual file edits required.

If the setting is not listed there:

Continue to the SDK Source Tree Check for file-level customization.


SDK Source Tree Check

Look for <input-dir>/sdk-source-tree/ and within it a file named after the target language (e.g. .php, .typescript, .python).

If sdk-source-tree is present and has an entry for the target language:

Proceed directly to references/save-changes.md.

If sdk-source-tree is absent or has no entry for the target language:

Change tracking has never been initialized. Follow Steps 2 through 7 below to generate the SDK with --track-changes. Use any values already known from context (language, input dir, API version) — do not ask for them again. Only ask for values that are genuinely unknown.

There is one additional concern depending on context:

Customization Guidelines

Apply these principles whenever you are making SDK customizations on the user’s behalf, and share them as tips when the user is customizing themselves.

  1. Add custom logic in a new file where possible.
  2. Avoid editing generated files directly.
  3. If you must edit a generated file, add your changes at the top or bottom to reduce merge conflicts.
  4. Update the SDK README after every customization: After applying any customization, open the SDK’s README.md and add a section (or update an existing one) that describes what was customized and why. This keeps the SDK self-documenting so future developers know what changes were made intentionally.

Generate an SDK

These steps (Prerequisites through Step 7) are also used when initializing change tracking as part of a customization workflow.

Prerequisites

Confirm these are in place before starting:


Step 1: Authenticate with APIMatic

First check whether the user is already authenticated:

apimatic auth status

If the output shows an account email, authentication is already in place — skip to Step 2.

Primary flow (browser-based):

Run the auth launcher script from the project directory. It spawns apimatic auth login as a detached process so the terminal does not block:

node {skill_dir}/scripts/auth-login.mjs

Where {skill_dir} is the absolute path to the directory containing the apimatic-sdk skill file (the auth-login.mjs script lives there).

The script launches the browser OAuth flow and immediately returns. Relay the following message to the user: “A browser window has opened. Complete sign-in in the browser, then confirm here when done.”

Wait for the user to confirm sign-in is complete before proceeding.

After confirmation, verify auth succeeded:

apimatic auth status

The output should show the account email. If it does not, authentication did not complete — try the fallback below.

Fallback flow (API key):

Use this when browser auth is not available (CI environment, headless system) or when the user prefers a key-based approach.

Option 1 — CLI flag:

apimatic auth login --auth-key=YOUR_API_KEY

Option 2 — environment variable (no login command needed):

# macOS / Linux / bash / zsh:
export APIMATIC_API_KEY=YOUR_API_KEY

# Windows PowerShell:
$env:APIMATIC_API_KEY = "YOUR_API_KEY"

# Windows Command Prompt:
set APIMATIC_API_KEY=YOUR_API_KEY

API keys are generated at: APIMatic Dashboard > Account > API Keys.

If both methods fail:

Stop the workflow. Tell the user:

“Authentication failed. Check that your APIMatic account is active, your API key is correct, and you have internet access to apimatic.io. If using browser login, try the –auth-key fallback instead.”

Do not proceed past this point until authentication is confirmed.

Step 2: Determine the input directory

If you do not know whether the user has an existing project with a src/ folder, ask:

“Is this your first time generating an SDK for this API, or have you generated one before?”

Step 3: Choose the language

If the language is not already known from context, ask the user which language they want to generate the SDK in. Present the supported options:

Flag value Language
csharp C#
java Java
php PHP
python Python
ruby Ruby
typescript TypeScript
go Go

Step 4: Choose the destination

If the destination is not already known from context, ask: “Do you have a specific path where you want the SDK to be generated, or should I use the default location?”

Step 5: Choose the API version

Check whether the user wants to generate the SDK for a specific API version. Look for phrases like “versioned build”, “specific version”, “for version X”, “v2”, “api version”, or any mention of targeting a particular version of their API.

Step 6: Customization intent

If the user has already described a specific change they want (e.g., “remove the docs folder”, “disable documentation”, “set the project name”, “disable linting”), check codegen settings first — see the CodeGen Settings Check section, which will have you scan the individual reference files — before planning any manual file edits or deletions or additions.

If the change maps to a CodeGen setting:

Never plan to apply a CodeGen-covered customization by manually editing or deleting or adding generated files. For example, “remove the docs folder” maps to DisableDocs: true — the correct fix is to set it before generation, not to delete the output folder afterward as a custom code injection.

If the change does not map to any CodeGen setting, continue below.

If not already known from context, ask: “Would you like to customize the SDK after generating it? (e.g., add custom code, modify generated files)”

Step 7: Generate the SDK

Navigate to the project root (the directory that contains src/):

cd your-project-directory

Run the generate command with the chosen language:

apimatic sdk generate --language=<language>

To specify the input directory explicitly (the parent directory containing src/):

apimatic sdk generate --input=path/to/parent-of-src --language=<language>

With an API key directly (recommended for CI — no interactive auth needed):

apimatic sdk generate --input=path/to/parent-of-src --language=<language> --auth-key=YOUR_API_KEY

If SDK generation fails:

  1. Authentication error: Re-run apimatic auth status to verify. If expired, re-authenticate (Step 1).
  2. Missing src/ folder or spec file: Check that the input directory contains a src/ folder with the API spec in src/spec/.
  3. SDK already exists at destination: The CLI will refuse to overwrite. Immediately ask the user: “An SDK already exists at the destination. Would you like to overwrite it?” If yes, re-run the same command with --force appended (see Additional flags). If no, ask for a different destination path and re-run with --destination=<new-path>.
  4. apimatic command not found: Run npm install -g @apimatic/cli and verify with apimatic --version.
  5. Any other error: Read the exact error message from the CLI output. Do not retry automatically — diagnose the specific error first.

Additional flags

Publish an SDK

Only follow this section when the user explicitly requests publishing (e.g., “publish the SDK”, “push to npm”, “push to GitHub”, “run sdk publish”). Phrases like “generate an SDK for publishing” or “generate for npm” express intent but are not publish instructions — stop at SDK generation in those cases.

Publish an SDK to a package registry (npm, PyPI, NuGet) or source code repository (GitHub) using a publishing profile configured in the APIMatic App.

Step 1: Authenticate with APIMatic

Follow Step 1: Authenticate with APIMatic above.

Step 2: Find the Publishing Profile ID

If the user does not already know their profile ID, run:

apimatic publishing profile list

This lists all publishing profiles with their names, IDs, and enabled languages. Do not forward the raw table output to the user — summarize the available profiles and their IDs in plain language so the user can identify the one they want.

Step 3: Choose the destination

If the destination is not already known from context, ask: “Do you have a specific path where you want the SDK to be generated, or should I use the default location?”

Step 4: Run SDK Publish

See examples/publish-sdk.md for the expected command and output — flags and paths will differ based on the user’s setup.

Non-interactive flow requires all four of these flags — missing any one will drop the CLI into the interactive prompt:

apimatic sdk publish --profile-id=<profile-id> --language=<language> --version=<version> --publish-type=<type> --force

Always include --force to avoid the CLI prompting about an existing destination.

Flags

Flag Required (non-interactive) Description
--profile-id, -p Yes ID of the publishing profile to use. Run apimatic publishing profile list to find your profile ID.
--language, -l Yes SDK language to generate and publish.
--version, -v Yes Semantic version of the SDK (e.g. 1.0.0).
--publish-type Yes (at least one) Publishing target(s): package or sourcecode only. Can be specified multiple times. See Publish Types.
--input No Path to the parent directory containing the src/ directory. Defaults to ./.
--destination No Directory where the generated SDK will be saved locally. Defaults to <input>/sdk.
--dry-run No Generate the SDK locally for review without publishing.
--force, -f No Overwrite existing output without prompting.

Publish Types

Pass --publish-type once or twice to target one or both destinations. The language and publish type(s) must be configured in the publishing profile.

# Publish to package registry only
apimatic sdk publish --profile-id=<id> --language=java --version=2.0.0 --publish-type=package --force

# Publish to both package registry and source repository
apimatic sdk publish --profile-id=<id> --language=typescript --version=1.0.0 --publish-type=package --publish-type=sourcecode --force

Dry Run

Use --dry-run to generate the SDK locally and inspect it before publishing:

apimatic sdk publish --dry-run --profile-id=<id> --language=python --version=1.0.0 --publish-type=package

After SDK Publish Completes (Success or Failure)

After the command finishes — regardless of whether it succeeded or failed — scan the CLI output for a logs URL. It looks like:

https://dash.apimatic.io/publish/<publish-id>/logs/<log-id>

Always show it to the user with this exact message (substituting the actual URL):

You can view the full publishing logs here:

This step is mandatory — never skip it regardless of success or failure.

If SDK Publish Fails

  1. Profile not found or invalid ID: Run apimatic publishing profile list to confirm the correct profile ID.
  2. Language or publish type not supported by profile: The language and publish type(s) must be enabled in the publishing profile. Check the profile configuration in the APIMatic App.
  3. Authentication error: Re-run apimatic auth status and re-authenticate if needed.
  4. Any other error: Read the exact error message from the CLI output. Do not retry automatically — diagnose the specific error first and ask the user before retry.