agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/hooks-reference/SKILL.md

hooks-reference

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: hooks-reference

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Fix the hook, don't bypass the system: If a hook is blocking legitimate work:

    line 38
  2. Very specific:

    Check the bypass tier in .claude/rules/bypass-governance.md — Tier 1 bypasses require user approval

    line 40
  3. Distinctive:

    Test files without ABOUTME comments

    line 62
  4. Very specific:

    All bypass invocations emit bypass_used events for audit.

    line 85
  5. Very specific:

    All hook scripts are in .claude/hooks/ and can be modified to adjust behavior.

    line 89
  6. Very specific:

    When a Claude Code session ends, archive-plan.sh preserves the current plan file.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

name: hooks-reference description: Reference for project hook configuration. Use when understanding pre/post tool hooks, modifying quality gates, or debugging why a hook blocked an action.

Claude Code Hooks Reference

This project uses Claude Code hooks (configured in .claude/settings.json) to enforce coding standards automatically.

Active Hooks

HookEventPurpose
pre-write-validate.shPreToolUse (Write/Edit)Blocks credentials, magic test numbers, learnings bulk-clear, worktree isolation; warns on naming
pre-bash-validate.shPreToolUse (Bash)Blocks --no-verify, worktree commits, pending-actions, validates deploy
post-write.shPostToolUse (Write/Edit)Auto-lints JS/TS files, tracks files to .session-files, increments tool-call counter
flywheel-doc-check.shPostToolUse (Write/Edit)Suggests doc updates based on 4 sources (git status, commits, session-files, pattern-db)
post-bash.shPostToolUse (Bash)Logs deploy/test completions, increments tool-call counter
subagent-log.shSubagentStopLogs workflow activity, triggers flywheel
teammate-idle-check.shTeammateIdleQuality gate before teammate goes idle
task-completed-check.shTaskCompletedTDD/coverage/credential gate on task completion
session-checklist.shStopWarns about uncommitted changes, unpushed commits, stale learnings, MEMORY.md size
archive-plan.shStopArchives plan files with metadata
notify-ready.shStopDesktop notification when done
pre-compact.shPreCompactCreates compaction marker for post-compact-summary
session-start-log.shSessionStart (all)Logs session starts, 8 bootstrap checks (env, CLI, stale session, exercises, updates, context hub, codebase smoke test, MEMORY.md auto-prune), context loading, resets session tracking
post-compact-summary.shSessionStart (compact)Extracts compaction summary from transcript
_meta-mode.sh(sourced by other hooks)Helper: detects .meta/ directory, sets environment-aware paths
flywheel-session-summary.sh(sourced by other hooks)Helper: generates session summary for flywheel processing

When a Hook Blocks You

Fix the hook, don't bypass the system. If a hook is blocking legitimate work:

  • Open a separate Claude window and fix the hook behavior
  • Check the bypass tier in .claude/rules/bypass-governance.md — Tier 1 bypasses require user approval
  • NEVER rename .meta/ to disable meta mode — this breaks all session routing

What Gets Blocked (Exit Code 2)

  • Hardcoded Twilio credentials (AC..., SK..., auth tokens)
  • git commit --no-verify or git commit -n
  • git commit with unaddressed pending-actions.json (override: SKIP_PENDING_ACTIONS=true)
  • git commit with TypeScript compilation errors in staged .ts/.tsx files (override: SKIP_TSC_CHECK=true)
  • File writes to repo paths when not in a worktree (override: CLAUDE_ALLOW_MAIN_WRITE=true)
  • git commit when not in a worktree (override: CLAUDE_ALLOW_MAIN_WRITE=true)
  • git push --force to main/master
  • Deployment when tests fail
  • Deployment when coverage < 80% (statements or branches)
  • Deployment when linting fails
  • New function files without ABOUTME comments
  • Twilio magic test numbers (+15005550xxx) in non-test files

What Gets Warned (Non-blocking)

  • Non-evergreen naming patterns (ImprovedX, NewHandler, BetterY, EnhancedZ)
  • High-risk assertions in CLAUDE.md files without citations
  • Test files without ABOUTME comments
  • .meta/ references in staged changes (potential leakage)

Commit Checklist

On every git commit, the hook displays a reminder checklist:

  • Updated .meta/todo.md?
  • Captured learnings in .claude/learnings.md?
  • Design decision documented if architectural?

Bypass Governance

Hook bypasses are tiered by risk. See .claude/rules/bypass-governance.md for the full reference.

Tier 1 — Require user confirmation before use:

  • CLAUDE_ALLOW_MAIN_WRITE — Worktree isolation (pre-write + pre-bash)
  • CLAUDE_ALLOW_PRODUCTION_WRITE — Meta-mode isolation (pre-write)
  • SKIP_PIPELINE_GATE — TDD requirement for new functions (pre-write)
  • SKIP_COVERAGE_CHECK — Coverage regression + test deletion (pre-bash)

Tier 2 — Autonomous, logged to events.jsonl:

  • SKIP_TSC_CHECK, SKIP_PENDING_ACTIONS, SKIP_META_HOOK_CHECK, SKIP_PATH_CHECK, SKIP_LEARNINGS_GUARD

All bypass invocations emit bypass_used events for audit.

Hook Scripts Location

All hook scripts are in .claude/hooks/ and can be modified to adjust behavior.

Plan Archival

When a Claude Code session ends, archive-plan.sh preserves the current plan file.

Environment-aware archival:

EnvironmentWrites ToPurpose
Meta-development (.meta/ exists).meta/plans/Local plans (gitignored)
Shipped product (no .meta/).claude/archive/plans/User plans (committed)

What gets archived:

  • Plans modified within the last hour (likely from current session)
  • Plan content with added metadata header (timestamp, branch, project, source)
  • Descriptive filename: YYYY-MM-DD-HHMMSS-plan-title-slug.md

Metadata captured:

archived: 2026-02-01T15:30:45-08:00
branch: main
project: twilio-feature-factory
source: ~/.claude/plans/deep-nibbling-castle.md
title: Plan Title From First Heading

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.