howto-program-functionally-ish

Separate pure logic from side effects using the Gather → Process → Persist pattern.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/cyarie/cyarie-claude-plugin --skill howto-program-functionally-ish
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: howto-program-functionally-ish
Source: https://github.com/cyarie/cyarie-claude-plugin/tree/main/skills/howto-program-functionally-ish
Command: npx skills add https://github.com/cyarie/cyarie-claude-plugin --skill howto-program-functionally-ish

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill helps developers separate pure logic from side effects to improve testability and maintainability.

Core Features & Use Cases

  • Enforces the Gather → Process → Persist pattern to clearly separate data gathering, processing, and persistence.
  • Identifies pure vs side-effecting code and provides a checklist to guide refactoring.
  • Supports testing practices that minimize nondeterminism and external dependencies.

Quick Start

Refactor a small function to extract pure logic and isolate I/O in a thin orchestrator, then run tests.

Frequently Asked Questions about howto-program-functionally-ish

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

FAQPage Schema
How do I separate pure logic from side effects for better testability?

To separate pure logic from side effects, apply the Gather → Process → Persist pattern to isolate calculations from I/O, file access, and external calls within a thin orchestrator. This enforces pure function boundaries to improve testability and maintainability.

What is the functional core pattern for refactoring code with mixed calculations and I/O?

The functional core pattern identifies pure versus side-effecting code and provides a checklist to guide refactoring. It extracts pure logic into isolated functions, leaving only thin orchestrators to handle non-deterministic external calls and data persistence.

How do I refactor a function to extract pure logic and isolate I/O operations?

Refactor a small function to extract pure logic and isolate I/O in a thin orchestrator, then run tests. This Gather → Process → Persist approach separates data gathering, processing, and persistence to ensure determinism and minimal side effects.

Why does my code have nondeterministic behavior during testing?

Nondeterministic behavior during testing often occurs because calculations intermix with side effects like I/O or external calls. Separating pure logic from side effects enforces pure function boundaries and minimizes external dependencies to ensure deterministic test results.

Does this approach work for refactoring existing software projects with external dependencies?

Yes, this approach works for software projects that intermix calculations with I/O, file access, or external calls during development or refactoring. It guides testing practices to minimize nondeterminism and external dependencies without requiring prior structural overhauls.

When should I not use the Gather Process Persist pattern?

You should avoid the Gather → Process → Persist pattern when refactoring overhead outweighs maintainability gains, such as in simple scripts with minimal calculations or trivial I/O where separating pure logic adds unnecessary architectural complexity.