---
title: "Names and functions · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/names-and-functions
updated: 2026-10-20
licence: "All rights reserved"
---

# Names and functions

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Names that say what things are, and small functions that each do one thing. Short, shallow and with few arguments, so anyone can read them at a glance.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/names-and-functions`.

## Required

- [Name things for what they mean](https://agentwranglers.se/playbook/architecture/names-and-functions/intention-revealing-names): Every name says why the thing exists, what it does and how it is used. A reader should never need a comment to learn what a name means.
- [Never let a name mislead](https://agentwranglers.se/playbook/architecture/names-and-functions/no-disinformation): A name must never suggest a type or behaviour the code does not have. Calling a set a list, or a lookup a getter that writes, misleads every reader.
- [Keep functions short](https://agentwranglers.se/playbook/architecture/names-and-functions/small-functions): Keep each function at 20 lines or fewer. A longer function nearly always does more than one thing.
- [Keep nesting shallow](https://agentwranglers.se/playbook/architecture/names-and-functions/shallow-nesting): Nest blocks at most two levels deep in business logic. Deep nesting hides which branch runs and when.
- [Pass few arguments](https://agentwranglers.se/playbook/architecture/names-and-functions/few-arguments): Give a function at most three arguments. When it needs more, pass one named object that groups them.
- [Make each function do one thing](https://agentwranglers.se/playbook/architecture/names-and-functions/one-thing-per-function): Each function does one thing at one level of detail. A function either changes something or answers a question, never both.

## Recommended

- [Use names you can search for and say aloud](https://agentwranglers.se/playbook/architecture/names-and-functions/searchable-names): Use whole words that people can pronounce and search for. Replace magic numbers and strings with named constants.
- [Split blocks into named functions](https://agentwranglers.se/playbook/architecture/names-and-functions/extract-and-name): When a block of code needs a moment of thought, move it into a function whose name says what it does.

- Previous: [Code review](https://agentwranglers.se/playbook/architecture/code-review)
- Next: [Comments](https://agentwranglers.se/playbook/architecture/comments)
- [All chapters](https://agentwranglers.se/playbook/architecture)
