Home
cd ../playbooks
Developer ToolsBeginner

Simplicity First Code Gate

A hard correctness gate against over-complex or oversized code — one ordering principle (human readability first, agent traceability second), five enforceable rules, and a pre-finish checklist that treats unnecessary complexity as a bug, not a style opinion.

2 minutes
By OpenRLHFSource
#code-review#simplicity#engineering-principles#code-quality#readability

A diff that's twice the size it needs to be, or a helper class built for one call site, isn't a style nitpick — it's a comprehension defect that costs the next reader (human or agent) real time, and most reviewers have no crisp rule to point at when they feel it.

Who it's for: engineering teams tired of over-engineered PRs, tech leads writing a house style for AI-assisted code review, solo developers who want a concrete self-check before finishing a change, anyone reviewing diffs where 'this could be simpler' needs to become an enforceable rule instead of a vibe

Example

"Review this PR" → A structural check against five concrete rules (one-pass readability, no redundant code, fewest concepts, no single-call-site helpers, no capability deletion) instead of a vague 'looks complex' comment, plus a finishing checklist the author can run before ever opening the PR

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Simplicity First

A simplicity gate for every code change — written, fixed, or reviewed. Invoke it before writing any code change and when reviewing any diff. Treat over-complex or oversized code as a correctness bug, not a style preference.

## The Core Ordering

Human readability comes first; agent traceability is the minimum gate. A human should understand the code in one pass. An agent must at least be able to trace a feature from entry point to executed branch, data structure, and test without reconstructing hidden control flow. Every rule below is an instance of that ordering. These are hard correctness rules, not style preferences — a violation is a bug and must be fixed before the change ships.

## The Five Rules

1. **Code a human can't follow at a glance is a bug.** If a reviewer can't read a function top-to-bottom in one pass, restructure or delete it. Nesting, indirection, and clever constructs count against correctness — cleverness that costs comprehension is a defect, whatever it saves elsewhere.

2. **Too much or redundant code is a bug.** Solve the problem in the fewest lines that stay readable. Prefer deleting code over adding it. A fix that adds more than roughly 20 lines for a problem statable in one sentence is suspect — find the smaller fix first.

3. **Simplicity is the core engineering metric.** When two designs both work, ship the one with less code, fewer concepts, fewer files. Never add config, record types, or return-shape changes "for the future."

4. **No over-encapsulation.** No new class, dataclass, helper, or module for a single call site. A helper needs three or more real call sites *and* nontrivial logic — otherwise inline it. Never wrap trivial code. Never change a function signature or return shape to thread data that only one caller needs.

5. **Simplicity is not deletion of capability.** Features, performance knobs, and observability are intentional — do not remove them in the name of simplicity. Knobs that default ON stay ON. Simplify the implementation, keep the behavior surface.

## Checklist Before Finishing Any Change

- Would a human reading this cold understand it in one pass? That is the gate.
- Could this diff be half the size? If unsure, make it smaller.
- Any new class or file? Justify each with three or more call sites, or delete it.
- Any signature or return-shape change? Verify every caller genuinely needs it.
- Comments: concise "why" only, two to four lines max, written for an external reader — no job IDs, commit hashes, single-run metrics, or internal paths; keep upstream issue/PR links.
- One problem = one minimal diff. Do not batch unrelated "improvements."
- A "bug" that cannot trigger under the real recipes the code actually runs is not worth fixing.

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

A simplicity gate applied before writing any code change and while reviewing any diff, built on one ordering principle: a human should understand the code in one pass, and an agent must at minimum be able to trace a feature from entry point to executed branch, data structure, and test without reconstructing hidden control flow. Everything else follows from that ordering — five rules that turn "this feels over-engineered" into something concrete and checkable, treating unnecessary complexity and unnecessary size as correctness bugs rather than taste.

The five rules cover the ground that usually gets debated informally in review: illegible code counts against correctness even if it "works," redundant code is a bug with a rough size heuristic (~20 lines for a one-sentence problem is suspect), simplicity beats cleverness when two designs both work, helpers need three-plus real call sites to justify existing, and — critically — simplicity is never an excuse to delete a real feature, performance knob, or piece of observability. A short pre-finish checklist turns the rules into something you can actually run against a diff before opening the PR.


Quick Start

Step 1: Create a Project Folder

mkdir simplicity-gate && cd simplicity-gate

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Use It

claude

Ask Claude to write or review a change with this file present. It will apply the one-pass-readability test, flag oversized or redundant diffs, resist premature abstraction, and run the finishing checklist before calling the change done.


