Agent skill

Type Declarations

by nubjs in nubjs/nub

Add, audit, or update @nubjs/types declarations for Nub runtime APIs.

MITAuto-check passed

Install Type Declarations

skills CLI
$ npx skills add nubjs/nub --skill type-declarations -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nubjs/nub type-declarations --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nubjs/nub.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/type-declarations .claude/skills/type-declarations && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
type-declarations
GitHub stars
4.4k
Token cost
~2.4k tokens
SKILL.md length
1,091 words
Files
1
Skills in repo
31
Repo updated
First seen
Licence
MIT

At a glance

Add, audit, or update @nubjs/types declarations for Nub runtime APIs.

  • Works in 4 steps: Trace the runtime surface from its… → Check the exact TypeScript libraries… → Consult primary declarations:… → …
  • Changes a user-visible global
  • SKILL.md covers Start with an ownership audit, Choose the conflict-safe pattern, Match runtime and inference… and Add the smallest comprehensive…, plus 3 more sections
  • Calls git, python3 and make

What it does

Type Declarations is an agent skill from nubjs/nub. Add, audit, or update @nubjs/types declarations for Nub runtime APIs. Use whenever Nub adds or changes a user-visible global, built-in method, module loader type, or TC39 proposal; when TypeScript or @types/node gains an overlapping declaration; and before every release to reconcile runtime changes since the previous tag. Covers conflict-safe global augmentation, compiler-version routing, fixture matrices, and package verification.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with TypeScript. The repository describes itself as: The fast all-in-one Node.js toolkit. The licence is MIT.

When your agent uses it

  • Changes a user-visible global
  • Built-in method
  • Module loader type
  • @types/node gains an overlapping declaration

Example prompts

  • “/type-declarations”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Trace the runtime surface from its implementation and its row in crates/nub-core/src/node/feature_matrix.rs. Check runtime/polyfills.cjs…
  2. Check the exact TypeScript libraries supported by the fixture matrix and current @types/node. ECMAScript built-ins normally belong to…
  3. Consult primary declarations: TypeScript's src/lib or installed lib.*.d.ts, DefinitelyTyped's types/node, and Bun's types when looking for…
  4. Add a declaration only for the remaining gap. If a focused TypeScript library already owns the surface, reference that library instead of…

What it can do on your machine

Read from SKILL.md and the folder at commit 568e73a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • python3
    • make

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Type Declarations loads about 2.4k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 1,091 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~113
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nubjs/nub at commit 568e73a, republished under its MIT licence (© nubjs). 1,091 words, ~2,397 tokens.

