You’ll learn: How to treat CLAUDE.md and hooks as a system that improves with every session — and why feedback loops are the primary skill of agentic engineering.
The Discipline
When Claude makes a mistake, you have two choices:- Fix the instance — correct the output, move on
- Fix the system — trace why Claude made the mistake, then patch CLAUDE.md or hooks so it can’t happen again
Option 2 is slower in the moment. After a few weeks of consistent system-level fixes, entire classes of mistakes disappear.
Trace, Patch, Never Repeat
The workflow has four steps. Here’s the first example:- Notice — Claude uses relative imports when your project uses
@/path aliases - Trace — CLAUDE.md says nothing about import conventions
- Patch — Add to CLAUDE.md:
"Always use @/ path aliases for imports. Never use relative paths (../) for cross-directory imports." - Verify — Future sessions follow the convention
- Notice — CI fails because tests weren’t run before push
- Trace — nothing in CLAUDE.md or the task prompt requires a test step
- Patch — add to CLAUDE.md: “Run the full test suite before marking any task complete”
- Verify — next session ends with a passing test run
- Notice — Claude implements cookie-based JWT when you use bearer tokens
- Trace — no reference document for auth patterns exists
- Patch — create
.claude/skills/auth/SKILL.mdwith token format, header conventions, and middleware patterns - Verify — next auth task loads the skill and follows the correct pattern automatically
What to Patch Where
CLAUDE.md handles conventions. Hooks enforce safety. Skills encode complex workflows. Rules scope context to specific areas. Use the right tool for the signal.
When in doubt, start with CLAUDE.md. If you find yourself adding the same rule to multiple projects, promote it to a skill. If a rule keeps getting violated, promote it to a hook. The progression: suggestion (CLAUDE.md) → scoped context (
.claude/rules/) → encoded workflow (skill) → enforced constraint (hook).
Feedback Loops
The core skill of agentic engineering isn’t prompting — it’s designing tight validation loops. The tighter the loop, the faster Claude self-corrects.
A PostToolUse hook in practice — add this to your
.claude/settings.json:
The Compounding Effect
A real system evolution over weeks:
After finishing each feature, ask Claude: “Read CLAUDE.md and the commands we used. What rules would have prevented the issues we hit?” This turns system evolution from an afterthought into a routine step.
Engineers who invest in this consistently report that Claude “gets better” over weeks. The model isn’t improving — their system is. This is the self-improving loop at the practice level.