Logo vun Mock Engine

Mock Engine

Organisatioun
addxai
mock-engine

Mock Engine local development environment management. Use for starting/stopping mock services, loading test data, creating test scenarios, and troubleshooting startup issues. Triggers when the user mentions "start mock", "mock environment", "local dev environment", "mock-up", "test data", or "test scenarios".

Iwwersiicht

Editeuraddxai
Repositoryenterprise-harness-engineering
Skill-Nummmock-engine
Stären
47
Forks
8
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum addxai op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Mock Engine an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/addxai/enterprise-harness-engineering/tree/main/skills/mock-engine
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/addxai/enterprise-harness-engineering.git /tmp/enterprise-harness-engineering
mkdir -p .claude/skills
cp -r /tmp/enterprise-harness-engineering/skills/mock-engine .claude/skills/mock-engine
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Mock Engine an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Mock Engine automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Mock Engine net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Mock Engine — Local Development Mock Environment Management

Provides unified mock infrastructure (MySQL, Redis, Kafka, MQTT, LocalStack, WireMock) via Docker Compose, supporting local development and integration testing.

Description

Applicable scenarios:

  • Start/stop mock environment: make mock-up one-command launch of all dependency services
  • Load test data: Base fixtures auto-load; scenario fixtures load on demand
  • Create test scenarios: Prepare preset data (SQL + Redis + WireMock stubs) for specific business flows
  • Troubleshoot startup issues: Container status checks, port conflicts, data loading failures
  • Integration testing: Manage mock infrastructure in automated tests via Java SDK or Go SDK

Prerequisites:

  • Docker Compose v2.20+ (verify with docker compose version)
  • A mock/ directory exists at the project root (containing docker-compose.yml and Makefile)
  • If there is no mock/ directory, initialize from the mock-engine template:
    bash
    cp -r /path/to/mock-engine/core/templates/mock/ ./mock/
    # Modify project configuration in mock/Makefile (database name, password, etc.)

Rules

Operational Flow

First-time initialization:

bash
cd mock/
make mock-init    # Download compose fragments

Start Mock environment:

bash
make mock-up      # Start all services + wait for health checks + load data
make mock-status  # Verify all services are running normally

Start the application (backend-service example):

bash
# The appName environment variable must be set
appName=your-app mvn spring-boot:run \
  -pl your-app \
  -Dspring-boot.run.profiles=dev-local,mock

Load a test scenario:

bash
make mock-scenario SCENARIO=user-registration
# View available scenarios:
ls fixtures/scenarios/

Stop/reset:

bash
make mock-down    # Stop services (preserve data)
make mock-clean   # Stop + delete data volumes
make mock-reset   # Full reset (clean + init + up)

Default Port Mapping

ServicePortEnvironment Variable Override
MySQL13306MOCK_MYSQL_PORT
Redis (business)16379MOCK_REDIS_BUSINESS_PORT
Redis (readonly)16380MOCK_REDIS_READONLY_PORT
Redis (event)16381MOCK_REDIS_EVENT_PORT
Kafka19092MOCK_KAFKA_PORT
MQTT11883MOCK_MQTT_PORT
LocalStack14566MOCK_LOCALSTACK_PORT
WireMock19999MOCK_WIREMOCK_PORT

Test Data Management

Base Fixtures (auto-loaded): Place in mock/fixtures/base/, executed in filename order:

fixtures/base/
├── 01-seed-users.sql        # INSERT test users
├── 02-seed-devices.sql      # INSERT test devices
└── 03-seed-data.sql         # INSERT test data

Scenario Fixtures (load on demand): One subdirectory per scenario:

fixtures/scenarios/user-registration/
├── data.sql                 # MySQL data
├── redis-cmds.txt           # Redis CLI commands (one per line)
└── stubs-override/          # WireMock stub overrides

redis-cmds.txt format:

# Comment line
SET user:1001:token abc123
HSET device:DEV001 status online
EXPIRE user:1001:token 3600

WireMock Stubs: Place in mock/stubs/<service-name>/:

json
{
  "request": {
    "method": "POST",
    "urlPath": "/stripe/v1/customers"
  },
  "response": {
    "status": 200,
    "jsonBody": { "id": "cus_mock_001" }
  }
}

Supports advanced features: conditional routing (queryParameters/bodyPatterns), dynamic templates (response-template), state machines (scenarioName), Webhook callbacks (serveEventListeners).

