惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
J
Java Code Geeks
S
SegmentFault 最新的问题
L
LangChain Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
H
Help Net Security
阮一峰的网络日志
阮一峰的网络日志
Jina AI
Jina AI
N
Netflix TechBlog - Medium
A
About on SuperTechFans
博客园 - 叶小钗
美团技术团队
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Hooks vs Skills in Claude: the difference that defines sy...
guillermodv · 2026-05-07 · via DEV Community

In the Claude agent ecosystem, two concepts look similar on the surface but serve fundamentally different roles. Only one of them gets talked about.

Skills get all the attention — and fairly so. They're easy to grasp: write a markdown file, define a workflow, and you're done. The agent detects it as a reusable pattern. It's like teaching the agent how to do something. Clear input, clear output, shareable across teams.

Hooks are a different story.

"Skills tell the agent what it can do. Hooks tell the agent what it must — and must not — do."

The problem: nobody is talking about hooks

Hooks like PreToolUse, PostToolUse, Notification, and Stop live at the edges of execution. They don't add new capabilities. Instead, they govern agent behavior — and that distinction is everything.

Skills Hooks
Role The "how" The "this far and no further"
Purpose Structured instructions for solving tasks Execution rules that apply unconditionally
Examples Analyze a repo, generate an endpoint, transform a PDF If something fails twice, STOP. Re-evaluate and report.
Scope Reusable, shareable, scale across teams Global — applies regardless of the task

The mental model isn't intuitive. People prefer adding capabilities over constraining them. There's no "hook marketplace." Hooks don't look like features. And they require real operational experience to design — they emerge from mistakes, not theory. That's exactly why most teams skip them.

Hooks as encoded memory

Think of hooks as lessons learned converted into code. Every time an agent:

  • Re-reads files unnecessarily
  • Explores irrelevant code paths
  • Generates bloated output with no real value
  • Insists on a strategy that isn't working

...that failure is a candidate for a hook.

A real hook rule

// PreToolUse — read-once hook
if (file_already_read && !file_modified) {
  block_execution()
  return "validate.ts is already in context"
}
// 0 tokens consumed. 0 extra latency.

Enter fullscreen mode Exit fullscreen mode

Over time, your hooks stop being patches and start being quality standards. The agent doesn't need to be reminded. It simply cannot do certain things.

The real cost: token consumption follows a power law

There's a data point that tends to get buried: a small set of bad behaviors generates the majority of cost in Claude agents. Skills don't address this. Hooks do, because they attack the behavior, not the capability.

Metric Impact
Cost from file re-reads 40–60%
Loops without a stop hook
Tokens if hook blocks the call 0

Where exactly does a hook act?

To understand why hooks are powerful, you have to understand the Claude tool execution cycle. Every time the agent wants to take an action — read a file, run a command — it passes through four stages:

Hook Stage Problem it solves Why this stage
PreToolUse Before action Redundant reads, bad strategy Intercepts before the cost exists
PostToolUse After action Logging, validation, output trimming Tokens already spent — observation only
Notification Global events Alerting, monitoring No real control, observation only
Stop Termination Infinite loops, repeated failures Hard exit — prevents runaway agents

"Hooks are powerful not because of what they do, but because of when they act. read-once works because it cuts the problem before it exists."

If read-once were a PostToolUse hook, the file would already be read, the tokens already spent. As a Skill, it wouldn't be global — it could be bypassed outside the defined workflow. PreToolUse is the only stage that intercepts before the cost is incurred and applies unconditionally.

The combination that actually works

The most robust Claude agent setups today don't choose between skills and hooks — they combine them deliberately, with subagents for complexity scaling.

Skills → Productivity → What gets done Hooks → Discipline → How it gets done Subagents → Scale → How far it goes

Productivity without discipline scales chaos. Skills without hooks produce capable agents that are also unpredictable, expensive, and hard to trust in production.

The teams building reliable agent systems are the ones investing in both — and in the operational experience needed to know which behaviors deserve a hook.


Conclusions.

"Maturity in an agent system isn't measured by how many skills it has. It's measured by how well it knows when to stop."

“The one who does not have a memory creates one of paper.” Gabriel García Márquez.

Thanks for your time!
Guillermo A. Del Vecchio.