kp-higher-order-functions

Installation
SKILL.md

One-line summary

Treat functions as first-class values — pass them as parameters, return them, store them, compose them — and understand Kotlin's inline machinery for keeping the cost negligible.

When to use this skill

  • Designing an API that takes a function parameter (the canonical case: list.map { … }, withResource { … }).
  • Returning a function from another function (currying, partial application, function factories).
  • Wrapping work with a setup/teardown function that takes the work as a lambda (use { … }, runBlocking { … }).
  • Anywhere a small interface with one method would otherwise be required — a Kotlin function type usually beats it.

When NOT to use this skill

  • The function takes many parameters with names that matter — a regular function or a data class is more readable than a (A, B, C, D) -> R.
  • The "function" carries state — that's not a function, that's an object; design it as such.
  • The function must be exposed across a module boundary in a way that prevents inline — inline only works for callers in the same compilation, so cross-module APIs may want to be regular functions.

Core content

Installs
1
GitHub Stars
1
First Seen
Jul 13, 2026
kp-higher-order-functions — yonatankarp/software-design-skills