Fp Guide

Use when writing functional-style code or reviewing for FP cleanliness. Triggers on prompts about pure functions, immutability, function composition, module-level functions, explicit context passing, avoiding inheritance, or stateless designs, even when the user doesn't say 'FP' or 'functional'.

xonovex a88b820 4 files · 9.1 KB Updated

File contents

General Functional Programming Guidelines

Core principles

  • Prefer module-level functions over classes; pass context explicitly; avoid inheritance.
  • Favor immutable data and pure functions; no global or shared mutable state.
  • Compose complex behavior from small, focused functions.

Gotchas

  • Closures over mutable state look pure but aren't: referential transparency requires both inputs and captured environment to be immutable
  • Partial application order matters: flip exists because curry direction is opinionated, not arbitrary

xonovex/platform/tree/main/packages/skill/skill-fp/fp-guide commit a88b820372

Frequently asked questions

npx skillmds@latest add xonovex/fp-guide