pure-function-pattern
CommunityWrite testable, side-effect-free business logic.
Software Engineering#typescript#deterministic#unit-testing#immutability#discriminated-unions#functional-patterns#pure-function
Authorwhchi
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This pattern helps you implement or refactor core business logic so it produces consistent outputs without side effects, making code easier to test and reason about.
Core Features & Use Cases
- Pure input-output behavior: Functions rely only on provided inputs and return deterministic results.
- Explicit purity contracts: Helpers return a stable discriminated union to express success or specific errors.
- Testability and reuse: Unit tests cover all branches; logic is extractable and easy to compose.
Quick Start
Expose a small module with a main pure function and helpers, inject runtime data as explicit parameters, and cover all branches with tests.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: pure-function-pattern Download link: https://github.com/whchi/agentic-coding/archive/main.zip#pure-function-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.