# under-engineering

_The least code that works, checked before it’s written._

> Source: https://fullstack.rocks/skills/under-engineering
> Code: https://github.com/Fullstack-Rocks/skills/tree/main/skills/under-engineering

Coding agents over-build. Ask for rate limiting and you might get a new module with a `RateLimiter` class, a thread lock and a decorator factory. Each piece looks reasonable on its own, but together they leave code that’s deep, hard to trace and expensive to maintain.

**under-engineering is a checkpoint before any code is written.** The agent states the minimum requirement, cuts every planned piece that doesn’t map to it, and runs a hallway check (`um-maybe`) on what’s left. Then it sends you **one** message covering Depth (would the call chain go over 3?), Module (could other features reuse this?) and Governance (is this policy that belongs in infrastructure?).

While it writes, it keeps functions short and simple, uses no lookup-by-name calls, and measures every limit with `call-depth` instead of reading the code and guessing.

**Install**

Claude Code:

```shell
npx skills add Fullstack-Rocks/skills --skill under-engineering -a claude-code
```

Codex:

```shell
npx skills add Fullstack-Rocks/skills --skill under-engineering -a codex
```

Cursor:

```shell
npx skills add Fullstack-Rocks/skills --skill under-engineering -a cursor
```

Any agent:

```shell
npx skills add Fullstack-Rocks/skills --skill under-engineering
```

Prompt, to paste into your agent:

> Install the under-engineering skills from https://github.com/Fullstack-Rocks/skills by running npx skills add Fullstack-Rocks/skills, then load the under-engineering skill and follow it before you write or change code.

Install the four under-engineering skills together, since `under-engineering` calls `um-maybe` and `call-depth`. Want the checkpoint to run every time? Add one line to your `AGENTS.md` or `CLAUDE.md`: “Before writing or changing code, load the `under-engineering` skill and follow it.”

**Try saying**

- Add rate limiting to the orders API: at most 100 requests per minute per customer.
- Add an endpoint that applies a coupon to an order.
- Refactor the payment module.

![Claude Code session: asked to add rate limiting, the agent loads under-engineering and um-maybe, sends a checkpoint with Depth, Module and Governance sections that offers an API-gateway option next to the code option, then implements one small helper after the developer answers](https://storage.googleapis.com/fullstack-rocks-media/skill-under-engineering-demo-poster.png)

_[▶ Watch the recording: claude · demo shop](https://storage.googleapis.com/fullstack-rocks-media/skill-under-engineering-demo.mp4) — A real Claude Code session on the demo shop, recorded as it happened. Long thinking stretches are sped up, everything else plays at its real pace._

Transcript:

```
> Add rate limiting to the orders API: at most 100 requests per minute per customer.
Skill(under-engineering) · Skill(um-maybe)
Checkpoint: Depth, Module and Governance. Rate limiting is policy, so an API-gateway option comes next to the code option.
After the answer: one helper, over_rate_limit(customer_id), called on the first line of the three order handlers.
Checks: ruff passes, every function is small (at most 9 lines, complexity at most 4), and the 101st request in a minute returns 429.
Limits exceeded: none. Existing problems left alone: two env reads outside app/config.py, reported for you to decide.
```

## How does it work?

Two goals drive every step: the least code that works, and code a reader can follow without having to remember where they came from.

1. **Size the task.** A small task, like a rename, a typo, a new field or a one-line fix, skips straight to the limits.
2. **Find the minimum.** The agent states the minimum requirement in one or two sentences, cuts every planned piece that doesn’t map to it, and runs `um-maybe` on what’s left.
3. **Checkpoint.** Three checks, and any of them can hit. **Depth**: the planned step’s weighted call depth is over 3, so the agent reports the chain with 2 or 3 alternatives. **Module**: other features could reuse this, so it asks whether to build a module. **Governance**: the change enforces policy, so it offers an infrastructure option (a firewall, WAF, gateway or IAM rule) next to the code option.
4. **Module plan.** For a confirmed module the agent writes a plan in pseudocode. A readability scorer on a weaker model tries to use the module from the plan alone, and the plan gets revised until no key behavior is misread.
5. **Limits while writing.** Functions fit on one screen (about 80 lines), complexity stays under 10, files stay under 900 to 1000 lines, folders hold at most 5 or 6 code files, and every call resolves with go-to-definition.
6. **Report.** Every limit it went over and why, plus every violation it found in existing code but left for you to decide on.

Code the agent wrote in the session gets fixed right away. Violations in existing code are reported first, and only fixed once you approve.

```mermaid
flowchart TD
  A[Size the task] -->|small task| L
  A --> B[Find the minimum] --> UM[um-maybe<br/>hallway rounds]
  UM --> D[Depth over 3?<br/>call-depth trace]
  UM --> M[Module:<br/>reusable?]
  UM --> G[Governance:<br/>policy?]
  D --> Y[Checkpoint: one message<br/>to you]:::hi
  M --> Y
  G --> Y
  Y --> L[Limits while writing<br/>call-depth scan.py]
  L --> R[Report]
  classDef hi fill:var(--highlight),stroke:var(--highlight),color:var(--on-highlight)
```

_One checkpoint message before any code, and small tasks skip straight to the limits._

## But does it work?

**Benchmark · How much code does a feature take?**

Across three features the skill wrote 54% less code, 130 lines down to 60. A coupon went from 38 lines to 23, rate limiting from 59 to 24, and a CSV export from 33 to 13, and neither version introduced new smells. The checkpoint and the hallway check aren’t free though: the three features cost $3.38 with the skill, against $1.96 without. Same model (claude-opus-5-5), one run per feature.

![Lines added with under-engineering against Claude Code alone: a coupon 23 against 38, rate limiting 24 against 59, a CSV export 13 against 33. 130 lines down to 60, 54% less code.](https://storage.googleapis.com/fullstack-rocks-media/skill-under-engineering-proof.svg)

## The other skills

**The other skills**

- [um-maybe](https://fullstack.rocks/skills/um-maybe)
- [under-engineering-review](https://fullstack.rocks/skills/under-engineering-review)
- [call-depth](https://fullstack.rocks/skills/call-depth)
- [code-standards](https://fullstack.rocks/skills/code-standards)
