prefer-named-functions

Installation
SKILL.md

Prefer Named Functions Over Anonymous Functions

Goal

When defining a function, prefer a named function over an anonymous one, regardless of the technology stack.

A named function is any callable whose definition is bound to an explicit, descriptive identifier visible at its definition site (a function declaration, a named function expression, an arrow function or lambda assigned to a const/val/let with a meaningful name, a named method, or a named local helper). An anonymous function is a callable defined inline without a stable, descriptive identifier — typically a lambda, arrow function, block, or function expression passed directly as an argument or returned without being bound to a name.

Named functions improve stack traces, code navigation, searchability, reuse, testability, and the reader's ability to understand intent without parsing the body. Anonymous functions are still appropriate when the stack expects them or when naming would actively hurt readability.

What Counts as In Scope

Apply this skill to code that does one or more of these things:

Installs
13
First Seen
Apr 17, 2026
prefer-named-functions — code-sherpas/agent-skills