mcpField
A
add-diagnostic

add-diagnostic

github.com/vercel-labsDevelopment24044 installsUpdated 4w ago
Repository

About add-diagnostic

add-diagnostic is a skill guide for developers adding codes to a nostics diagnostic catalog. It covers code naming, definition fields, and call patterns, while requiring published codes to remain stable.

Key features

  1. 01Locate the appropriate diagnostic catalog
  2. 02Choose a stable code by convention
  3. 03Add a cause and optional fix
  4. 04Pass runtime fields and invoke diagnostics

Use cases

  1. 01Register a diagnostic for a new error type
  2. 02Extend catalogs across multiple areas
  3. 03Add parameterized causes and fixes to diagnostics

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/vercel-labs/nostics --skill add-diagnostic

After installing, type/add-diagnosticin Claude Code to confirm it loaded.

Details

From the project README

Add a New Diagnostic Code

  1. Find the catalog. Grep for defineDiagnostics to locate the codes object the new entry belongs in. With several catalogs, pick by area.
  2. Pick the code. PREFIX_XNNNN: PREFIX is the project name uppercased (NUXT, I18N); X is the area letter (B build, R runtime, C config, D deprecation); NNNN is the next free number. Read existing codes to choose. Never rename or reuse a published code.
  3. Add the entry:
LIB_R0001: {
  why: (p: { hook: string }) => `${p.hook}() must run at the top of setup().`, // string or typed fn; becomes Error.message (required)
  fix: 'Move the call into setup() or a composable it calls.', // optional, but add whenever the fix is known
  docs: 'https://example.com/custom', // optional: overrides docsBase, or `false` to opt out
},
  • why is the only required field. Params from why and fix are intersected and required at the call site.
  • Runtime fields (cause, sources) are passed at the call site, never in the definition.
  1. Call it: diagnostics.LIB_R0001({ hook }) to report, throw diagnostics.LIB_R0001({ hook, cause: err }) to raise. Both run the reporters.

Full API and reporter/formatter/plugin details: the nostics skill.

Comments

Markdown supported