void-functional

Enforces pure-by-default functional programming with Result types and immutability in TypeScript domain code.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-functional-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-functional
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/core/skills/void-functional
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-functional-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Domain logic often mixes side effects, exceptions, and mutable state, making code hard to test and reason about. This Skill enforces a functional discipline where decisions happen in pure code, expected failures are typed values, and side effects live only at adapter boundaries. ## Core Features & Use Cases - Errors as Values: Standardizes a Result<T, E> type with ok/err/map/flatMap helpers so expected failures are typed return values instead of hidden exceptions. - Functional Core / Imperative Shell: Keeps domain decisions pure while adapters handle I/O, time, and randomness through injected ports like ClockPort and IdPort. - Discriminated Unions and Immutability: Models state machines as discriminated unions with exhaustive switches, bans null in domain code, and defaults to readonly data structures. - Use Case: When implementing a checkout flow, you write a pure function returning Result<OrderConfirmation, CheckoutError> with injected payment and clock ports, making it fully testable without mocks. ## Quick Start Ask the agent to refactor the checkout function so expected failures return Result types and side effects move to injected ports.

Frequently Asked Questions about void-functional

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle errors without exceptions in TypeScript?

Use a Result<T, E> discriminated union with ok and err constructors, then chain operations with map and flatMap helpers. Expected failures like validation errors become typed return values, while exceptions are reserved for truly unexpected bugs like database outages.

What is functional core imperative shell architecture?

It is a pattern where all decisions happen in pure functions (the core) and all side effects happen at the edges (the shell). The shell reads external input, calls the pure core, and writes results back out, making domain logic deterministic and trivially testable.

Should I use fp-ts or Effect-TS for functional TypeScript?

This discipline rejects fp-ts and Effect-TS as default dependencies, favoring a minimal Result, Option, and pipe helper set under 50 lines. Adopt those libraries only as an opt-in pack when you need structured concurrency or rich combinators across multiple use cases.

How do I model state machines with discriminated unions in TypeScript?

Define each state as a variant with a kind literal tag, then write transition functions that accept only specific variants. The compiler rejects invalid transitions, and exhaustive switches guarantee every case is handled.

When should I use Option versus undefined in TypeScript?

Use T | undefined for optional configuration or properties that may not be set yet. Use Option<T> with some/none variants for domain optionality where you want exhaustive switch enforcement so the none case cannot be silently ignored.

Why is null banned in domain code?

Null duplicates the optionality concept and creates null versus undefined ambiguity in TypeScript. The discipline uses T | undefined or Option<T> instead, with a companion hook that warns on null literals in domain code.