C
ChaoBro

Agent Rules Books Rise: Turning Clean Architecture and DDIA into AI Agent Behavioral Guidelines

Agent Rules Books Rise: Turning Clean Architecture and DDIA into AI Agent Behavioral Guidelines

What Happened

In early May 2026, an open source project called Agent Rules Books appeared on GitHub (by @ciembor), quickly gaining 931 stars.

What this project does is simple but meaningful:

Extract the core principles of classic software engineering books and transform them into rule files that AI coding agents (Codex, Cursor, Claude Code) can directly read and execute.

Classics covered include:

  • Clean Architecture — Robert C. Martin
  • Refactoring — Martin Fowler
  • Working Effectively with Legacy Code — Michael Feathers
  • Designing Data-Intensive Applications (DDIA) — Martin Kleppmann

Each rule file comes in mini, nano, and full sizes, adapting to different context windows.

Why This Matters

1. From “Books Humans Read” to “Rules Agents Execute”

The core problem with software engineering classics: they’re written for humans, not for agents.

An AI coding agent can’t directly “read” a 400-page book and then consciously apply its principles. But if you extract the core rules from the book and turn them into structured rule files, the agent can automatically apply these principles every time it codes:

# Clean Architecture Rules (mini version)
- Dependency direction: inner layers don't depend on outer layers
- Interface segregation: high-level policies don't depend on low-level details
- Single responsibility: each module has only one reason to change
- Explicit boundaries: define architecture boundaries with interfaces

2. The Engineering Significance of Three Sizes

SizeContext UsageApplicable ScenarioRule Granularity
nano~500 tokensLightweight rules attached to every request5-10 most core principles
mini~2000 tokensProject-level .clinerules / .cursorrulesKey principles + examples
full~8000 tokensDeep code review / architecture reviewComplete rules + detailed descriptions

This reflects a core engineering challenge of AI coding tools in 2026: how to maximize the injection of engineering knowledge within limited context windows.

3. From “Prompt Engineering” to “Rules Engineering”

Over the past year, the best practice for AI coding was “write good prompts.” But prompts are temporary, manual, and easy to forget.

Agent Rules Books represents a paradigm shift:

2025: Manually write prompts each time → Unstable results
2026: Pre-set rule files → Agents automatically apply every time

Rule files (like .cursorrules, AGENTS.md, .clinerules) are becoming standard configurations for code repositories, just like .gitignore and README.md.

Covered Classics and Corresponding Rules

Classic BookCore Rules ExtractedAgent Behavior Impact
Clean ArchitectureDependency inversion, boundary definition, layered architectureGenerated code automatically follows layering principles
RefactoringExtract method, eliminate duplication, improve namingAutomatically identifies refactorable code segments
Working with Legacy CodeProtective encapsulation, feature envy identificationSafely modifies legacy code
DDIAData model selection, consistency trade-offsMore reasonable database design suggestions

Landscape Assessment

Why This Project Appears Now

  1. Maturation of AI coding tools: Codex, Cursor, Claude Code can now understand and execute complex rules
  2. Timing of rule file standardization: Platforms are starting to support project-level rule files (.cursorrules, etc.)
  3. Bottleneck of engineering knowledge injection: Prompts alone can’t transmit enough engineering knowledge
  4. Open source community’s collaboration tradition: Structuring and sharing engineering knowledge is the open source community’s strength

Trend Predictions

TimePrediction
2026 Q2More classics rule-ified: design patterns, SOLID, TDD, etc.
2026 Q3AI coding tools build in rule markets, one-click install industry best practices
2026 Q4Enterprises start customizing their own Agent Rules, forming internal coding standards
2027Agent Rules become standard for code repositories, job requirements include “can write Agent Rules”

This trend is highly consistent with LangChain’s recent discovery (same model, only changing Harness yields a 13.7 point boost):

  • Harness Engineering optimizes the Agent’s “execution framework”
  • Rules Engineering optimizes the Agent’s “behavioral guidelines”

Combined, these are the true reasons for the leap in AI coding capability in 2026.

Action Recommendations

For developers:

  • Add .cursorrules or AGENTS.md to your projects, injecting the engineering principles you endorse
  • Start with the nano version of Agent Rules Books, gradually expanding based on team needs

For team leaders:

  • Consider converting your team’s coding standards into Agent Rules files
  • This is more effective than writing lengthy development docs — because agents will actually execute these rules

For technical writers:

  • If you’ve read any software engineering classic, consider distilling it into Agent Rules
  • This is a new way of knowledge dissemination: not writing books, but writing rules

For tool developers:

  • Consider supporting standard formats for Agent Rules
  • Provide visual management and version comparison features for rule files