/typescript:ts-code-conventionsfrom typescript
Provides TypeScript-specific code style conventions (optional chaining, nullish coalescing, template literals, no truthy/falsy) for src/ code. Complements cross-language style rules and references project code examples.
Ships in typescript. 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.
Read when SKILL.md points to them.
The cross-language rules (control-structure spacing, early return, continue vs if/else, parameter ordering, flatten null checks) are defined in
craft:code-style-principles. This skill keeps TS-specific syntax (optional chaining, nullish coalescing, template literals) and pointers to the project'sreferences/code-examples.md.
See also:
ts-conventionsfor typing rules (strict mode, branded types).
These conventions go beyond standard linting rules (eslint/prettier).
For complete worked examples (control-structure spacing, early return, continue patterns, parameter ordering), read
references/code-examples.md.
Use ?. to flatten nested null checks, and ?? for "default if null/undefined".
// Optional chaining
if (customer.personalInfo?.usPerson === true) {
types.push('us_person');
}
// Nullish coalescing
const name = user.displayName ?? 'Anonymous';
Use explicit comparisons instead of relying on JavaScript's truthy/falsy coercion.
// ✅ Explicit checks
if (array.length > 0) { /* ... */ }
if (string === '') { /* ... */ }
if (value !== null && value !== undefined) { /* ... */ }
// ✅ Exception — booleans can be checked directly
if (isValid) { /* ... */ }
const message = `Hello ${user.name}, you have ${count} items`;
Layer boundaries themselves (the ESLint zones that enforce them) are owned by
ts-layer-boundaries; this section covers the alias, build and env-config conventions that sit alongside them.
Layer boundaries are declared as import/no-restricted-paths zones, one zone per forbidden edge, each carrying the message of the rule it violates.
The CQRS zone is unidirectional by design: it stops Command from reading Query, never the reverse. A relative path bypasses it.
Every layer has its own alias @, and it is imported through it; a relative path is reserved for a neighbor in the same folder.
The alias table is declared four times (tsconfig, jest moduleNameMapper, tsconfig-paths at runtime, transform at build) and must stay in sync.
Compile with tspc (ts-patch) plus typescript-transform-paths, so dist needs no resolver at runtime.
A layer's config.ts is the only file allowed to import process.env; every other module receives its configuration already destructured as arguments. No file other than a layer's own config.ts contains the string process.env.
Barrel files (index.ts) re-export only, and declare no function, class, or logic of their own. Zero index.ts files in the codebase contain a function or class declaration of their own.
process.env is read at one place per layer: a config.ts that destructures it with inline default values.
const { PORT = '3000', DATABASE_URL = 'postgres://localhost:5432' } = process.env;
Tests import by alias too, @Tests/* for fixtures, because a mirrored tree has no stable relative offset, so the alias is a necessity, not a preference.
A boolean variable, property, or function name carries an is, has, or can prefix; a bare noun or verb is reserved for non-boolean values.
No boolean declaration in the codebase is named without one of the three prefixes.
A file exports one primary symbol; a second export is allowed only for a tightly related overload or the type a factory constructs. A file accumulating a fourth unrelated public export is split before that fourth export lands.
A test file sits beside the file it exercises, Name.spec.ts next to Name.ts, never mirrored into a separate top-level tests/ tree. Zero .spec.ts files live outside the directory of the file they test.
For the cross-language quick reference (early return, continue, blank lines, parameter ordering), see
craft:code-style-principles.
| Rule | Example |
|---|---|
| Optional chaining | a?.b?.c instead of nested if |
| Nullish coalescing | value ?? 'default' |
| Explicit checks | array.length > 0 (not array.length) |
| Template literals | `Hello ${name}` (not 'Hello ' + name) |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
9 skills in this plugin
/ddd-ts-fpACTIVATE when modeling DDD aggregates, value objects and domain logic in TypeScript using functional patterns. ACTIVATE for 'aggregate', 'smart constructor', 'make*', 'validation pipeline', 'enrichment', 'domain handler' in TypeScript. Provides TypeScript-specific examples for cross-language functional DDD principles defined in craft:ddd-fp-principles. DO NOT use for: infrastructure code, general FP patterns (see ts-functional), OOP modeling (see ts-oop)./ts-conventionsACTIVATE when writing TypeScript types, generics, branded types, discriminated unions, or configuring tsconfig. ACTIVATE for 'type vs interface', 'enum alternative', 'branded type', 'satisfies', 'strict mode'. Covers: strict mode policy, no-any/no-enum rules, type over interface, discriminated unions, satisfies operator, branded types for ID safety, utility types. DO NOT use for: code formatting (see ts-code-conventions), functional patterns (see ts-functional)./ts-ddd-eventsACTIVATE when implementing domain events, event store, outbox pattern, or reliable event publishing in TypeScript. ACTIVATE for 'domain event', 'outbox', 'event store', 'event-driven', 'reliable publishing'. Covers: domain event structure and naming, event store (append-only), outbox pattern for reliable publishing (no dual-write), consumer pattern. DO NOT use for: aggregate modeling (see ddd-ts-fp), general async patterns, message queue configuration.npx claudepluginhub fabiensalles/claude-marketplace --plugin typescript