agentleFS
andrecrjrandrecrjr/mockzilla/AGENTS.md

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.

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
  1. Distinctive:

    Always prefer to use docker(Makefile) to run over any scripts like migrate/migration, exec scripts inside the container.

    line 8
  2. Distinctive:

    Always use Docker to get all context about server.

    line 11
  3. Very specific:

    Docker Usage: Always prefer to use Docker (via Makefile) to run commands.

    line 13
  4. Very specific:

    Local Checks: Run bun run typecheck and bun run lint locally from the repository root, not inside Docker.

    line 14
  5. Very specific:

    Migrations: Always use bun run db:generate inside Docker (or make db-generate) to create migrations.

    line 15
  6. Very specific:

    Bun: Use bun as the primary runtime and package manager inside Docker.

    line 16
  7. Very specific:

    NEVER: use any type, ensure always creating types/interfaces or generic types or unknown.

    line 22
  8. Very specific:

    Must use z.infer<typeof schema> to extract types from Zod schemas.

    line 23
  9. Very specific:

    Use Agent Skills (.agent/skills/) for complex mocking or logic tasks.

    line 25
  10. Very specific:

    Add/remove/edit variant cards

    line 117
  11. Very specific:

    Visibility: Only shown when matchType === 'wildcard'

    line 119
  12. Very specific:

    Create new mock via manage_mocks (action: create).

    line 165
  13. Very specific:

    Update by id via manage_mocks (action: update).

    line 166
  14. Very specific:

    Delete by id via manage_mocks (action: delete).

    line 167
  15. Very specific:

    Create with slug generation via manage_folders (action: create).

    line 189
  16. Very specific:

    Update by id with slug regeneration via manage_folders (action: update).

    line 191
  17. Very specific:

    Use the CLI skill in terminal-only environments: run mockzilla agent-skill to render its current Markdown instructions.

    line 294
  18. Very specific:

    Run mockzilla health, then resolve or create a folder before creating a mock.

    line 295
  19. Very specific:

    Use JSON files or stdin for complex variants and JSON Schema payloads.

    line 296
  20. Very specific:

    MUST run impact analysis before editing: Use impact({target: "symbolName", direction: "upstream"}) (MCP) or node .gitnexus/run.cjs impact …

    line 329
  21. Very specific:

    MUST analyze graph changes before committing: Use detect_changes({scope: "all"}) (MCP) or node .gitnexus/run.cjs detect-changes --scope all …

    line 330
  22. Distinctive:

    MUST warn the user: if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.

    line 331
  23. Very specific:

    When exploring unfamiliar code, use query({search_query: "concept"}) to find execution flows instead of grepping.

    line 333
  24. Very specific:

    When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use context({name: …

    line 334
  25. Distinctive:

    NEVER edit a function, class, or method before MCP/CLI impact analysis.

    line 339
  26. Very specific:

    NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read UNKNOWN as an all-clear — it means the walk could not …

    line 340
  27. Very specific:

    NEVER rename symbols with find-and-replace — use rename which understands the call graph.

    line 341
  28. Distinctive:

    NEVER commit before MCP/CLI graph change analysis.

    line 342

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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/mcp as 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 like migrate or db:generate locally; execute them inside the container.
  • Local Checks: Run bun run typecheck and bun run lint locally from the repository root, not inside Docker.
  • Migrations: Always use bun run db:generate inside Docker (or make db-generate) to create migrations.
  • Bun: Use bun as 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_number to jump precisely.
  • Terminology: "folder" groups mocks; "mock" is an individual endpoint response.
  • Data Store: PostgreSQL via Drizzle; see lib/db/schema.ts.
  • NEVER use any type, ensure always creating types/interfaces or generic types or unknown.
  • 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)'s executionTrace.
  • Entry Points:
    • MCP: manage_logs (actions: get, trace, clear).
    • Workflow: workflow_control (action: test) (enhanced output).
  • 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 "/"
  • 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 endpoint and method (app/api/mock/[...path]/route.ts:19–37).
    • Echo request body back when echoRequestBody is enabled (app/api/mock/[...path]/route.ts:45–68).
    • Generate dynamic JSON from jsonSchema when useDynamicResponse is 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 (json or text) (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).
  • Outputs
    • NextResponse with configured statusCode and body; JSON or text per bodyType.
  • Constraints
    • Requires at least one segment: folder slug (app/api/mock/[...path]/route.ts:20–25).
    • jsonSchema must 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 folderId via manage_mocks (action: list).
    • Create new mock via manage_mocks (action: create). Supports standard and schema-driven mocks.
    • Update by id via manage_mocks (action: update).
    • Delete by id via manage_mocks (action: delete).
    • Preview matching logic via manage_mocks (action: preview).
  • Inputs
    • Query: id, folderId, page, limit.
    • Body: ManageMocksArgs (lib/mcp/schemas/mocks.ts).
  • Outputs
    • JSON with normalized fields: id, name, path, method, response, statusCode, folderId, matchType, bodyType, enabled, jsonSchema, useDynamicResponse, echoRequestBody, createdAt, updatedAt.
  • Constraints
    • path should start with / (validated in UI; see app/folder/[slug]/mock/[mockId]/page.tsx:47–51).
    • jsonSchema must be valid if useDynamicResponse is true.
  • Error Handling
    • 404 when target not found; 400 for missing id; 500 on internal errors.

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 id or slug via manage_folders (action: get).
    • Update by id with slug regeneration via manage_folders (action: update).
    • Delete by id via manage_folders (action: delete).
  • Slug Rules
    • Lowercase, trim, spaces→-, non-alphanumerics removed (app/api/folders/route.ts:7–13).
  • Outputs
    • JSON folder records with id, name, slug, description, createdAt, updatedAt.

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).
  • Inputs
    • Body: ExportData or legacy format (LegacyImportFormat) (lib/types.ts).
  • Outputs
    • JSON { success: boolean, imported: { folders, mocks } }.

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
    • ExportData with arrays of folders and mocks plus exportedAt.

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-faker integration.
  • Related Docs
    • documentation/schema-interpolation.md
    • documentation/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_URL or MOCKZILLA_API_BASE_URL (lib/api-client.ts:15–18).
  • 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).

