add-diagnostic
Add a new diagnostic code following the defineDiagnostics() conventions from nostics
- License 许可
- MIT
- 所属仓库
- jd-solanki/ai
- 最近更新
- 2026-11-14
- Stars
- ★ 6
- Forks
- 2
01 前言 Front Matter
- name
- add-diagnostic
- license
- MIT
- description
- Add a new diagnostic code following the defineDiagnostics() conventions from nostics
- allowed-tools
- Read Grep Glob Edit Write
- user-invocable
- true
03 SKILL.md 正文
Add a New Diagnostic Code
- Find the catalog. Grep for
defineDiagnosticsto locate thecodesobject the new entry belongs in. With several catalogs, pick by area. - Pick the code.
PREFIX_XNNNN:PREFIXis the project name uppercased (NUXT,I18N);Xis the area letter (Bbuild,Rruntime,Cconfig,Ddeprecation);NNNNis the next free number. Read existing codes to choose. Never rename or reuse a published code. - 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
},
whyis the only required field. Params fromwhyandfixare intersected and required at the call site.- Runtime fields (
cause,sources) are passed at the call site, never in the definition.
- 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.
04 同仓库更多 Skills
clean-code
Write readable, maintainable code through disciplined naming, focused functions, and clean error handling. Use when the user mentions "code review", "naming conventions", "function too long", "code smells", "readable code", "boy scout rule", "single responsibility", or "unit test quality". Also trigger when reviewing pull requests for readability, refactoring messy functions, debating comment styles, or improving error handling patterns. Covers SRP, comment discipline, formatting, and unit testing. For refactoring techniques, see refactoring-patterns. For architecture, see clean-architecture.
ponytail
Lazy senior dev mode: the smallest change that fully solves the task, and a reply a busy human understands in one read. Use on any coding task (writing, fixing, refactoring, reviewing, choosing dependencies) and when the user says "ponytail", "be lazy", "simplest solution", "yagni", or complains about over-engineering or bloat. Levels: lite, full (default), ultra.
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`.