/dd:ts:libraryfrom dd:ts
Enforces TypeScript conventions for published libraries: public API surface discipline, package-prefixed names, private over # fields, static factories, immutable value objects, use*/with* builder patterns, TSDoc on every export, and ESM build setup with exports map.
Ships in dd:ts. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
These stack on dd:ts:core when the code ships as a package that other projects install. An
application, a CLI or a test harness does not need them.
Anything not in the root barrel is free to change. Keep the exported surface minimal.
Hide implementation classes. Export functions, a type and a type predicate; the class stays module-private. Consumers depend on the shape, not on the constructor.
export const ref: RefFunction = (value?: unknown) => new RefImpl(value)
export const isRef = <T>(v: unknown): v is Ref<T> => v instanceof RefImpl
Options objects over positional arguments in every public signature.
An option from a closed set is an enum, not a string union: time.add(1, TimeUnit.Day),
not time.add(1, 'day'). The root barrel exports every enum that a public signature takes.
A barrel may re-export a dependency's API to give consumers one import site.
FetcherConfig, not Config. Consumers import many packages into one file; unprefixed names
collide and read as ambiguous. This holds for classes, types and enums.
private, not #A Proxy cannot forward #field access, so an instance with # fields inside a Proxy-based
store throws TypeError: Cannot read private member. Vue reactive(), MobX and Valtio all do
this, and consumers put library instances there. See
tc39/proposal-class-fields#106.
private readonly. A private field and a getter cannot share a name: the field takes
the short form (cfg, raw), the getter the public one (config, value)._ prefix on private members. private already says it.Static factories over a public constructor when construction validates, parses or has
several entry points. The constructor is protected.
export class BN {
protected constructor(value: bigint, cfg: BnConfig) { … }
public static fromBigInt(value: BnLike, cfg?: BnConfigLike): BN { … }
public static fromRaw(value: BnLike, cfg?: BnConfigLike): BN { … }
}
Value objects never mutate. Every operation returns a new instance. build() returns a
copy, never the internal object.
use* mutates, with* clonesA stateful class that supports reconfiguration exposes clone() and both variants:
public useBaseUrl(baseUrl: string): Fetcher {
validateBaseUrl(baseUrl)
this.cfg.baseUrl = baseUrl
return this
}
public withBaseUrl(baseUrl: string): Fetcher {
return this.clone().useBaseUrl(baseUrl)
}
Never write a with* that mutates. Fluent setters return this; type the return as this
when subclasses must keep the chain.
instanceof, without a status-code table.switch with a default.Fetcher: query parameters can't be nested.TypeError, not a new class.Every export and every public member gets one — TSDoc is the API docs. The dd:ts:core
budget still holds: one line by default.
{@link OtherType} for cross-references.@throws when the failure is not obvious — consumers cannot see your catch.@example with a fenced ts block for a non-obvious call shape: a builder, a factory with
overloads, an options object.require() ESM..d.ts from tsc: tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist/types.
Bun does not generate declarations.bun build with --packages external, so dependencies are not bundled in."sideEffects": false, so consumers can tree-shake.exports map with types first — resolution reads the conditions in order.{
"type": "module",
"sideEffects": false,
"exports": {
".": { "types": "./dist/types/index.d.ts", "import": "./dist/index.js" }
},
"files": ["dist"]
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
5 skills in this plugin
/coreThe TypeScript conventions that apply to almost every edit — code layout and blank lines, DRY, control flow, functions, types and enums, zod at boundaries, errors, async, module state, logging, classes, files and imports, comments, and naming. Use whenever writing, changing, or reviewing TypeScript, declaring types or enums, parsing external data, adding try/catch or error classes, writing async code, organizing files, barrels and imports, writing comments or TSDoc, refactoring code to be shorter, flatter or less repetitive, naming anything, or when the user asks about idiomatic TypeScript. This is the default TypeScript skill — load it first; reach for testing, tooling, or library on top of it when the task calls for them./reviewComprehensive TypeScript code review — runs format, typecheck, lint and tests, loads the TypeScript convention skills, reviews the changes, and writes a structured report. Use when reviewing finished TypeScript changes, closing a slice that touched TypeScript, preparing a PR for merge, or auditing TypeScript code quality — not while writing the code./testingTypeScript testing with bun test — file layout, describe/test naming, arrange-act-assert, fixtures and mocks, asserting errors. Use whenever writing or reviewing TypeScript tests, setting up a test runner, organizing test files or fixtures, mocking dependencies, asserting on thrown errors, or when the user asks about test structure, coverage, or testing patterns in a TypeScript project./toolingTypeScript project tooling on Bun — bun as package manager, runtime and test runner, bun fmt for formatting and import order, bun lint for lint rules, bun check for types, bunfig.toml, tsconfig strictness flags, workspaces, and git hooks. Use whenever setting up or changing a TypeScript project's config, editing bunfig.toml or tsconfig.json, choosing format or lint settings, adding dependencies or scripts, configuring a monorepo workspace, setting up CI checks, or when the user asks about strict flags, lint rules, formatting, or which tools to use.npx claudepluginhub napalmpapalam/skills --plugin ts