fp-pure-functions

fp-pure-functions is a skill for Claude Code from helmedeiros/clean-code-skills. It costs 49 tokens per session (781 once invoked), scanned A, original, MIT.

A functional-programming guide for pure functions and immutable data. A pure function gives the same result for the same inputs and does not change outside state.

In plain words
What is it for?
Use it to find functions that rely on or modify globals, files, databases, network calls, time, or random values, and separate those effects from calculations.
Why use it?
It makes code easier to predict, test, debug, and reuse by keeping hidden changes out of core logic.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the clean-code-skills plugin — 21 skills, 2 commands shipped together

Good fit Use it to find functions that rely on or modify globals, files, databases, network calls, time, or random values, and separate those effects from calculations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/helmedeiros/clean-code-skills/fp-pure-functions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add helmedeiros/clean-code-skills --skill fp-pure-functions
Clone the repo
git clone --depth 1 https://github.com/helmedeiros/clean-code-skills

Made for: Claude Code.

Or install clean-code-skills, the plugin that ships this one along with the rest of its 21 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fp-pure-functions

README.md
[![agentmods](https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-pure-functions/github.svg)](https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-pure-functions)
Your own site
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-pure-functions"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-pure-functions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fp-pure-functions

Your own site · 80×15
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-pure-functions"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-pure-functions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 781 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.00781
Opus 5 $0.00024 $0.00391
Sonnet 5 $0.00010 $0.00156
Haiku 4.5 $0.00005 $0.00078

Measured 9d ago against content hash 7c723f0bed61, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

fp-pure-functions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/fp-pure-functions/SKILL.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FP: Pure Functions and Immutability

Write functions that depend only on their inputs and produce no side effects, combined with immutable data structures, to create predictable, testable, and composable code.

When This Skill Applies

  • Functions modify external state (global variables, databases, files)
  • Functions produce different results for the same inputs
  • The user mentions pure functions, immutability, or side effects
  • Testing requires complex setup due to hidden dependencies
  • Debugging is hard because state changes are scattered

Core Principle

A pure function has two properties: (1) given the same inputs, it always returns the same output, and (2) it produces no side effects. Combined with immutable data (data that cannot be changed after creation), pure functions make programs easier to reason about, test, and parallelize. Push side effects to the edges of the system and keep the core logic pure.

Workflow

Step 1: Identify Impurities

Find functions that read or modify external state: global variables, instance fields, database, filesystem, network, current time, random numbers. These are side effects.

Step 2: Separate Pure Logic from Side Effects

Extract the pure computation into its own function. The impure function becomes a thin shell that gathers inputs, calls the pure function, and applies the outputs.

Step 3: Make Data Immutable

Replace mutation (obj.field = value) with creation of new objects ({ ...obj, field: value }). Use const instead of let. Return new collections instead of modifying existing ones.

Step 4: Pass Dependencies as Arguments

Replace hidden dependencies (global config, singletons, current time) with explicit function parameters. The caller provides the values.

Step 5: Verify Purity

A function is pure if you can replace the call with its return value (referential transparency). Run the test suite — pure functions need only input/output assertions, no mocks.

Detection / Indicators

  • Function reads from or writes to global variables
  • Function calls Date.now(), Math.random(), or reads environment variables
  • Function modifies its input parameters
  • Function result changes depending on when or how often it is called
  • Testing requires mocking side-effecting dependencies
  • Variables declared with let and mutated throughout a function

Read the full file on GitHub · 79 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 79 lines · 49 tokens per session scan A 7c723f0bed61

Subscribe to this mod's changes

fp-pure-functions is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 49 tokens to every session and 781 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

re0-git

Rewrite a finished commit's message into a clean, handoff-ready form in your own log style, so git log alone tells the story. User-invoked: run it after a commit.

LilMGenius/paperthin · 46 tokens

debloat

Compress an artifact that has accreted into bloat — padding, over-qualification, fused sentences, walls of enumeration, adjacent restatement — down to its load-bearing density, meaning preserved. Use when prose is correct and current but has grown verbose or patched-over and you want it tight without a full rewrite.

LilMGenius/paperthin · 66 tokens

prism

Split one artifact — a claim, plan, or file — across 2 to 5 independent lenses, one per genuinely distinct failure mode (correctness, security, readability, cost, adversarial-user), and return their convergence: where they agree, where they disagree, and the single next question that resolves the disagreement. Use…

LilMGenius/paperthin · 98 tokens

codex-setup

Initialize sd0x-dev-flow infrastructure for Codex CLI and other non-Claude agents. Generates AGENTS.md, installs the commit-msg hook, copies runner scripts. The pre-push gate is opt-in via --with-push-gate. Use when setting up a new project or after updating skills.

sd0xdev/sd0x-harness · 65 tokens

recap-doc

Post-development recap document generator. Use when: AI/Codex has implemented a feature and the user needs a guided walkthrough of what changed and why, with blind-spot detection and anticipated questions. Not for: Q&A follow-up (use /recap-ask), technical share-out for teammates (use /tech-brief), or generic code…

sd0xdev/sd0x-harness · 114 tokens

runbook

Generate and update feature release runbooks from existing docs and codebase. Use when: creating operational runbook, release handbook, deployment checklist, pre-release preparation. Not for: incident response (v2), code review (use codex-code-review), architecture design (use architecture).

sd0xdev/sd0x-harness · 59 tokens