Skip to content
Shell
6.2 KB
Raw Blame

PM-Friendly Hooks: Your Technical Autopilot

The Big Picture

These hooks handle all the boring technical stuff automatically, so you can focus on what you want built, not how to build it.


πŸš€ Auto Git Workflow

What it does: Creates feature branches automatically when you start building something new

When you say: "Add a login button" What happens:

  1. βœ… Detects this is a new feature
  2. 🌿 Creates branch: feature/add-login-button
  3. πŸ’‘ Tells you: "Working on a feature branch, will PR when done"

Why you care: No more working on main branch. Everything stays organized. Easy to review changes before going live.


πŸ“¦ Auto Commit

What it does: Saves progress automatically at smart milestones

What happens:

  • After ~5 files change β†’ Claude stages and commits with a clear message
  • Example: "feat: Add user authentication flow with email validation"

Why you care:

  • Can roll back to any point if something breaks
  • Clear history of what was built when
  • No more "save my work" stress

πŸ“ Auto Documentation

What it does: Creates plain-English docs explaining what was built

What happens:

Claude builds: LoginButton.tsx
Hook triggers: "New component detected"
Claude writes: "Login Button - Handles user authentication.
               Displays loading state. Shows errors clearly."

Why you care:

  • Understand what exists without reading code
  • Onboard new team members faster
  • Remember what things do months later

β™Ώ Accessibility Check

What it does: Makes sure everything works for everyone (screen readers, keyboards, etc.)

Checks for:

  • βœ… Buttons have descriptive labels
  • βœ… Images have alt text
  • βœ… Forms are keyboard-navigable
  • βœ… Color contrast is readable

Why you care:

  • Reach more users (20% of people have disabilities)
  • Avoid lawsuits (ADA compliance)
  • Better SEO (Google loves accessible sites)

⚑ Performance Alert

What it does: Warns about slow code patterns

Catches:

  • 🐌 Inline functions causing re-renders
  • 🐌 Large lists without pagination
  • 🐌 Missing optimization opportunities

Why you care:

  • Faster app = happier users
  • Better mobile experience
  • Lower bounce rates

πŸš€ Deployment Check

What it does: Verifies everything works before going live

Before creating PR, checks:

  • βœ… Production build succeeds
  • βœ… Environment variables configured
  • βœ… Vercel/deployment ready

Why you care:

  • Catch deployment issues before users do
  • No "works on my machine" surprises
  • Confident deploys every time

πŸ“Š Progress Report

What it does: Shows real-time updates as Claude works

Shows you:

πŸ“Š Progress Update:
   - Files modified: 7
   - Latest: components/LoginForm.tsx
   - Tests: βœ… Passing

Why you care:

  • Know work is actually happening
  • See what's being changed
  • Track complexity of the feature

🎯 How These Work Together

Example: "Add user profiles with avatars"

1. You ask β†’ Hook creates feature branch
2. Claude codes β†’ Progress reports show updates
3. Files saved β†’ Auto-commit at milestones
4. UI built β†’ Accessibility check ensures usability
5. Component done β†’ Auto-docs explain what it does
6. Ready to ship β†’ Deployment check verifies build
7. PR created β†’ You review plain-English summary

πŸŽ›οΈ Customization Guide

Making Hooks More/Less Strict

More alerts (perfectionist mode):

# Edit ~/.claude/hooks/accessibility-check.sh
# Change: exit 0 β†’ exit 1
# Now accessibility issues block progress

Fewer interruptions (speed mode):

# Edit ~/.claude/hooks/performance-alert.sh
# Comment out checks you don't care about

Adjusting Auto-Commit Frequency

# Edit ~/.claude/hooks/auto-commit.sh
# Line: if [ "$CHANGES" -ge 5 ]; then

# More frequent: Change 5 β†’ 3
# Less frequent: Change 5 β†’ 10

Custom Checks for Your Stack

Example: Add Tailwind class checking

# Create ~/.claude/hooks/tailwind-check.sh
if grep -q "className=" "$FILE_PATH"; then
  if grep -qE "(style=|css=)" "$FILE_PATH"; then
    echo "⚠️  Mix of Tailwind + inline styles detected"
  fi
fi

πŸ”§ Troubleshooting

"Hooks seem slow"

# Check which hook is taking time
time ~/.claude/hooks/verify-after-write.sh path/to/file.tsx

"Too many alerts"

# Temporarily disable specific hooks
mv ~/.claude/hooks/performance-alert.sh ~/.claude/hooks/performance-alert.sh.disabled

"Hook failed but not sure why"

# Run hook manually to see full output
~/.claude/hooks/accessibility-check.sh components/Button.tsx

πŸ’‘ Pro Tips

1. Reading Hook Feedback

  • βœ… = Passed check, all good
  • ⚠️ = Suggestion, not blocking
  • ❌ = Failed, Claude will fix
  • πŸ’‘ = Helpful tip

2. When to Disable Hooks

  • Quick experiments: Disable auto-commit
  • Prototyping: Disable accessibility checks
  • Emergency fixes: Disable deployment checks
  • Never disable: Verification hooks (ensure code works)

3. Best Workflow

  1. Start feature: Let auto-branch work
  2. During build: Monitor progress reports
  3. Before review: Check auto-docs were created
  4. Before merge: Verify deployment check passed

🎬 Real Example

You: "Build a comment system with replies"

Behind the scenes:

🌿 Auto-branch: feature/build-comment-system-with-replies
πŸ“Š Progress: Creating Comment.tsx (1/5 files)
β™Ώ Accessibility: Adding keyboard navigation
πŸ“¦ Auto-commit: "feat: Add comment component structure"
πŸ“Š Progress: Creating Reply.tsx (2/5 files)
⚑ Performance: Optimizing render with React.memo
πŸ“¦ Auto-commit: "feat: Add reply threading logic"
πŸ“ Auto-docs: Creating component documentation
βœ… All checks passed!
πŸš€ Ready for PR

What you see: "Comment system complete! βœ… Keyboard accessible, optimized performance, documented. Ready to review PR."


πŸ“š Next Level Hooks (Future Ideas)

  • Auto Testing: Generate test cases from your description
  • Cost Estimation: Warn about expensive API calls
  • SEO Check: Verify meta tags and structure
  • Mobile Preview: Auto-screenshot on device sizes
  • Changelog: Auto-update release notes

Want any of these? Just ask! πŸš€