microcks-import-artifacts
Skill4 starsChanged 9 months agoApache-2.0View on GitHub
Import OpenAPI specifications into a running Microcks instance and auto-configure dispatchers based on vendor extensions. Provides shell script templates for importing specs, downloading microcks-cli, and setting up JSON_BODY or SCRIPT dispatchers.
- Installs packages
In this repository2 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Import OpenAPI specifications into Microcks and automatically configure dispatchers based on vendor extensions.
- Distinctive: line 13
Use this skill when:
- Very specific: line 16
Auto-configuring dispatchers: after writing a spec with x-mocking-microcks-dispatcher extensions
- Very specific: line 30
Create the mocking/ directory structure:
- Distinctive: line 44
Run the import script (this is the only command needed to import AND configure dispatchers):
- Distinctive: line 51
Check that Microcks is running
- Distinctive: line 53
Import the spec into Microcks
- Very specific: line 54
Read x-mocking-microcks-dispatcher vendor extensions
- Distinctive: line 65
Always inform the user and ask for confirmation before executing these scripts.
- Distinctive: line 71
Add this vendor extension at the operation level in your OpenAPI spec to indicate which dispatcher type to use:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Microcks Import Artifacts
Import OpenAPI specifications into Microcks and automatically configure dispatchers based on vendor extensions.
When to Use This Skill
Use this skill when:
- Importing an OpenAPI spec into a running Microcks instance for mocking
- Auto-configuring dispatchers after writing a spec with
x-mocking-microcks-dispatcherextensions - Setting up a repeatable import workflow with shell scripts
Prerequisites
- Docker installed and running
- Microcks started (use the
microcks-local-serverskill) - jq installed (
brew install jq/apt install jq) - curl installed
Quick Start
IMPORTANT: The import and dispatcher configuration MUST be done by running the import-openapi.sh shell script. Do NOT attempt to configure dispatchers manually via curl or the Microcks API — the script handles the full workflow (import, discriminant detection, Groovy script loading, API calls).
- Create the
mocking/directory structure:
mkdir -p mocking/dispatchers- Copy the template scripts into it:
cp templates/import-openapi.sh mocking/import-openapi.sh
cp templates/download-microcks-cli.sh mocking/download-microcks-cli.sh
chmod +x mocking/import-openapi.sh mocking/download-microcks-cli.sh- Run the import script (this is the only command needed to import AND configure dispatchers):
./mocking/import-openapi.sh path/to/your-api-spec.yamlThe script will:
- Check that Microcks is running
- Download
microcks-cliif not already cached - Import the spec into Microcks
- Read
x-mocking-microcks-dispatchervendor extensions - Auto-configure dispatchers via the Microcks API
Security Notice
This skill provides shell script templates that the user copies into their project. These scripts:
- Download an external binary (
microcks-clifrom GitHub releases of microcks/microcks-cli) - Run Docker containers (
mikefarah/yqfor YAML-to-JSON conversion, from mikefarah/yq) - Make network calls to the local Microcks REST API
Always inform the user and ask for confirmation before executing these scripts.
Vendor Extension: x-mocking-microcks-dispatcher
Add this vendor extension at the operation level in your OpenAPI spec to indicate which dispatcher type to use:
| Value | Microcks Dispatcher | Behavior |
json_body | JSON_BODY | Detects the discriminant field in request body examples; routes by field value |
script_header_error | SCRIPT | Routes on the error HTTP header: 400→invalid_input, 500→server_error, default→success |
script | SCRIPT | Loads an external Groovy script from mocking/dispatchers/{METHOD}-{path-slug}.groovy |
Example
paths:
/orders:
post:
x-mocking-microcks-dispatcher: json_body
# ...
/health:
get:
x-mocking-microcks-dispatcher: script_header_error
# ...
/payments:
post:
x-mocking-microcks-dispatcher: script
# ...Groovy File Convention
For operations using the script dispatcher, place Groovy files at:
mocking/dispatchers/{METHOD}-{path-slug}.groovyThe path slug is built by:
- Removing the leading
/ - Replacing
/with- - Removing
{and}
Examples:
| Operation | Groovy File |
POST /events | mocking/dispatchers/POST-events.groovy |
POST /v1/orders/{orderId}/payments | mocking/dispatchers/POST-v1-orders-orderId-payments.groovy |
GET /users | mocking/dispatchers/GET-users.groovy |
Script Templates
import-openapi.sh
The main import script. See templates/import-openapi.sh.
Usage:
# Basic usage (Microcks on default port 8080)
./mocking/import-openapi.sh path/to/api-spec.yaml
# Custom Microcks URL
MICROCKS_URL=http://localhost:9080 ./mocking/import-openapi.sh path/to/api-spec.yamlWhat it does:
- Validates the spec file argument
- Health-checks the Microcks instance
- Downloads
microcks-cliif not cached - Imports the spec via
microcks-cli - Converts YAML to JSON via
docker run mikefarah/yq - Finds operations with
x-mocking-microcks-dispatcher - Configures dispatchers via the Microcks REST API
- Prints the Microcks UI URL
download-microcks-cli.sh
Downloads and caches the microcks-cli binary. See templates/download-microcks-cli.sh.
Features:
- Multi-platform: macOS (Darwin) and Linux, amd64 and arm64
- Cached in
~/.local/bin/(shared across projects) - Version configurable via
MICROCKS_CLI_VERSIONenv var (default:0.5.6)
Complementary Skills
- microcks-local-server — Start a local Microcks server with Docker Compose
npx skills add emmanuelperu/microcks-skills --skill microcks-local-server - microcks-openapi-mocking — Write OpenAPI examples that work with Microcks dispatchers
npx skills add emmanuelperu/microcks-skills --skill microcks-openapi-mocking
Related
- Microcks Documentation: https://microcks.io/documentation
- Microcks CLI: https://github.com/microcks/microcks-cli
- mikefarah/yq: https://github.com/mikefarah/yq
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

