CtrlK
BlogDocsLog inGet started
Tessl Logo

workout/ddd-functional-nextjs

Enforces full DDD conventions for TypeScript/Next.js: folder structure, layer boundaries, functional patterns, and ubiquitous language.

80

Quality

100%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

PRIMITIVES.mdskills/ddd-functional-nextjs/docs/

Shared Primitives — Full Implementations

Established once per project in shared/domain/. Copy verbatim; these files rarely change.

Result.ts

export type Result<T, E = string> = { ok: true; value: T } | { ok: false; error: E };
export const ok = <T>(value: T): Result<T, never> => ({ ok: true, value });
export const err = <E>(error: E): Result<never, E> => ({ ok: false, error });
export const map = <T, U, E>(r: Result<T, E>, fn: (v: T) => U): Result<U, E> =>
  r.ok ? ok(fn(r.value)) : r;
export const flatMap = <T, U, E>(r: Result<T, E>, fn: (v: T) => Result<U, E>): Result<U, E> =>
  r.ok ? fn(r.value) : r;

identity.ts

export type Brand<T, B extends string> = T & { readonly _brand: B };
export type Id<B extends string> = Brand<string, B>;
export const createId = <B extends string>(brand: B) => (): Id<B> => crypto.randomUUID() as Id<B>;
export const castId = <B extends string>(brand: B) => (raw: string): Id<B> => raw as Id<B>;

DomainEvent.ts

export type DomainEvent<T extends string, P extends Record<string, unknown>> = {
  readonly eventType: T; readonly eventId: string;
  readonly occurredAt: Date; readonly payload: P;
};
export const createEvent = <T extends string, P extends Record<string, unknown>>(
  eventType: T, payload: P,
): DomainEvent<T, P> => ({ eventType, eventId: crypto.randomUUID(), occurredAt: new Date(), payload });

skills

ddd-functional-nextjs

docs

EXAMPLES.md

PRIMITIVES.md

SKILL.md

tile.json