Tips & Best Practices

  • Apply it both directions: before writing code (design the smallest version first) and while reviewing (catch complexity that crept in during implementation).
  • The "three or more call sites" rule for helpers is deliberately strict — a helper with two call sites is usually cheaper inlined twice than maintained as an abstraction nobody else uses yet.
  • Simplicity is explicitly not an excuse to cut scope. If a rule ever seems to justify removing a real feature or a default-on safety knob, that's a misapplication — re-read rule five.

Limitations

  • A gate, not a design methodology — it tells you when a diff is too complex or too large, not how to architect the simpler alternative.
  • The size heuristics (roughly 20 lines, three-plus call sites) are starting points tuned for typical application code; a systems-level or highly parameterized codebase may need looser thresholds.
  • Works best as a shared, agreed-upon standard — applied inconsistently by only some reviewers, it becomes another subjective opinion instead of an enforceable gate.

$Related Playbooks

Developer Tools

Slidev Presentation Builder

Build developer-focused presentations with Slidev — Markdown-driven slides with live code, syntax highlighting, Monaco editor embeds, Mermaid/PlantUML diagrams, LaTeX math, click-based animations, and presenter notes, plus a quick-reference table for the exact syntax each feature needs.

5 minutes
Beginner
Developer Tools

Technical Writing Style Guide

Write docstrings, READMEs, commit messages, and PR descriptions that read like human technical documentation instead of LLM output — six concrete 'tells' with before/after rewrites, a smoothness diagnostic for prose that sounds authoritative while stating one fact three times, and industry-metaphor substitution tables ('surfaces' to 'raises/returns/logs', 'wired through' to 'passed as a parameter').

5 minutes
Intermediate
Developer Tools

Secret Scan and Rotation

Find committed credentials in a repository's working tree and full history, triage real secrets from test fixtures, and drive rotation-first remediation — with an absolute rule against ever printing a secret's actual value, even during the scan itself.

5 minutes
Intermediate
Developer Tools

Self-Improvement Loop Design

Design systems where the harness itself is the optimization target — an optimization ladder from prompt to context to workflow to harness code, a two-split empirical acceptance gate, an outside-the-loop invariant for the evaluator, and a catalog of documented reward-hacking and collapse failure modes.

10 minutes
Advanced
Developer Tools

Skill Security Inspector

Review an AI agent skill before installing it using two independent lines — static scanner evidence plus source-aware semantic judgment — checking purpose fit, permission fit, sensitive access, external transmission, execution risk, and persistence, down to a clear APPROVE, CAUTION, or REJECT verdict.

10 minutes
Intermediate
Developer Tools

Semantic Prompt Compression

Re-encode verbose system prompts, tool descriptions, and skill bodies into a dense telegraphic register — punctuation as connectives, label frames, verbless assertions — via re-encoding, not word deletion, with a density gate and a declared-loss verification pass.

5 minutes
Advanced
Developer Tools

Simplified Technical English for Docs

Write or rewrite technical documentation with the ASD-STE100 Simplified Technical English discipline — the aerospace maintenance-manual standard adapted for READMEs, runbooks, error messages, incident reports, and agent instructions.

10 minutes
Intermediate
Developer Tools

Subagent-Driven Development

Execute an implementation plan by dispatching a fresh subagent per task with a spec-and-quality review after each, a ledger that survives compaction, and a 'rulings not stalls' policy that keeps a running plan from waiting on a human at every fork.

10 minutes
Advanced
Developer Tools

Secure Coding Practices

A threat-model-first secure coding reference — trust-boundary mapping, a STRIDE quick-pass, a three-tier always/ask-first/never boundary system, and copy-paste prevention patterns for injection, XSS, broken access control, and SSRF.

10 minutes
Intermediate
Developer Tools

Security Guidance Review

Three-layer continuous security review for AI-generated code — instant regex warnings on edit, an LLM diff review at end of turn, and an agentic commit-time reviewer that traces data flow across files.

10 minutes
Advanced
Developer Tools

Shannon: Autonomous Pentesting for Your Own Apps

An operating guide for driving Keygraph's Shannon CLI: scope a white-box pentest against an app you own, run it, and turn the proven findings into fix tasks

15 minutes
Advanced
Developer Tools

Task Observer: One Skill to Rule Them All

A meta-skill that watches every work session, logs corrections and workflow patterns as skill candidates, and runs a review cycle that turns the log into new or improved skills

15 minutes
Advanced

Browse all Developer Tools playbooks →