Common Troubleshooting

MySQL connection failed:

bash
docker ps --filter name=mock-mysql
docker logs mock-mysql
docker exec -e MYSQL_PWD=root123456 mock-mysql mysql -uroot -e "SELECT 1"

Bind mount not taking effect (Docker-in-Docker): SQL files not auto-loaded into MySQL:

bash
docker exec -e MYSQL_PWD=root123456 -i mock-mysql mysql -uroot < mock/sql/init-schema.sql

WireMock stubs not loaded:

bash
curl http://localhost:19999/__admin/mappings | python3 -m json.tool
docker cp mock/stubs/. mock-wiremock:/home/wiremock/mappings/
curl -X POST http://localhost:19999/__admin/mappings/reset

Spring Bean missing (CloudBeanCondition): Ensure the appName=your-app environment variable is set.

SDK Integration (Automated Testing)

Java (Testcontainers):

java
// pom.xml: <dependency>com.example:mock-engine</dependency>
MockInfraManager manager = MockInfraManager.fromProjectMockDir("./mock");
manager.startAll();
Map<String, String> props = manager.getAllProperties();

Go:

go
// go.mod: require gitlab.example.com/tools/mock-engine/go
infra := mockinfra.New(mockinfra.WithProjectDir("./mock"))
infra.Start(ctx)
defer infra.Stop(ctx)
infra.LoadScenario(ctx, "user-registration")

Examples

Bad Example

User: Help me start the mock environment
AI: Let me just docker compose up directly

docker compose up -d

# Then directly start the application
mvn spring-boot:run -pl your-app

Problems:

  • Did not enter the mock/ directory
  • Did not use make mock-init to initialize fragments
  • Did not use make mock-up (skips health checks and data loading)
  • Did not set appName environment variable or mock profile

Good Example

User: Help me start the mock environment
AI: OK, let me check the mock directory and start the environment.

cd mock/
# Check if already initialized
ls .fragments/Makefile.include 2>/dev/null || make mock-init
# Start and wait for all services to be ready
make mock-up
# Verify service status
make mock-status

# Start the application (with correct environment variable and profile)
cd ..
appName=your-app mvn spring-boot:run \
  -pl your-app \
  -Dspring-boot.run.profiles=dev-local,mock

# Verify health check
curl -s http://localhost:7777/actuator/health

Bad Example

User: I need to test the user registration flow
AI: Let me just call the registration API directly

curl -X POST http://localhost:7777/account/register \
  -H "Content-Type: application/json" \
  -d '{"email":"newuser@test.com"}'

Problems:

  • Did not load the test scenario data first
  • Did not provide an Authorization token
  • Missing required request parameters

Good Example

User: I need to test the user registration flow
AI: OK, let me load the registration test scenario data first, then test step by step.

# 1. Load user registration scenario data
cd mock/
make mock-scenario SCENARIO=user-registration

# 2. Login first to get an admin token
TOKEN=$(curl -s -X POST http://localhost:7777/account/login \
  -H "Content-Type: application/json" \
  -d '{"email":"testuser1@mock.local","password":"password","loginType":99}' \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['token'])")

# 3. Check if the email is available
curl -s -X POST http://localhost:7777/account/check-email \
  -H "Content-Type: application/json" \
  -H "Authorization: $TOKEN" \
  -d '{"email":"newuser@mock.local"}'

# 4. Execute registration
curl -s -X POST http://localhost:7777/account/register \
  -H "Content-Type: application/json" \
  -H "Authorization: $TOKEN" \
  -d '{"email":"newuser@mock.local","password":"Test@1234","nickname":"TestUser"}'

Related Resources

  • mock-engine repository: gitlab.example.com/tools/mock-engine
  • Design document: mock-engine/docs/specs/2026-03-20-mock-engine-generalization-design.md

Heefeg gestallte Froen

Wat mécht de KI-Skill Mock Engine?

Mock Engine local development environment management. Use for starting/stopping mock services, loading test data, creating test scenarios, and troubleshooting startup issues. Triggers when the user mentions "start mock", "mock environment", "local dev environment", "mock-up", "test data", or "test scenarios".

Firwat Mock Engine op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Mock Engine besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Mock Engine an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/addxai/enterprise-harness-engineering/tree/main/skills/mock-engine an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Mock Engine benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Mock Engine benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Mock Engine domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Mock Engine gratis?

Jo. De Skill gëtt vum addxai ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