mockzilla
AGENTS.md8 starsChanged 2 months agoMITView on GitHub
Last updated: 2026-09-17 Scope: Next.js app under app/ with API routes and supporting libs under lib/, plus the dependency-free terminal client under cli/. This catalog defines callable agents, their capabilities, inputs/outputs, constraints, and cross-references to detailed docs in documentation/.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,266 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- gitnexus-cliSkill
- gitnexus-debuggingSkill
- gitnexus-exploringSkill
- gitnexus-guideSkill
- gitnexus-impact-analysisSkill
- gitnexus-refactoringSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
28 rules. About 0 are common, 5 are distinctive, and 23 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
23
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Always prefer to use docker(Makefile) to run over any scripts like migrate/migration, exec scripts inside the container.
- Distinctive: line 11
Always use Docker to get all context about server.
- Very specific: line 13
Docker Usage: Always prefer to use Docker (via Makefile) to run commands.
- Very specific: line 14
Local Checks: Run bun run typecheck and bun run lint locally from the repository root, not inside Docker.
- Very specific: line 15
Migrations: Always use bun run db:generate inside Docker (or make db-generate) to create migrations.
- Very specific: line 16
Bun: Use bun as the primary runtime and package manager inside Docker.
- Very specific: line 22
NEVER: use any type, ensure always creating types/interfaces or generic types or unknown.
- Very specific: line 23
Must use z.infer<typeof schema> to extract types from Zod schemas.
- Very specific: line 25
Use Agent Skills (.agent/skills/) for complex mocking or logic tasks.
- Very specific: line 117
Add/remove/edit variant cards
- Very specific: line 119
Visibility: Only shown when matchType === 'wildcard'
- Very specific: line 165
Create new mock via manage_mocks (action: create).
- Very specific: line 166
Update by id via manage_mocks (action: update).
- Very specific: line 167
Delete by id via manage_mocks (action: delete).
- Very specific: line 189
Create with slug generation via manage_folders (action: create).
- Very specific: line 191
Update by id with slug regeneration via manage_folders (action: update).
- Very specific: line 294
Use the CLI skill in terminal-only environments: run mockzilla agent-skill to render its current Markdown instructions.
- Very specific: line 295
Run mockzilla health, then resolve or create a folder before creating a mock.
- Very specific: line 296
Use JSON files or stdin for complex variants and JSON Schema payloads.
- Very specific: line 329
MUST run impact analysis before editing: Use impact({target: "symbolName", direction: "upstream"}) (MCP) or node .gitnexus/run.cjs impact …
- Very specific: line 330
MUST analyze graph changes before committing: Use detect_changes({scope: "all"}) (MCP) or node .gitnexus/run.cjs detect-changes --scope all …
- Distinctive: line 331
MUST warn the user: if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
- Very specific: line 333
When exploring unfamiliar code, use query({search_query: "concept"}) to find execution flows instead of grepping.
- Very specific: line 334
When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use context({name: …
- Distinctive: line 339
NEVER edit a function, class, or method before MCP/CLI impact analysis.
- Very specific: line 340
NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read UNKNOWN as an all-clear — it means the walk could not …
- Very specific: line 341
NEVER rename symbols with find-and-replace — use rename which understands the call graph.
- Distinctive: line 342
NEVER commit before MCP/CLI graph change analysis.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md 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
Mockzilla Agent
Last updated: 2026-09-17
Scope: Next.js app under app/ with API routes and supporting libs under lib/, plus the dependency-free terminal client under cli/. This catalog defines callable agents, their capabilities, inputs/outputs, constraints, and cross-references to detailed docs in documentation/.
Conventions
- Always prefer to use docker(Makefile) to run over any scripts like migrate/migration, exec scripts inside the container.
- You never use npm or yarn.
- MCP: Use
http://localhost:36666/api/mcpas the MCP endpoint. - Always use Docker to get all context about server.
- Makefile is the main entry point for all commands.
- Docker Usage: Always prefer to use Docker (via
Makefile) to run commands. Never run scripts likemigrateordb:generatelocally; execute them inside the container. - Local Checks: Run
bun run typecheckandbun run lintlocally from the repository root, not inside Docker. - Migrations: Always use
bun run db:generateinside Docker (ormake db-generate) to create migrations. - Bun: Use
bunas the primary runtime and package manager inside Docker. - Biome : Lint and prettier default
- Context Boundary: Each agent entry is self-contained; do not mix details across agents when prompting.
- Code References: Use
file_path:line_numberto jump precisely. - Terminology: "folder" groups mocks; "mock" is an individual endpoint response.
- Data Store: PostgreSQL via Drizzle; see
lib/db/schema.ts. - NEVER use
anytype, ensure always creating types/interfaces or generic types orunknown. - Must use
z.infer<typeof schema>to extract types from Zod schemas. - Always in the end update
documentation/folder with updated docs. - Use Agent Skills (
.agent/skills/) for complex mocking or logic tasks.
Index
- Mock Serving Agent
- Mocks CRUD Agent
- Folders CRUD Agent
- Import Agent
- Export Agent
- Schema Generator Agent
- API Client Agent
- Local Storage Agent
- Agent Skills Reference
- Mockzilla CLI Skill
- UI Component Architecture
- Observability & Forensic Agent
Observability & Forensic Agent
Tags: #logging #tracing #forensics #pino #ndjson
- Purpose: Inspect live traffic, debug matching logic, and perform forensic audits on stateful workflows.
- Implementation:
lib/logger.ts(Core),app/api/mock/[...path]/route.ts(Tracing entry). - Capabilities:
- Query application logs via
manage_logs(action:get) (search, level, type filters). - Perform end-to-end request reconstruction using
manage_logs(action:trace, reqId:reqId). - Analyze workflow matching failures via
workflow_control(action:test)'sexecutionTrace.
- Query application logs via
- Entry Points:
- MCP:
manage_logs(actions:get,trace,clear). - Workflow:
workflow_control(action:test) (enhanced output).
- MCP:
- Related Docs:
documentation/mcp.md(Logs section).
UI Component Architecture
Tags: #components #ui #mock-editor #refactoring
- Purpose: Modular, maintainable UI components for mock creation and editing.
- Last Updated: 2026-04-12
Component Hierarchy
MockEditor (orchestrator)
├── MockBasicFields (folder, name, method, status, path)
├── AdvancedOptions (query params, echo, delay, proxy)
├── ResponseConfig (match type, manual JSON, dynamic response, variants)
└── MockVariantManager (wildcard variants)MockEditor Component
- File:
components/mock-editor.tsx - Purpose: Main form orchestrator (~200 lines, reduced from 851)
- Responsibilities:
- Manages form state and submission
- Coordinates child components
- Handles validation and API calls
- Props:
mode,folders,initial,onSubmit,onCancel
AdvancedOptions Component
- File:
components/mock-advanced-options.tsx - Purpose: Non-response settings in the editor side menu
- Sections:
- Query Params Section: Dynamic key/value pair management
- Delivery Section: response delay and optional proxy target
- Echo Section: request-body echo for POST/PUT/PATCH
- Props:
method,queryParams,echoRequestBody,delay,proxyTargetUrl, and change handlers
ResponseConfig Component
- File:
components/mock-response-config.tsx - Purpose: Mock Response area in the editor
- Features:
- Match type selector (exact by default)
- Manual JSON and Dynamic Response source selector with only the active editor visible for exact and substring mocks
- Wildcard variants become the primary response editor when match type is wildcard
- Props:
response,jsonSchema,useDynamicResponse,matchType, and variant handlers
MockResponseSource Component
- File:
components/mock-response-source.tsx - Purpose: Shared response-source editor for base mocks and wildcard variants
- Features:
- Explicit Manual JSON / Dynamic Response source selector
- Inactive source editor stays hidden until selected
- Schema preview and JSON/text body type for static variants
- Dynamic variants force JSON output
MockVariantManager Component
- File:
components/mock-variant-manager.tsx - Purpose: Wildcard variant management
- Features:
- Require match toggle (404 vs fallback behavior)
- Add/remove/edit variant cards
- Each variant: capture key, status code, manual JSON or dynamic schema source
- Visibility: Only shown when
matchType === 'wildcard' - Props:
variants,onVariantsChange,requireMatch,onRequireMatchChange
Related Docs
documentation/component-architecture.md— detailed component documentation
Mock Serving Agent
Tags: #routing #mock #schema #echo #nextjs #drizzle #handlebars
- Purpose: Serve configured mock responses by folder slug and path; supports static JSON/text, request-body echo, and JSON Schema–driven dynamic responses.
- Entry Point:
app/api/mock/[...path]/route.ts- Path format:
/api/mock/{folderSlug}/{mockPath...}(app/api/mock/[...path]/route.ts:10) - Root path support:
/api/mock/{folderSlug}/or/api/mock/{folderSlug}treats mockPath as "/"
- Path format:
- Capabilities
- Hybrid Template Execution: Correctly handles both object-based type preservation and string-based Handlebars logic (app/api/mock/[...path]/route.ts).
- Resolve folder by slug, then match mock by
endpointandmethod(app/api/mock/[...path]/route.ts:19–37). - Echo request body back when
echoRequestBodyis enabled (app/api/mock/[...path]/route.ts:45–68). - Generate dynamic JSON from
jsonSchemawhenuseDynamicResponseis true (app/api/mock/[...path]/route.ts:70–91), fallback to static response if generation fails (app/api/mock/[...path]/route.ts:82–90). - Content type set by
bodyType(jsonortext) (app/api/mock/[...path]/route.ts:94–114).
- Inputs
- HTTP method:
GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS(lib/db/schema.ts:5–13). - Path segments:
folderSlug(required),mockPath(optional, defaults to "/") (app/api/mock/[...path]/route.ts:15–27). - DB tables:
folders,mockResponses(lib/db/schema.ts:20–27, 29–47).
- HTTP method:
- Outputs
NextResponsewith configuredstatusCodeand body; JSON or text perbodyType.
- Constraints
- Requires at least one segment: folder slug (app/api/mock/[...path]/route.ts:20–25).
jsonSchemamust parse as JSON when dynamic mode is enabled.
- Error Handling
- 404 when folder or mock not found (app/api/mock/[...path]/route.ts:22–24, 39–43).
- 500 on internal errors (app/api/mock/[...path]/route.ts:115–118).
- Related Docs
documentation/schema-interpolation.md— how{{$.path}}templates resolve.documentation/test-schemas.md— sample schemas for dynamic generation.
Mocks CRUD Agent
Tags: #crud #mock #pagination #drizzle #nextjs
- Purpose: Create, read, update, delete mock definitions; list with pagination.
- Entry Point:
app/api/mocks/route.ts - Capabilities
- List paginated with optional
folderIdviamanage_mocks(action:list). - Create new mock via
manage_mocks(action:create). Supports standard and schema-driven mocks. - Update by
idviamanage_mocks(action:update). - Delete by
idviamanage_mocks(action:delete). - Preview matching logic via
manage_mocks(action:preview).
- List paginated with optional
- Inputs
- Query:
id,folderId,page,limit. - Body:
ManageMocksArgs(lib/mcp/schemas/mocks.ts).
- Query:
- Outputs
- JSON with normalized fields:
id, name, path, method, response, statusCode, folderId, matchType, bodyType, enabled, jsonSchema, useDynamicResponse, echoRequestBody, createdAt, updatedAt.
- JSON with normalized fields:
- Constraints
pathshould start with/(validated in UI; see app/folder/[slug]/mock/[mockId]/page.tsx:47–51).jsonSchemamust be valid ifuseDynamicResponseis true.
- Error Handling
- 404 when target not found; 400 for missing
id; 500 on internal errors.
- 404 when target not found; 400 for missing
Folders CRUD Agent
Tags: #crud #folder #slug #drizzle #nextjs
- Purpose: Manage folders (groups of mocks) and pagination.
- Entry Point:
app/api/folders/route.ts - Capabilities
- List all, or paginated via
manage_folders(action:list). - Create with slug generation via
manage_folders(action:create). - Get by
idorslugviamanage_folders(action:get). - Update by
idwith slug regeneration viamanage_folders(action:update). - Delete by
idviamanage_folders(action:delete).
- List all, or paginated via
- Slug Rules
- Lowercase, trim, spaces→
-, non-alphanumerics removed (app/api/folders/route.ts:7–13).
- Lowercase, trim, spaces→
- Outputs
- JSON folder records with
id, name, slug, description, createdAt, updatedAt.
- JSON folder records with
Import Agent
Tags: #import #migration #legacy #drizzle
- Purpose: Import dataset of folders + mocks, with support for a legacy format.
- Entry Point:
app/api/import/route.ts - Capabilities
- Detect legacy format with
groups/rules(app/api/import/route.ts:14–16). - Convert legacy groups→folders and rules→mocks (app/api/import/route.ts:18–100).
- Transactional import of folders then mocks (app/api/import/route.ts:120–167).
- Detect legacy format with
- Inputs
- Body:
ExportDataor legacy format (LegacyImportFormat) (lib/types.ts).
- Body:
- Outputs
- JSON
{ success: boolean, imported: { folders, mocks } }.
- JSON
Export Agent
Tags: #export #snapshot #drizzle
- Purpose: Export all folders and mocks in a normalized structure.
- Entry Point:
app/api/export/route.ts - Capabilities
- GET all folders and mocks, map to export schema (app/api/export/route.ts:6–39).
- Outputs
ExportDatawith arrays of folders and mocks plusexportedAt.
Schema Generator Agent
Tags: #jsonschema #faker #templates #llm-context #handlebars
- Purpose: Generate sample JSON from JSON Schema and handle complex response templating using a Smart Hybrid Engine.
- Module:
lib/schema-generator.ts - Capabilities
- Smart Hybrid Engine: Automatically switches between Type-Preserving Interpolation (for valid JSON) and Handlebars (for logic/loops).
- Handlebars-First Workflows: Both Responses and Database Effects support full Handlebars power, including loops, conditionals, and Faker.
- Custom Helpers:
math(arithmetic),faker(dynamic data),eq/neq/gt/lt/gte/lte(comparisons). - Template interpolation using
{{$.path}}across the generated object and request context (lib/schema-generator.ts). Single-brace{$.path}is not resolved. - Validation helper
validateSchema. - Entry point:
generateFromSchema,replaceTemplates.
- Dependencies
handlebars,@faker-js/faker,json-schema-fakerintegration.
- Related Docs
documentation/schema-interpolation.mddocumentation/test-schemas.md
API Client Agent
Tags: #httpclient #external-api #env
- Purpose: Optional client for a remote Mockzilla API; maps server fields into local types.
- Module:
lib/api-client.ts - Configuration
- Base URL via
NEXT_PUBLIC_MOCKZILLA_API_BASE_URLorMOCKZILLA_API_BASE_URL(lib/api-client.ts:15–18).
- Base URL via
- Capabilities
- Folders: list/create/get/update/delete (lib/api-client.ts:63–107).
- Mocks: list/create/get/update/delete (lib/api-client.ts:109–174).
- Mapping
- Field mapping functions:
mapServerFolderToFolder,mapServerMockToMock(lib/api-client.ts:35–61).
- Field mapping functions:
Local Storage Agent
Tags: #storage #browser #fallback
- Purpose: Client-side localStorage helpers for folders and mocks.
- Module:
lib/storage.ts - Capabilities
getAll,add,update,deletefor both folders and mocks (lib/storage.ts:7–29, 31–53).
- Constraint: Only available in browser (
typeof window !== "undefined").
Agent Skills Reference
Tags: #skills #automation #creator #architect
- Purpose: Extend agent capabilities with specialized instruction sets located in
.agent/skills/. - Skills:
mockzilla-mock-maker: Expert for high-quality, high-fidelity data generation.mockzilla-workflow-architect: Expert for stateful API workflows and scenarios.mockzilla-spec-translator: Expert for rapid project bootstrapping from OpenAPI/Markdown specs.mockzilla-logic-doctor: Forensic specialist for debugging workflow matching and state.mockzilla-cli: CLI-only workflow for release checks, server configuration, folders/subfolders, mocks, import/export, OpenAPI import, variants, and serving checks.
- Usage: "Use [skill-name] to [task description]".
- Related Docs:
documentation/skills.md.
Data Model (Reference)
- Enums:
http_method,match_type,body_type(lib/db/schema.ts:5–18). - Tables:
folders,mock_responsesand relations (lib/db/schema.ts:20–59).
Prompting Patterns
- Use the CLI skill in terminal-only environments: run
mockzilla agent-skillto render its current Markdown instructions. - Run
mockzilla health, then resolve or create a folder before creating a mock. - Use JSON files or stdin for complex variants and JSON Schema payloads; use
--jsonfor machine-readable output. - Use Skills
- "Invoke
mockzilla-mock-makerskill to generate a complex E-commerce schema."
- "Invoke
- Serve a mock
- "Call Mock Serving Agent with method
GETat/api/mock/{folderSlug}/users/42".
- "Call Mock Serving Agent with method
- Create a mock
- "Use Mocks CRUD Agent to call
manage_mockswith actioncreatefor a JSON mock in folder{folderId}with path/users/{id}andstatusCode200".
- "Use Mocks CRUD Agent to call
- Generate dynamic sample
- "Use Schema Generator Agent with
generateFromSchemaStringand interpolate{ $.user.id }into summary field".
- "Use Schema Generator Agent with
- Perform Forensics
- "Use Observability & Forensic Agent to find why the last request to
/api/v1/ordersfailed usingmanage_logs." - "Invoke
manage_logswith actiontraceandreqId'abc-123' to audit state mutations."
- "Use Observability & Forensic Agent to find why the last request to
- Manage Workflows
- "Use
manage_scenariosto list existing scenarios." - "Use
workflow_controlwith actioninspectto check state for scenario 'auth-flow'."
- "Use
Additional References
- Reference Guide:
documentation/index.md. - UI docs page for interpolation examples:
app/docs/page.tsx. - DB client:
lib/db/index.ts(lib/db/index.ts:1–21). - MCP Integration:
documentation/mcp.md. - Extension Sync:
documentation/extension-sync.md(High-fidelity data transfer)
<!-- gitnexus:start -->GitNexus — Code Intelligence
This project is indexed by GitNexus as mockzilla (4349 symbols, 7150 relationships, 148 execution flows).
Index stale? Run
node .gitnexus/run.cjs analyze --index-onlyfrom the project root — it auto-selects an available runner. No.gitnexus/run.cjsyet? Bootstrap withnpx,bunx, orpnpm dlx— e.g.bunx gitnexus@latest analyze(npm 11 npx crash; #1939).
Always Do
- MUST run impact analysis before editing. Use
impact({target: "symbolName", direction: "upstream"})(MCP) ornode .gitnexus/run.cjs impact "symbolName" --direction upstream --repo .(CLI fallback); report callers, processes, and risk. Never substitute grep for graph analysis. - MUST analyze graph changes before committing. Use
detect_changes({scope: "all"})(MCP) ornode .gitnexus/run.cjs detect-changes --scope all --repo .(CLI fallback).partial: trueortruncated: trueis not a clean check — a zero means unseen, not unaffected; re-run it. For regression review:detect_changes({scope: "compare", base_ref: "main"})ornode .gitnexus/run.cjs detect-changes --scope compare --base-ref "main" --repo .. - MUST warn the user if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
- MUST treat
risk: UNKNOWNas unresolved, not as low. An empty caller set is not evidence the symbol is unused — it can also mean the callers are not resolvable by the index (plain-object property access, dynamic dispatch, cross-language calls).impactpairsUNKNOWNwith ariskNotesaying so. Confirm with a text search before treating the symbol as safe to change or delete; do not proceed on the strength of a zero. - When exploring unfamiliar code, use
query({search_query: "concept"})to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use
context({name: "symbolName"}). - For security review,
explain({target: "fileOrSymbol"})lists taint findings (source→sink flows; needsanalyze --pdg).
Never Do
- NEVER edit a function, class, or method before MCP/CLI impact analysis.
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read
UNKNOWNas an all-clear — it means the walk could not answer, which is the one verdict that requires confirming by other means. - NEVER rename symbols with find-and-replace — use
renamewhich understands the call graph. - NEVER commit before MCP/CLI graph change analysis.
Resources
| Resource | Use for |
gitnexus://repo/mockzilla/context | Codebase overview, check index freshness |
gitnexus://repo/mockzilla/clusters | All functional areas |
gitnexus://repo/mockzilla/processes | All execution flows |
gitnexus://repo/mockzilla/process/{name} | Step-by-step execution trace |
CLI
| Task | Read this skill file |
| Understand architecture / "How does X work?" | .claude/skills/gitnexus-exploring/SKILL.md |
| Blast radius / "What breaks if I change X?" | .claude/skills/gitnexus-impact-analysis/SKILL.md |
| Trace bugs / "Why is X failing?" | .claude/skills/gitnexus-debugging/SKILL.md |
| Rename / extract / split / refactor | .claude/skills/gitnexus-refactoring/SKILL.md |
| Tools, resources, schema reference | .claude/skills/gitnexus-guide/SKILL.md |
| Index, status, clean, wiki CLI commands | .claude/skills/gitnexus-cli/SKILL.md |
<!-- gitnexus:end -->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.

