/interface-designer:mockifyfrom interface-designer
Clone a real production React app into the design/ folder and convert it to use mock data + bypassed auth
Ships in interface-designer. Installing the plugin adds it to Claude Code.
Arguments: $ARGUMENTS
Format: {source-path} {project-name}
| Argument | Required | Description |
|---|---|---|
source-path | Yes | Path to the real production React app (relative to workspace root or absolute), e.g. projects/cambre/cambre-react |
project-name | Yes | Name for the design folder, e.g. cambre → will live at design/cambre/ |
Example:
/interface-designer:mockify projects/cambre/cambre-react cambre
This command takes a real, production React app (typically pulled from a Bitbucket monorepo) and produces a self-contained design mock in design/{project-name}/. The mock keeps the real app's components, pages, queries, mutations, types, and routing intact — only the edges are replaced:
/api/* callsThis means the design mock looks and behaves exactly like UAT for the user, but runs entirely client-side from in-memory data the designer controls. We get production parity for design iteration without needing a real backend.
This command does NOT:
source-path to an absolute path. If it doesn't exist, error.package.json and src/ — error if not (this isn't a React app).design/{project-name}/ does NOT exist — if it does, ask the user whether to abort, rename, or overwrite (default: abort).package.json and note:
pnpm-lock.yaml, yarn.lock, package-lock.json)@auth0/auth0-react, @okta/okta-react, firebase, custom, none)react-router-dom, @tanstack/react-router)@tanstack/react-query, swr, plain fetch)jsonapi-zod-query, jsona, custom)source-path → design/{project-name}/ recursively, EXCLUDING:
.git/ (we'll re-init)node_modules/ (we'll re-install)dist/, build/, .vite/, .cache/cdk/, bitbucket-pipelines.yml, Dockerfile, lefthook.yml, commitlint.config.cjs, renovate.json (deployment + CI infra not relevant for a mock).env (we'll create a new design-mock-friendly one)*.timestamp-*.mjs Vite leftover filesrsync --exclude or equivalent. Don't recreate everything by hand.The strategy depends on what auth library is detected:
@auth0/auth0-react)useAuth0: create src/__mocks__/auth0.ts that re-exports a useAuth0 returning a fake authenticated user:
export const useAuth0 = () => ({
isAuthenticated: true,
isLoading: false,
user: { sub: 'mock|designer', email: '[email protected]', name: 'Design User' },
getAccessTokenSilently: async () => 'mock-token',
loginWithRedirect: async () => {},
logout: async () => {},
});
export const Auth0Provider = ({ children }: { children: React.ReactNode }) => <>{children}</>;
@auth0/auth0-react to that stub in vite.config.ts:
resolve: {
alias: {
'@auth0/auth0-react': path.resolve(__dirname, 'src/__mocks__/auth0.ts'),
},
},
(This way the existing import { useAuth0 } from '@auth0/auth0-react' calls work unchanged.)AuthGuard component: replace its body with a passthrough that just renders children.useAuthenticatedFetch hook (or similar — search src/hooks/ for files matching *auth*fetch* or *fetch*auth*): replace with a passthrough:
export default function useAuthenticatedFetch() {
return window.fetch.bind(window);
}
Auth0Provider setup from main.tsx OR rely on the aliased stub (preferred — touches fewer lines).Apply the same pattern: stub the hook(s), alias the package or replace the hook file, replace any AuthGuard/ProtectedRoute component with a passthrough. Ask the user if the pattern isn't obvious from the codebase.
Skip this step.
src/queries/ and src/mutations/ (or wherever query hooks live). For each file, extract:
useQuery({ queryKey: [...] }))apiUrl(\/case/by-id/${id}`)`)case, person, employee, place, task, template, notification).design/{project-name}/.mockify/resource-inventory.json for later reference. This file documents what handlers need to exist for full coverage.msw to devDependencies in package.json (use the latest 2.x version).design/{project-name}/src/mocks/
├── browser.ts # setupWorker + start
├── handlers/
│ ├── index.ts # exports all handlers
│ └── {resource}.ts # one file per resource type detected in step 4
├── data/
│ ├── index.ts # in-memory store + reset helpers
│ └── {resource}.ts # seed data + CRUD helpers for one resource
└── jsonapi.ts # helpers for building JSON:API responses (if jsonapi-zod-query was detected)
browser.ts:
import { setupWorker } from 'msw/browser';
import { handlers } from './handlers';
export const worker = setupWorker(...handlers);
case.ts:
import { http, HttpResponse } from 'msw';
import { cases } from '../data/case';
import { caseToJsonApi } from '../jsonapi';
export const caseHandlers = [
http.get('*/case/by-id/:id', ({ params }) => {
const c = cases.find(x => x.id === params.id);
if (!c) return HttpResponse.json({ errors: [{ status: '404' }] }, { status: 404 });
return HttpResponse.json(caseToJsonApi(c));
}),
// ... one entry per URL pattern from inventory
];
export type Case = { id: string; /* ... infer fields from the zod schema if possible */ };
export const cases: Case[] = []; // designer fills in
export const findCase = (id: string) => cases.find(c => c.id === id);
export const upsertCase = (c: Case) => { /* ... */ };
export const removeCase = (id: string) => { /* ... */ };
jsonapi-zod-query, generate jsonapi.ts with a toJsonApi(resource, type, relationships?) helper that wraps a plain object in the JSON:API envelope.npx msw init public/ --save (or equivalent) AFTER pnpm install completes — this creates public/mockServiceWorker.js.src/main.tsx so MSW starts BEFORE React renders, in dev mode only:
async function bootstrap() {
if (import.meta.env.DEV) {
const { worker } = await import('./mocks/browser');
await worker.start({ onUnhandledRequest: 'warn' });
}
// ... existing createRoot(...).render(...) goes here
}
bootstrap();
onUnhandledRequest: 'warn' is set (not 'error') so unhandled API calls show a console warning instead of breaking the app while the designer adds handlers..env with mock-friendly values:
VITE_APP_API_ENDPOINT=http://localhost:5173/api
# Auth0 values are not used (stubbed) but kept so any reads don't crash
VITE_APP_AUTH0_DOMAIN=mock.local
VITE_APP_AUTH0_CLIENT_ID=mock-client-id
VITE_APP_AUTH0_AUDIENCE=mock-audience
vite.config.ts, ensure server.port is unset (or set to 5173) so the default port is used.pnpm install (or npm install / yarn).npx msw init public/ --save to create public/mockServiceWorker.js.git init in design/{project-name}/.CHANGELOG.md:
# {Project Name} — Design Mock Changelog
## Mockified from {source-path} — {date}
- Cloned real production app from `{source-path}` into `design/{project-name}/`
- Stripped deployment infra: cdk/, bitbucket-pipelines.yml, Dockerfile, lefthook.yml, commitlint.config.cjs, renovate.json
- Auth: {scheme-detected} → stubbed (see src/__mocks__/auth0.ts and aliased in vite.config.ts)
- Data: added MSW with handlers scaffolded for: {list resource types from inventory}
- Ready for iterative design prompts. See `.mockify/resource-inventory.json` for the full handler inventory.
feat: mockify {project-name} from {source-path}.Same as /adopt:
.claude/test-sites.json for a designRepo entry for this project.origin. If not, ask the user.Same as /adopt: check .mcp.json for the chrome-devtools MCP entry; add it if the user wants.
${CLAUDE_PLUGIN_ROOT}/agents/interface-designer.md. A production app keeps its resource types in the query layer, so point include there (erd({ include: ["src/queries"] }) for a JSON:API client). The ERD reads resource types such as ReturnType<typeof deserializeOne>["data"], unwraps a type that is the whole document, skips a ListX row when a full X type exists (and draws the row when it is the resource's only type), and links relationship fields whose name matches an entity exactly (employee, shipment). Tags on the Zod schema properties reach the diagram. Expect a first round of warnings for role-named ids (bdOwnerId, assignedBoxId, createdById): trace each one to the store its seed values live in before tagging it, and ask the user about any you cannot prove.pnpm start (or detected dev command) in the background./erd on the same port.Report to the user:
design/{project-name}/.mockify/resource-inventory.json/erd), its [erd] summary, and the link questions waiting on the userAfter this, the normal /interface-designer:resume and /interface-designer:revert commands work.
After the initial scaffold lands, the iterative loop is:
/api/* calls were unhandled or returned the placeholder 404.src/mocks/data/{resource}.ts and fill in the handler in src/mocks/handlers/{resource}.ts.Goal: every page in the production app renders with realistic data and every write path persists in-memory.
npx msw init public/. Symptom: requests hit the real backend (which isn't running) and fail. Fix: run the init command.@auth0/auth0-react to the stub.jsonapi-zod-query (data/relationships/included envelope). Check jsonapi.ts and compare to what useFetchCase (or similar) expects.http + HttpResponse API), not 1.x (rest API)..mockify/resource-inventory.json up to date when adding new endpoints — it's the source of truth for coverage.src/mocks/data/{resource}.ts like a database fixture file — make it realistic, varied, and large enough to exercise pagination and filters.Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
6 commands in this plugin
/adoptInterface Designer — Adopt ProjectAdopt an existing React app already sitting in design/{name} into the design-mock workflow: git init, CHANGELOG.md conversation history, dev server + Chrome DevTools screenshot loop. For Astro/CMS codebases use /cms-designer:adopt./genai-demoInterface Designer — GenAI DemoBuild a pitch demo for the Rapid GenAI Assessment program - replicate a client's existing FileMaker or Salesforce interface in React from screenshots, then overlay suggested AWS AI implementations as a guided tour. Use when preparing a GenAI opportunity pitch for an existing client; for a normal design mock use /interface-designer:new./newInterface Designer — New Projectnpx claudepluginhub soliantconsulting/interface-designer --plugin interface-designer