fp-higher-order-functions

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

A functional-programming guide to higher-order functions, which are functions that accept other functions or return them.

In plain words
What is it for?
Use it for repeated map, filter, reduce, callback, middleware, event-handler, or plugin patterns.
Why use it?
It helps remove repeated loop code while keeping the part that varies as a reusable function.

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 for repeated map, filter, reduce, callback, middleware, event-handler, or plugin patterns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/helmedeiros/clean-code-skills/fp-higher-order-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-higher-order-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-higher-order-functions

README.md
[![agentmods](https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-higher-order-functions/github.svg)](https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-higher-order-functions)
Your own site
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-higher-order-functions"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-higher-order-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-higher-order-functions

Your own site · 80×15
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/fp-higher-order-functions"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/fp-higher-order-functions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 706 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.00050 $0.00706
Opus 5 $0.00025 $0.00353
Sonnet 5 $0.00010 $0.00141
Haiku 4.5 $0.00005 $0.00071

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

Security

Grade A, and why

fp-higher-order-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-higher-order-functions/SKILL.md · 75 lines

How it starts

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

FP: Higher-Order Functions

Use functions that accept or return other functions to abstract common patterns, reduce duplication, and build composable operations.

When This Skill Applies

  • Repetitive loop patterns differ only in the operation applied
  • The user mentions map, filter, reduce, higher-order functions, or callbacks
  • Functions share structure but vary in one specific behavior
  • The user wants to reduce boilerplate in collection processing
  • Custom event handlers, middleware, or plugin systems are being designed

Core Principle

A higher-order function (HOF) either takes a function as an argument or returns a function as its result. HOFs capture common patterns (iteration, transformation, filtering, composition) and parameterize the varying part. This eliminates structural duplication and creates reusable, composable building blocks.

Workflow

Step 1: Identify the Pattern

Find two or more code blocks that share the same structure but differ in one operation. The shared structure is the HOF; the varying operation becomes the function argument.

Step 2: Extract the Higher-Order Function

Create a function that takes the varying behavior as a parameter. Replace the duplicated code blocks with calls to the HOF, passing the specific behavior.

Step 3: Use Built-in HOFs Where Possible

Most languages provide map, filter, reduce, forEach, flatMap, find, some, every. Use these instead of writing manual loops.

Step 4: Compose HOFs

Chain HOFs to build complex operations from simple ones. Each step in the chain does one thing. The pipeline reads as a description of the transformation.

Step 5: Verify Readability

If the HOF chain is hard to read, extract intermediate steps into named variables or named functions. The goal is clarity, not cleverness.

Detection / Indicators

  • For-loops that transform, filter, or accumulate — replace with map, filter, reduce
  • Multiple functions with identical structure except for one operation
  • Callback patterns that could be generalized
  • Manual iteration where a declarative pipeline would be clearer
  • Code that creates closures over configuration

Read the full file on GitHub · 75 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 · 75 lines · 50 tokens per session scan A 9e79906ad172

Subscribe to this mod's changes

fp-higher-order-functions is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 50 tokens to every session and 706 once invoked, about $0.0003 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