/typescript:ts-functionalfrom typescript
Provides functional TypeScript patterns: pipe, compose, currying, Result types, railway-oriented error handling, and AsyncResult for async pipelines.
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.
Chain transformations left-to-right for readable data flow:
function pipe<T>(value: T, ...fns: Array<(arg: any) => any>): any {
return fns.reduce((acc, fn) => fn(acc), value);
}
const result = pipe(rawInput, validate, normalize, enrichWithDefaults, toDomain);
Transform a multi-argument function into a chain of single-argument functions, useful for partial application and composition:
const calculateTax = (rate: number) => (amount: number): number =>
amount * rate;
const applyVAT = calculateTax(0.2);
applyVAT(100); // 20
Model operations that can fail as a Result type instead of throwing exceptions. Errors travel along the "failure track" without try/catch.
This is the canonical
Result<T, E>definition. Other skills that need a fallible-operation type point here rather than declaring their own shape.
type Result<T, E = Error> =
| { tag: 'success'; value: T }
| { tag: 'failure'; value: E };
function success<T>(value: T): Result<T, never> { return { tag: 'success', value }; }
function failure<E>(value: E): Result<never, E> { return { tag: 'failure', value }; }
function isSuccess<T, E>(result: Result<T, E>): result is Extract<Result<T, E>, { tag: 'success' }> {
return result.tag === 'success';
}
function isFailure<T, E>(result: Result<T, E>): result is Extract<Result<T, E>, { tag: 'failure' }> {
return result.tag === 'failure';
}
// Chain a fallible operation onto a Result, short-circuiting on failure
const chain =
<T, S, E>(f: (value: T) => Result<S, E>) =>
<F>(result: Result<T, F>): Result<S, E | F> =>
isSuccess(result) ? f(result.value) : result;
Extends the Result type to async operations: AsyncResult<T, E> = Promise<Result<T, E>>.
Provides chain (async fallible), tee (side-effect), and wrap (adapt sync to async).
When implementing type-safe pipe overloads, currying+pipe composition, or validation pipelines, read
references/fp-pattern-examples.mdfor complete implementations.
When building an AsyncResult with chain/tee/wrap, read
references/fp-pattern-examples.mdfor the full implementation and handler usage patterns.
| Pattern | Use case |
|---|---|
| Pipe | Sequential transformations on data |
| Currying | Create specialized functions from general ones |
| Result type | Sync operations that can fail -- replace try/catch in domain |
| AsyncResult | Async operations that can fail, infrastructure orchestration only (DB, API, I/O) |
| Railway | Chain multiple fallible operations cleanly |
| Exceptions | Infrastructure errors (DB down, network failure) |
Rule of thumb: if the caller is expected to handle the failure as a normal case, use
Result. If it's an unexpected crash, let it throw.
| Pattern | Key idea |
|---|---|
pipe(value, fn1, fn2, fn3) | Left-to-right transformation chain |
const specialized = general(config) | Currying for partial application |
Result<T, E> | Success or failure without exceptions |
isSuccess(result) / isFailure(result) | Narrow a Result to its success or failure arm |
chain(fn) | Chain a fallible operation, short-circuiting on failure |
AsyncResult<T, E> | Async Result: Promise<Result<T, E>> |
AsyncResult.chain(fn) | Chain async fallible operations, infrastructure orchestration only |
AsyncResult.tee(fn) | Side-effect without altering the Result, infrastructure orchestration only |
AsyncResult.wrap(fn) | Adapt sync Result function to async pipeline, infrastructure orchestration only |
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-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).npx claudepluginhub fabiensalles/claude-marketplace --plugin typescript