Automating Everything with Hooks
The most productive thing I did this year wasn't learning a new framework or adopting a new tool. It was automating the mechanical parts of my development workflow until they became invisible.
Claude Code hooks run code automatically at specific points in the development cycle: before a tool runs, after a tool runs, and when a session ends. Here's my full setup and why each hook exists.
the three hook types
PreToolUse — runs before a tool executes. I use these for validation and parameter modification. Before any file write, check that the target isn't a protected file. Before any git push, verify no .env files are staged.
PostToolUse — runs after a tool executes. After any file is written, auto-format it. After any test file is created, run it immediately. After any migration is applied, verify the schema.
Stop — runs when the session ends. Write the handoff document. Sync progress to Asana. Save decisions to Obsidian.
my active hooks
asana auto-sync (Stop hook)
Every session that makes meaningful changes automatically creates or updates Asana tasks. I never manually create tasks. The hook detects what changed (files edited, commits made) and either creates a new task or updates an existing one with the progress.
Trigger: Session end
Action: Analyze changes, create/update Asana task
Output: ~/.claude/logs/asana-sync.log
Before this hook, I'd finish a feature and forget to update the task board for days. Now the board is always current. When I check Asana in the morning, it reflects what actually happened, not what I remembered to log.
obsidian knowledge capture (Stop hook)
Research findings, architectural decisions, and lessons learned get automatically saved to my Obsidian vault. Organized by type: claude-research/, claude-decisions/, claude-learnings/, claude-context/.
This creates a persistent knowledge base that grows with every session. Three months in, I have hundreds of notes — design decisions with rationale, debugging discoveries, library evaluations, architecture tradeoffs. All searchable. All cross-referenced.
The value compounds. When I'm making a decision, I can search the vault for similar past decisions and see what I chose and why. This is institutional knowledge that normally lives in people's heads and evaporates when they leave.
working plan auto-update (Stop hook)
Every project has a WORKING-PLAN.md that reflects the current state: what's done, what's in progress, what's blocked. The hook updates it automatically based on the session's changes.
This replaces the "write a status update" ritual. The plan document is always current because it's updated by the system, not by me remembering to update it.
hooks I've tried and removed
Auto-commit on file save. Too noisy. Every small edit became a commit. The git history was useless. I replaced this with commit discipline — manual commits with conventional messages when a unit of work is complete.
Auto-lint on every file write. The formatting was fine but the hook fired dozens of times per session and added latency to every file operation. I moved linting to pre-commit instead.
Notification on every Asana update. Information overload. I don't need to be notified about tasks I created 30 seconds ago. The morning briefing covers everything.
building your own hooks
Hooks are defined in Claude Code's configuration. Each hook has a trigger (when it fires), a matcher (what it applies to), and an action (what it does):
{
"hooks": {
"Stop": [
{
"matcher": "",
"command": "~/.claude/scripts/hooks/asana-sync.sh"
},
{
"matcher": "",
"command": "~/.claude/scripts/hooks/obsidian-capture.sh"
}
]
}
}The scripts are regular shell scripts. They can do anything: call APIs, write files, send notifications, run commands. The hook system just ensures they fire at the right time.
the meta-lesson
Every task you do more than twice should be automated. Not because automation is fun — because manual tasks have a failure rate. You'll forget to update the task board. You'll forget to save the design decision. You'll forget to format the file.
Hooks make the right behavior automatic. The system does the mechanical work. I focus on the decisions.
Three hooks. No manual project management. No manual knowledge capture. No manual status updates. The overhead of "staying organized" dropped to zero.
More in Tools
My Claude Code Setup: 68 Commands, 15 Agents, 86 Skills
How I turned Claude Code into a complete engineering team in a terminal.
Supabase for Everything
Auth, database, edge functions, realtime, storage. One service replacing five. Here's how I use Supabase as my entire backend.
Local TTS at Zero Cost
Kokoro-82M: 337MB model, broadcast-quality speech, runs on a MacBook, costs nothing. Here's how to set it up.