Local Storage Agent

Tags: #storage #browser #fallback

  • Purpose: Client-side localStorage helpers for folders and mocks.
  • Module: lib/storage.ts
  • Capabilities
    • getAll, add, update, delete for 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_responses and relations (lib/db/schema.ts:20–59).

Prompting Patterns

  • Use the CLI skill in terminal-only environments: run mockzilla agent-skill to 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 --json for machine-readable output.
  • Use Skills
    • "Invoke mockzilla-mock-maker skill to generate a complex E-commerce schema."
  • Serve a mock
    • "Call Mock Serving Agent with method GET at /api/mock/{folderSlug}/users/42".
  • Create a mock
    • "Use Mocks CRUD Agent to call manage_mocks with action create for a JSON mock in folder {folderId} with path /users/{id} and statusCode 200".
  • Generate dynamic sample
    • "Use Schema Generator Agent with generateFromSchemaString and interpolate { $.user.id } into summary field".
  • Perform Forensics
    • "Use Observability & Forensic Agent to find why the last request to /api/v1/orders failed using manage_logs."
    • "Invoke manage_logs with action trace and reqId 'abc-123' to audit state mutations."
  • Manage Workflows
    • "Use manage_scenarios to list existing scenarios."
    • "Use workflow_control with action inspect to check state for scenario 'auth-flow'."

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-only from the project root — it auto-selects an available runner. No .gitnexus/run.cjs yet? Bootstrap with npx, bunx, or pnpm 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) or node .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) or node .gitnexus/run.cjs detect-changes --scope all --repo . (CLI fallback). partial: true or truncated: true is not a clean check — a zero means unseen, not unaffected; re-run it. For regression review: detect_changes({scope: "compare", base_ref: "main"}) or node .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: UNKNOWN as 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). impact pairs UNKNOWN with a riskNote saying 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; needs analyze --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 UNKNOWN as 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 rename which understands the call graph.
  • NEVER commit before MCP/CLI graph change analysis.

Resources

ResourceUse for
gitnexus://repo/mockzilla/contextCodebase overview, check index freshness
gitnexus://repo/mockzilla/clustersAll functional areas
gitnexus://repo/mockzilla/processesAll execution flows
gitnexus://repo/mockzilla/process/{name}Step-by-step execution trace

CLI

TaskRead 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 -->

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.