Download SKILL.mdSave it as .claude/skills/type-declarations/SKILL.md (or your agent's skills folder).
name
type-declarations
description
Add, audit, or update @nubjs/types declarations for Nub runtime APIs. Use whenever Nub adds or changes a user-visible global, built-in method, module loader type, or TC39 proposal; when TypeScript or @types/node gains an overlapping declaration; and before every release to reconcile runtime changes since the previous tag. Covers conflict-safe global augmentation, compiler-version routing, fixture matrices, and package verification.
metadata.internal
true

Writing Nub type declarations

@nubjs/types describes user-visible runtime behavior that the consumer's selected TypeScript libraries and @types/node do not already describe. Runtime truth comes first: declarations follow shipped behavior; they never advertise an unimplemented convenience or preserve a stale shape for compatibility.

The package lives under npm/nub-types/:

  • common.d.ts — declarations shared by every supported compiler.
  • index.d.ts — the current-compiler entry point and focused standard-library references.
  • ts5.9/index.d.ts — the legacy entry selected through typesVersions.
  • test/fixtures/ — compile-time compatibility and negative controls.

Start with an ownership audit

  1. Trace the runtime surface from its implementation and its row in crates/nub-core/src/node/feature_matrix.rs. Check runtime/polyfills.cjs, runtime/preload-common.cjs, loader modules, or other owning code rather than inferring a signature from a feature name.
  2. Check the exact TypeScript libraries supported by the fixture matrix and current @types/node. ECMAScript built-ins normally belong to TypeScript's lib.*.d.ts; Node and web globals may belong to @types/node.
  3. Consult primary declarations: TypeScript's src/lib or installed lib.*.d.ts, DefinitelyTyped's types/node, and Bun's types when looking for a proven step-aside pattern. A proposal README or specification establishes semantics, but the official TypeScript declaration is the compatibility target once one exists.
  4. Add a declaration only for the remaining gap. If a focused TypeScript library already owns the surface, reference that library instead of copying it.

Choose the conflict-safe pattern

Merge members into existing built-ins

Augment the interface that owns an existing global:

ts
interface PromiseConstructor {
  allKeyed<T extends object>(promises: T): Promise<{ -readonly [K in keyof T]: Awaited<T[K]> }>;
}

Use the same pattern for IteratorObject, Math, Atomics, SymbolConstructor, typed-array instances, and typed-array constructors. Never redeclare var Promise, var Symbol, or another built-in value just to add a method. Method members merge as overloads when a future standard library adds them.

Property members are stricter: their modifiers and type must match the official settled declaration exactly. Symbol.metadata, for example, must remain readonly and unique symbol.

Step aside from an optional global owner

Some globals are absent from Node's normal type environment but collide when a consumer also selects lib.dom. Follow the conditional globalThis pattern used by Node and Bun types: detect the other library, adopt its constructor type, and reduce Nub's interface extension to {}. The current helpers are __NubLibDomIsLoaded and __NubUseLibDomIfAvailable in common.d.ts.

Do not solve a global collision with skipLibCheck, a broad any, or a second incompatible declare var. The fixtures compile with skipLibCheck: false specifically to expose these conflicts.

Route declarations that cannot merge

Classes, type aliases, and some namespace members cannot safely coexist with a later official library. Route those declarations by compiler version through typesVersions:

  • TypeScript 5.9 and earlier receive Nub's inlined Temporal declarations.
  • TypeScript 6 and later reference the official esnext.temporal library.
  • Both routes reference common.d.ts for declarations that merge safely.

Keep version routing as narrow as possible. Add a new route only after reproducing a real collision, and set its boundary to the first compiler that ships the official declaration. Do not fork the whole package for one incompatible surface.

Preserve the global-script invariant

common.d.ts must remain a global script. Never add a top-level import, export, or export {}: doing so makes wildcard declarations such as declare module "*.yaml" module-local and silently removes Nub globals from consumers.

Use triple-slash lib and path references in versioned entry points. If a declaration needs an external type, prefer a qualified ambient reference that does not convert common.d.ts into a module.

Match runtime and inference precisely

  • Copy an official TypeScript signature byte-for-byte when Nub backfills an API already declared by a newer compiler.
  • For a proposal without official TypeScript declarations, derive the narrowest useful signature from the proposal and runtime implementation. Preserve keys, readonly removal, Awaited, generic buffer types, and overload behavior where they are observable to callers.
  • Document runtime facts the type system cannot express, such as null prototypes or enumerable-key filtering, without pretending the signature enforces them.
  • Keep vendored declarations tied to the bundled implementation version. When the Temporal polyfill changes, reconcile the TypeScript 5.9 fallback against that exact package version.
  • Do not duplicate surfaces already supplied by the selected TypeScript library or @types/node.
Show full SKILL.md (441 more words)Show less

Add the smallest comprehensive fixture coverage

Every changed public declaration needs a concrete use in test/fixtures/positive; assert useful inferred types rather than merely checking that a property exists.

When a declaration could later land upstream, also update test/fixtures/future-stdlib/official-proposals.d.ts with the expected official duplicate. That fixture must compile with both declaration sources active and skipLibCheck: false.

Preserve the rest of the matrix:

  • TypeScript 5.9 exercises the legacy route.
  • TypeScript 6 exercises the first official Temporal route.
  • The current preview/compiler exercises forward compatibility.
  • stepaside-dom and stepaside-stub verify global-owner coexistence.
  • negative-export must fail only because YAML resolution and reportError disappear after common.d.ts is converted into a module.

Run the fixture package through Nub against a freshly packed tarball. Do not rely on the checked-in file:.. dependency for release verification: a package-manager content store may reuse an older local-package snapshot, which can hide or invent routing failures. The tarball workflow also proves the artifact users receive:

bash
tmp=$(mktemp -d)
cp -R npm/nub-types "$tmp/nub-types"
cd "$tmp/nub-types"
nub pack --json
TARBALL=$(find "$PWD" -maxdepth 1 -name '*.tgz' -print -quit)
python3 - "$PWD/test/package.json" "$(basename "$TARBALL")" <<'PY'
import json, pathlib, sys
path = pathlib.Path(sys.argv[1])
data = json.loads(path.read_text())
data["devDependencies"]["@nubjs/types"] = f"file:../{sys.argv[2]}"
path.write_text(json.dumps(data, indent=2) + "\n")
PY
cd test
nub install
nub run test

If the repository's minimum-release-age policy rejects a deliberately current compiler pin, pass --minimum-release-age=0 for this disposable verification install; do not weaken the repository policy.

Verify the published package, not just source files

When adding an entry point or shared declaration, include it in npm/nub-types/package.json's files list. Keep types and typesVersions aligned with the on-disk layout. Avoid a package exports map unless every supported module-resolution mode and typesVersions route has been proven: an exports condition can bypass compiler-version routing.

From npm/nub-types/, run nub pack --dry-run --json and inspect the file list. For every release, use the real-tarball fixture workflow above. A passing source-tree fixture does not prove the npm artifact contains the routed file or that compiler-version routing survives installation.

Mandatory release audit

Before every release, set PREV=$(git describe --tags --abbrev=0) and inspect $PREV..HEAD for user-visible runtime changes. At minimum, review:

bash
git diff --name-only "$PREV"..HEAD -- \
  runtime/ crates/nub-core/src/node/feature_matrix.rs npm/nub-types/ \
  wiki/runtime/ site/content/docs/

For every added or changed API, record one conclusion while working:

  1. the selected TypeScript library or @types/node already declares the exact shipped shape; or
  2. @nubjs/types has been updated, covered by the compiler/collision fixtures, and verified in the packed artifact.

This audit is a release blocker and happens before make version. An empty declaration diff is valid only after every runtime change has an explicit owner.

Common failure modes

  • Assuming a Node runtime release means @types/node owns an ECMAScript proposal.
  • Declaring an entire constructor when an interface member merge is sufficient.
  • Copying a future official class or type alias into common.d.ts instead of routing by compiler version.
  • Testing only one TypeScript version or enabling skipLibCheck.
  • Updating index.d.ts but omitting the new file from the package allowlist.
  • Adding a top-level import/export to common.d.ts and losing wildcard data modules.
  • Trusting a source-tree test without inspecting and testing the packed tarball.

© nubjs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/type-declarations of nubjs/nub.

Open the folder on GitHubat commit 568e73a

Compare with similar skills

Type Declarations next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Type Declarations compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Type Declarations this skillnubjs/nub4.4k—~2.4kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
Web Artifacts Builderanthropics/skills180k40 repos~769Automated safety check: PassApache-2.0
Typescript Advanced Typesrolling-scopes/rsschool-app10k24 repos~4.2kAutomated safety check: PassMPL-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 40 repos~769 tokens
    Frontend & DesignAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 24 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Nx Import

    nrwl/nx

    Import, merge, or combine repositories into an Nx workspace using nx import.

    29k GitHub starsUsed in 5 repos~3.5k tokens
    DevelopmentAuto-check passed

More from nubjs/nub

All 31 skills in this repo
  • Cpu Reduction

    nubjs/nub

    Diagnose and clear CPU, memory, and disk contention on the maintainer's dev host.

    4.4k GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Reclaim disk on the maintainer's Mac when the volume is full or filling — ENOSPC, "no space left on device", a failed build or agent harness, or a routine sweep of Rust build residue.

    4.4k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Nub Charts

    nubjs/nub

    Build a performance chart for nubjs.com — the SVG bar figures in blog posts, docs pages and social posts (a runtime augmentation against plain node, an install or dispatch comparison, a cross-tool…

    4.4k GitHub stars~4.6k tokensUpdated today
    Auto-check passed
  • Audit Thread

    nubjs/nub

    A skill your agent uses when running a compatibility/parity AUDIT — enumerating where nub diverges from a reference it claims parity with (pnpm CLI grammar, a lockfile format, a Node behavior, a…

    4.4k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Linux Vm Test

    nubjs/nub

    Run ad-hoc Nub tests and debugging probes on real local Linux guests.

    4.4k GitHub stars~986 tokensUpdated today
    Auto-check passed
  • Performance-trace Nub package-manager installs using the existing phase timings, structured diagnostics, and sampling-profiler workflow.

    4.4k GitHub stars~1.3k tokensUpdated today
    Auto-check passed

Works with

Questions about Type Declarations

What does Type Declarations do?

Add, audit, or update @nubjs/types declarations for Nub runtime APIs. Type Declarations is an agent skill from nubjs/nub. Add, audit, or update @nubjs/types declarations for Nub runtime APIs.

When should I use Type Declarations?

Type Declarations fits situations like: changes a user-visible global; built-in method; module loader type; @types/node gains an overlapping declaration.

How do I install Type Declarations in Claude Code?

Run `npx skills add nubjs/nub --skill type-declarations -a claude-code`. Or copy the skill folder (.claude/skills/type-declarations in nubjs/nub) into .claude/skills/type-declarations in your project. Claude Code loads it when a task matches its description.

How do I install Type Declarations in Codex?

Run `npx skills add nubjs/nub --skill type-declarations -a codex`. Or copy the skill folder (.claude/skills/type-declarations in nubjs/nub) into .agents/skills/type-declarations in your project. Codex loads it when a task matches its description.

Can I use Type Declarations in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nubjs/nub --skill type-declarations -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/type-declarations, .gemini/skills/type-declarations, .github/skills/type-declarations and .opencode/skills/type-declarations in your project.

What does Type Declarations need to run?

Going by SKILL.md and its folder, Type Declarations needs the command-line tools its instructions call (git, python3 and make). Our summary lists: Python 3.

Does Type Declarations access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Type Declarations safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Type Declarations use?

Type Declarations is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Type Declarations use?

About 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Type Declarations?

Skills that share tags, products or a category with Type Declarations: MCP Server Builder (anthropics/skills, 180k stars), Web Artifacts Builder (anthropics/skills, 180k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Type Declarations?

nubjs (a GitHub organization) maintains it in nubjs/nub, which has 4,370 GitHub stars. The repository holds 31 skills in this directory. The repository was last updated on October 7, 2026.

Source: nubjs/nub on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.