Clean code and architecture checklist
Every rule in the clean code and architecture playbook, by chapter, required rules first. Each links to its own page with how we built it and how to check it. This is a lot to check. An Expert can check it for you.
Code review
- Recommended ARC-1 Review the whole change against its base
- Recommended ARC-2 Check that it solves a named problem
- Recommended ARC-3 Prefer the patterns the industry knows
- Recommended ARC-4 Keep it simple to maintain
- Recommended ARC-6 Stay consistent with the codebase
- Recommended ARC-8 Write code that agents can parse
Names and functions
- Recommended ARC-11 Name things for what they mean
- Recommended ARC-13 Use names you can search for and say aloud
- Recommended ARC-14 Keep functions short
- Recommended ARC-15 Keep nesting shallow
- Recommended ARC-16 Pass few arguments
- Recommended ARC-17 Make each function do one thing
- Recommended ARC-18 Split blocks into named functions
- Avoid ARC-12 Misleading names
Comments
- Recommended ARC-19 Let the code explain itself
- Recommended ARC-20 Refactor clever code instead of explaining it
- Recommended ARC-22 Keep change history out of comments
- Recommended ARC-23 Say why, not what
- Recommended ARC-24 Keep docblocks only for what types cannot say
- Recommended ARC-25 Link every TODO to a ticket
Errors and nulls
- Required ARC-31 Never swallow errors
- Required ARC-32 Release every resource you open
- Required ARC-34 Cap every collection that grows with use
- Required ARC-69 Never use assertions for checks production needs
- Required ARC-82 Limit how deep code recurses on input
- Recommended ARC-26 Signal failure with an exception or a typed result instead of a code
- Recommended ARC-27 Use typed domain exceptions
- Recommended ARC-28 Return empty collections and one agreed absent value instead of null
- Recommended ARC-30 Make fields required unless absence is valid
- Avoid ARC-29 Passing null to mean a default
Coupling
- Required ARC-38 Pass state in instead of sharing globals
- Recommended ARC-35 Talk only to your direct neighbours
- Recommended ARC-36 Tell objects what to do
- Recommended ARC-37 Make the order of calls impossible to get wrong
- Recommended ARC-39 Keep internals private
- Recommended ARC-83 Keep side effects at the edges
SOLID and DRY
- Recommended ARC-41 Keep each piece of knowledge in one place
- Recommended ARC-42 Give each module one reason to change
- Recommended ARC-43 Extend code without editing it
- Recommended ARC-44 Keep the contract in every subtype
- Recommended ARC-45 Prefer composition over inheritance
- Recommended ARC-46 Keep interfaces small
- Recommended ARC-47 Depend on abstractions at the edges
- Recommended ARC-48 Build only what is needed now
Data shapes
- Required ARC-53 Parse input once at the boundary
- Required ARC-70 Stop integer arithmetic from overflowing
- Recommended ARC-49 Use typed objects instead of loose arrays
- Recommended ARC-50 Wrap domain values in their own types
- Recommended ARC-52 Convert to arrays and JSON only at the edge
- Recommended ARC-54 Make data objects immutable
- Recommended ARC-55 Model each state as its own type
- Recommended ARC-56 Use enums instead of magic strings
- Recommended ARC-57 Give each function one return type
- Recommended ARC-58 Insert text literally when you replace
- Recommended ARC-71 Keep equality and hashing in step
- Recommended ARC-72 Keep the time zone on every time
- Recommended ARC-73 Compare floating-point numbers with a tolerance
- Avoid ARC-51 Typing values as mixed or any
Structure
- Recommended ARC-63 Point dependencies inward
- Recommended ARC-64 Allow no dependency cycles
- Recommended ARC-65 Group code by feature
- Recommended ARC-66 Name files after what they hold
- Recommended ARC-67 Format all code with one tool
- Recommended ARC-84 Keep generated code apart and never edit it by hand
- Recommended ARC-85 Split off a service only for a written reason
- Recommended ARC-59 Delete code that nothing uses
- Recommended ARC-60 Remove flags that never change
- Recommended ARC-61 Remove unused dependencies
- Recommended ARC-62 Delete tests with their feature
Domain model
- Recommended ARC-74 Give each bounded context its own model and words
- Recommended ARC-75 Change an aggregate only through its root
- Recommended ARC-76 Change one aggregate per transaction
- Recommended ARC-77 Translate outside models at the boundary
Concurrency
- Required ARC-33 Await every async call
- Required ARC-40 Guard state that concurrent code shares
- Recommended ARC-78 Pass a cancel signal through every call chain
- Recommended ARC-79 Start tasks only inside a scope that waits for them
- Recommended ARC-80 Take locks in one written order
- Avoid ARC-81 Holding a lock while waiting on the network
System architecture
- Recommended ARC-86 Write each quality goal as a scenario with a number
- Recommended ARC-87 Check each architecture decision with a fitness function
- Recommended ARC-89 Choose how fresh each piece of shared data must be
- Recommended ARC-90 Give each outside dependency its own pool
- Recommended ARC-91 Run a change across services as a saga with undo steps
Technical debt
- Recommended ARC-92 Keep a debt register in the repository
- Recommended ARC-93 Spend a set share of each cycle on debt
- Recommended ARC-94 Record a shortcut when you take it
- Recommended ARC-95 Rank debt by how often the code changes
Related playbooks
Show the badge on your project
When your project passes every Required rule, you can show this badge on your site or in your README. It links to this checklist, so anyone can run the same checks.
<a href="https://agentwranglers.se/playbook/architecture/checklist"><img src="https://agentwranglers.se/badge.svg" alt="Checked against the Agent Wranglers clean code and architecture playbook" width="214" height="20"></a>
[](https://agentwranglers.se/playbook/architecture/checklist)
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/architecture/checklist">Agent Wranglers clean code and architecture playbook</a>. In code you write, add a comment next to it with the same link.