By vercel-labs
Define, catalog, and manage typed diagnostic codes with stable IDs, docs URLs, and customizable reporters (console, fetch, file). Includes Vite plugin integration and event-driven diagnostic consumers that run on session stop or prompt submission.
Add a new diagnostic code following the defineDiagnostics() conventions from nostics
Structured diagnostic code library for JavaScript/TypeScript. Turns errors and other conditions into typed, machine-readable `Diagnostic` instances with stable codes, docs URLs, and actionable fields. Use this skill whenever the project imports `nostics`, or works with `defineDiagnostics`/`defineProdDiagnostics`, the `Diagnostic` class, diagnostic code registries, or structured error handling. Also covers reporters (`createConsoleReporter`, `createFetchReporter` from nostics/reporters/fetch, `createFileReporter` from nostics/reporters/node, `createDevReporter` from nostics/reporters/dev), formatters (`formatDiagnostic`, `ansiFormatter`, `jsonFormatter`), and Vite plugins (`nosticsStrip` from @nostics/unplugin/strip-transform, `nosticsCollector` from @nostics/unplugin/dev-server-collector). Also use when migrating a library's existing `console.warn`/`console.error`/`warn()` helpers or thrown `Error`s to diagnostics: follow `references/migration.md`.
Errors worth reading.
nostics helps you replace ad hoc error strings with stable diagnostic codes, actionable fixes, source locations, and docs links.
[NUXT_B2011] Plugin `./runtime/analytics.server.ts` is server-only but was registered with mode `client`.
├▶ fix: Rename the file or register it with mode `server`.
├▶ sources: modules/analytics.ts:18:5
╰▶ see: https://nuxt.com/e/b2011
pnpm add nostics
import { createConsoleReporter, defineDiagnostics } from 'nostics'
export const diagnostics = defineDiagnostics({
docsBase: code => `https://nuxt.com/e/${code.replace('NUXT_', '').toLowerCase()}`,
reporters: [createConsoleReporter()],
codes: {
NUXT_B2011: {
why: (p: { src: string, mode: 'client' | 'server' }) => {
const expected = p.mode === 'client' ? 'server' : 'client'
return `Plugin "${p.src}" is ${expected}-only but was registered with mode "${p.mode}".`
},
fix: (p: { mode: 'client' | 'server' }) => {
const expected = p.mode === 'client' ? 'server' : 'client'
return `Rename the file or register it with mode "${expected}".`
},
},
NUXT_B5001: {
why: (p: { value: string, configPath: string }) =>
`Invalid compatibilityDate "${p.value}" in ${p.configPath}.`,
fix: (p: { example: string }) => `Use an ISO date like "${p.example}", or "latest".`,
},
},
})
Use the generated handles where the problem happens:
const plugin = resolvePlugin()
const source = locatePluginCall(plugin)
const config = loadNuxtConfig()
diagnostics.NUXT_B2011({
src: plugin.src,
mode: plugin.mode,
sources: [source],
})
throw diagnostics.NUXT_B5001({
configPath: config.filepath,
value: config.compatibilityDate,
example: '2024-04-03',
})
Calling a handle reports the diagnostic and returns a Diagnostic. Throwing the return value raises it. The params are inferred from your why and fix functions.
Install the plugin to give Claude skills for your diagnostic catalog:
claude plugin add https://github.com/vercel-labs/nostics
Claude will automatically pick up the nostics API reference and an add-diagnostic skill that finds the right catalog, chooses the next free code, and wires the call site.
Prefer just the skills, without the plugin? Install them with npx skills into any supported agent (Claude Code, Codex, Cursor, opencode, and more):
npx skills add vercel-labs/nostics
Diagnostic instances that extend Error.The structured shape also makes diagnostics easier for tools and coding agents to read, without making that the main workflow.
Build-time plugins live in the separate @nostics/unplugin package:
pnpm add -D @nostics/unplugin
For library builds, use the strip plugin:
import { nosticsStrip } from '@nostics/unplugin/strip-transform'
export default defineConfig({
plugins: [nosticsStrip.vite()],
})
For browser diagnostics during Vite dev, use createDevReporter() in the browser and nosticsCollector in the consuming app:
import { nosticsCollector } from '@nostics/unplugin/dev-server-collector'
export default defineConfig({
plugins: [nosticsCollector.vite()],
})
See the docs site for the guide, production build notes, dev collector setup, and API reference.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub vercel-labs/nostics --plugin nosticsBrowser automation plugin for agent-driven web app testing, inspection, and debugging.
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Memory compression system for Claude Code - persist context across sessions
Multi-model consensus engine integrating OpenAI Codex CLI, Gemini CLI, and Claude CLI for collaborative code review and problem-solving.
Curate auto-memory, promote learnings to CLAUDE.md and rules, extract proven patterns into reusable skills.