Skip to main content

Generate and Publish Context Plugins from the APIMatic CLI

· 3 min read

The APIMatic CLI can now build a context plugin from your published SDKs and hand you the commands that publish it to GitHub. Two new commands do the work: apimatic plugin generate and apimatic plugin publish.

You may be aware of our context plugins for codegen v3, which came bundled with the generated API portal. The ones described here are for codegen v4, our new, modern SDKs. This newer kind is a separate thing: a local artifact made of skill files, serving the same purpose with more control over what it covers and who you hand it to.

What you get

The generated plugin is a .claude-plugin/plugin.json manifest alongside a set of skills for each language you have published an SDK for. Claude Code, VS Code, and Cursor can all load it. The skills cover the parts of an integration that are easy to get wrong from model memory alone, including client initialization, authentication, calling endpoints, building and reading models, error handling, configuration and resilience, and testing.

Because the skills are generated from your API specification and your published SDK, your AI coding agent writes integration code against the SDK you actually shipped rather than against whatever it recalls from training data.

Generate a plugin

Publish an SDK first. Publishing is what tells the plugin which languages to cover, so a project with no published SDK has nothing to generate from.

apimatic plugin generate

apimatic plugin generate asks for the three things it can't derive: an ID for the plugin (lower-case words separated by single dashes, such as acme-payments), a display name, and a version. It then generates the plugin and writes it to ./plugin.

Every SDK the plugin covers has to be published to GitHub, so include source code publishing (--publish-type=sourcecode) when you publish each one. The plugin points AI agents at that GitHub repository for the SDK source code: a language recorded from a package-only publish carries no repository for the plugin to use, and the CLI warns you when it finds one. See the SDK Publishing Overview for how publishing works.

Publish it to GitHub

apimatic plugin publish

apimatic plugin publish prints the git commands that publish your plugin to a GitHub repository, and stops there. It never touches your repository, creates nothing, and pushes nothing. You review the sequence and run it yourself.

Before the commands, it reports what's about to become public, as a file and directory count. The repository it proposes is public, so this is your chance to look at the plugin directory before anything leaves your machine.

Try it out

Install the latest CLI:

npm install -g @apimatic/cli@latest

For the full list of flags and options, see Plugin Commands.