/typescript:ts-refactoringfrom typescript
Provides TypeScript-specific examples for cross-language refactoring rules, focusing on business flow tracing, consumer-driven value objects, and import coupling signals. Use when refactoring TypeScript, Node, or NestJS code.
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.
None: SKILL.md is the whole skill.
The rules are defined in
craft:refactoring-principles(cross-language). This skill provides TypeScript / Node examples only. Load both for the full picture.
// ❌ AVOID — refactoring without understanding the full flow
const uploadFile = new UploadFile(content, fileName);
// ...but UploadFile is also created in downloadExistingFiles() with
// different data. Two inconsistent creation paths.
//
// Sources you must identify BEFORE refactoring:
// - browser File API: File → UploadFile
// - API download: binary content → UploadFile
//
// → The abstraction must unify both sources.
// ❌ AVOID — VO defined only from its creation point
class UploadFile {
constructor(
readonly content: Buffer,
readonly originalFileName: string,
) {}
}
// Later, a consumer needs the file type → external mapping required.
// repository.upload(file, request)
// uses file.content, file.originalFileName, request.fileType
// → fileType comes from the file itself, NOT the request.
// ✅ CORRECT — include FileType because a consumer needs it
class UploadFile {
constructor(
readonly type: FileType,
readonly content: Buffer,
readonly originalFileName: string,
) {}
}
// ❌ AVOID — a domain service importing infrastructure types
import { Request, Response } from 'express';
import { PrismaClient } from '@prisma/client';
// The domain service manipulates HTTP and DB types directly.
// The imports betray a leaky abstraction.
// ✅ CORRECT — imports reflect the right abstraction level
import { UploadFile } from '../domain/upload-file';
import { TenantRepository } from '../domain/ports/tenant-repository';
// The service only manipulates domain objects. HTTP/DB type conversion
// happens at the boundaries (controllers, adapters).
See
ts-oop's "TS-specific: Branded Types for Primitive Identifiers" heading for the branded-type pattern that complements rule 2 above.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fabiensalles/claude-marketplace --plugin typescript9 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-code-conventionsACTIVATE whenever writing or modifying TypeScript code in src/. ACTIVATE for code review, formatting, or 'coding standards'. Provides TS-specific code style examples for the cross-language rules defined in craft:code-style-principles, plus TS-specific patterns (optional chaining, nullish coalescing, template literals, no truthy/falsy). DO NOT use for: TypeScript typing rules (see ts-conventions), test conventions, domain/infra layer boundaries (see ts-layer-boundaries)./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).