A two-layer extensibility pattern that makes Claude Code progressively self-correcting: hooks for real-time session feedback, skills for periodic infrastructure auditing (Luca Dellanna, Feb 2026).
## Layer 1 — Real-Time Hooks (intra-session)
- **Self-improvement injection**: a `userPromptSubmit` hook that detects sessions with 8+ tool calls and appends one optimization hint (reusable skill, memory pattern, workflow fix); skips exploratory sessions.
- **Conditional prompt linker**: appends a clarity check on long prompts, asking Claude to confirm the desired outcome.
## Layer 2 — Periodic Audit Skills (cross-session)
Skills audit (line counts + review prompts), CLAUDE.md audit (redundancy/verbosity), and reflect (extract learnings from a conversation) automate the "assess" and "compound" steps of the improvement loop.
## Design Principle
Trigger accuracy over hint content: a hook that fires on the wrong task type burns more tokens than no hook. Use script-based filtering, conditional skipping, and tool-call/word-count thresholds as activation gates.
## Related Concepts
- [[Compound Engineering Method]] — the macro loop this mechanizes
- [[Self-Improving Scheduled Agent Pattern]]
- [[Model-Invoked vs User-Invoked Skills Architecture]]
---
*Source: Luca Dellanna — [x.com/DellAnnaLuca](https://x.com/DellAnnaLuca)*