一键导入
unit-test
Unit testing workflow with Vitest and React Testing Library. Use when writing, running, or debugging unit tests for Studio components and utilities.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Unit testing workflow with Vitest and React Testing Library. Use when writing, running, or debugging unit tests for Studio components and utilities.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use NeMo Safe Synthesizer from the NMP plugin through task-specific routing: host-local GPU runs, platform job submission, configuration, troubleshooting, artifacts, privacy settings, PII replacement, and evaluation reports. Use when the user asks about safe-synthesizer, NeMo Safe Synthesizer, synthetic tabular data, DP settings, generation failures, plugin-local runs, filesets, model filesets, or `nemo safe-synthesizer` CLI commands.
Fine-tune models on NeMo Platform with `automodel`, `unsloth`, or `rl` (all `submit`-only): HF dataset conversion, filesets, model entities, and job JSON (hyperparameters, batch, schedule, optimizer) + job polling. `automodel`/`unsloth` run SFT/LoRA as Docker GPU jobs; `rl` runs DPO (preference optimization) on a Ray cluster (Kubernetes). Use for train, fine-tune, customize, SFT, LoRA, DPO, preference optimization, learning rate, epochs, or nemo customization.
Creates a new NeMo plugin from scratch. Use when starting plugin development, setting up a plugin package, registering surfaces via entry points, or asking how plugins are discovered by the platform. Trigger keywords: create plugin, new plugin, plugin setup, entry-points, plugin structure, get started, plugin discovered, entry point.
Declares HTTP authorization on NeMo Platform plugin routes with @path_rule, AuthzScope, PermissionSet, and CallerKind. Use when adding or securing a plugin route, minting permission ids, choosing PRINCIPAL vs SERVICE_PRINCIPAL callers, fixing a hard_fail bundle build from an unruled route, or migrating off get_authz_contribution. Trigger keywords: authz, authorization, permission, path_rule, AuthzScope, PermissionSet, perm, CallerKind, SERVICE_PRINCIPAL, scope, hard_fail, on_invalid_plugin, unruled route, bundle build, get_authz_contribution.
Creates background reconcile-loop controllers using NemoController. Use when implementing state-machine reconciliation, running periodic background work, managing deployment lifecycle, building service-principal entity clients for background use, or understanding controller startup/shutdown sequence. Trigger keywords: controller, NemoController, reconcile, background loop, reconcile_one, list_objects, on_startup, state machine, deployment lifecycle, service principal, interval_seconds.
Creates in-process NemoFunction surfaces for NeMo Platform plugins. Use when adding a function, declaring spec_schema, mounting function routes with add_function_routes, understanding the two CLI verbs (run / submit), or streaming NDJSON frames. Trigger keywords - function, NemoFunction, spec_schema, add_function_routes, nemo_platform_plugin.functions, two verbs, run, submit, streaming, NDJSON, FunctionContext.
| name | unit-test |
| description | Unit testing workflow with Vitest and React Testing Library. Use when writing, running, or debugging unit tests for Studio components and utilities. |
screen.getByRole() over getByTestId() when possibleawait findBy*() methods for async elements — never wrap getBy*() in waitFor()findBy* for elements that appear after async operations (API calls, state updates)getBy* for elements that should be immediately present// DON'T
await waitFor(() => {
expect(screen.getByText('Data loaded')).toBeInTheDocument();
});
// DO
expect(await screen.findByText('Data loaded')).toBeInTheDocument();
describe blockstest.each for parameterized testspackages/studio: Use tsconfig path aliases — @studio/... for application code and test utilities under src/; @nemo/common/... for the linked common package (see Studio tsconfig.json paths). Prefer aliases over long ../../../ chains; import the module under test with @studio/... when that matches app code style and ESLint rules.packages/common, packages/sdk): Use relative imports for code and specs inside the same package (e.g. ./index, ../form/Widget). Those packages do not use @studio/...; their tsconfig typically has no @studio path map.@nemo/common/... / @nemo/sdk/... where paths allow it. In packages/common, import sibling modules with relatives; use workspace package boundaries as defined by that package’s config (often no internal @nemo/common self-alias in specs).@studio/mocks/ — domain fixtures and helpers live under packages/studio/src/mocks/ (e.g. intake/, entity-store/, handlers/*.ts). Default HTTP behavior is composed in handlers.ts and registered via @studio/mocks/node (server).makeX / mockXHandler functions next to related mocks (or in an existing handler module) and import them into specs.@studio/tests/util/render (renderRoute, etc.) — use these instead of re-creating providers and router wiring in every file.packages/common: colocate small factories next to the module under test or in a nearby __tests__ helper only when the mock is file-local; if multiple specs need it, extract to a shared test helper under that package.vitest.setup.tsx: server.listen, afterEach → server.resetHandlers() (restores defaults), server.close in afterAll. Unhandled requests error by default — add or override handlers instead of silencing unless intentional. Other packages follow their own Vitest setup if configured.import { server } from '@studio/mocks/node' then server.use(http.get(...), ...) for that scenario (errors, empty lists, slow responses). After the test, reset is automatic.vi.mock of fetch or low-level axios mocks when the code path hits real request URLs.src/mocks/handlers/ or domain src/mocks/<area>/ and be merged into handlers.ts when they are broadly needed; one-off overrides stay in the spec with server.use.http / HttpResponse from msw; align URL prefixes with @studio/constants/environment (e.g. INTAKE_MICROSERVICE_URL, PLATFORM_BASE_URL) where the app does.DEFAULT_WORKSPACE from @nemo/common/src/models/constants in Studio (and ./models/constants or the same import path from @nemo/common when inside packages/common). Avoid scattering the literal 'default' for workspace slugs, routes, and entity refs unless the test explicitly asserts a non-default workspace.DEFAULT_WORKSPACE (or generatePath(ROUTES.workspace.*, { workspace: DEFAULT_WORKSPACE, ... })) so defaults stay consistent with app constants.@nemo/common or the feature module (prompt templates, etc.) instead of re-hardcoding the same magic values.const OTHER_WORKSPACE = 'other-ws') rather than inline strings repeated across cases.vi.mock() for non-HTTP modules (browser APIs, optional native deps), never jest.mock()vi.clearAllMocks()server.use for variants)describe, it, expect, vi are available implicitlyAlways go through the package's test script. Never invoke vitest directly — it skips per-package env/config (e.g. NODE_OPTIONS=--max-old-space-size=10240 in studio).
Two acceptable patterns from web/:
# Pattern A — filter from web/ root
pnpm --filter nemo-studio-ui test # whole package
pnpm --filter nemo-studio-ui test -- src/components/Button.test.tsx # specific file
pnpm --filter nemo-studio-ui test -- --reporter=verbose Button # pattern match
pnpm --filter nemo-studio-ui test -- --coverage # with coverage
# Pattern B — cd into the package
cd packages/studio
pnpm test # whole package
pnpm test -- src/components/Button.test.tsx # specific file
pnpm test already passes --run (no watch mode) — tests run to completion so results can be read and iterated on.