Best for
- Use when authoring a hook.
athola/claude-night-market/plugins/abstract/skills/hook-scope-guide/SKILL.md
Select hook scope (plugin, project, global) by audience. Use when authoring a hook.
Decision brief
Select hook scope (plugin, project, global) by audience.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Declared | Source record | Install path and trigger |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/athola/claude-night-market --skill "plugins/abstract/skills/hook-scope-guide"Inspect the Agent Skill "hook-scope-guide" from https://github.com/athola/claude-night-market/blob/90037391d2db6536f67a7ccc8dee7c6819f170b7/plugins/abstract/skills/hook-scope-guide/SKILL.md at commit 90037391d2db6536f67a7ccc8dee7c6819f170b7. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
inputdata = json.loads(sys.stdin.read()) if inputdata.get("agenttype") in ["code-reviewer", "quick-query"]: print(json.dumps({"hookSpecificOutput": {"additionalContext": "Minimal"}}))
Writing the hook itself (use abstract:hook-authoring)
hooks/hooks.json is automatically loaded by Claude Code when the plugin is enabled. Do NOT add "hooks": "./hooks/hooks.json" to your plugin.json - this causes duplicate load errors. The hooks field in plugin.json is only needed for additional hook files beyond the standard hooks…
Review the “The Three Scopes” section in the pinned source before continuing.
Only plugin users → Plugin hooks - Hook is part of plugin's core functionality - Users expect it when they enable your plugin - Example: A YAML plugin validates YAML syntax on edit
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 330 | Source | Repository attention, not individual Skill quality |
| Compatibility | 1 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
This skill helps you choose the right location for Claude Code hooks based on their purpose, audience, and persistence needs.
abstract:hook-authoring)abstract:hooks-eval)
hooks/hooks.jsonis automatically loaded by Claude Code when the plugin is enabled. Do NOT add"hooks": "./hooks/hooks.json"to yourplugin.json- this causes duplicate load errors. Thehooksfield inplugin.jsonis only needed for additional hook files beyond the standardhooks/hooks.json.
| Scope | Location | Audience | Committed? | Persistence |
|---|---|---|---|---|
| Plugin | hooks/hooks.json in plugin | Plugin users | With plugin | When plugin enabled |
| Project | .claude/settings.json | Team members | Yes (repo) | Per project |
| Global | ~/.claude/settings.json | Only you | Never | All sessions |
Only plugin users → Plugin hooks
All team members on this project → Project hooks
/src/production/ configsOnly me, everywhere → Global hooks
Yes, as part of a distributable plugin → Plugin hooks Yes, shared with team in repo → Project hooks No, keep private → Global hooks
Only when my plugin is active → Plugin hooks Always in this specific project → Project hooks Always, in every project I work on → Global hooks
Location: <plugin-root>/hooks/hooks.json
When to use:
Configuration:
{
"PreToolUse": [
{
"matcher": "Read",
"hooks": [{
"type": "command",
"command": "echo \"Plugin reading: $(jq -r '.tool_input.file_path')\" >> ${CLAUDE_PLUGIN_ROOT}/log.txt"
}]
}
]
}
Note: Use string matchers (
"Read") not object matchers ({"toolName": "Read"}).
Key features:
${CLAUDE_PLUGIN_ROOT} for plugin-relative pathsExamples:
Location: .claude/settings.json (in project root)
When to use:
Configuration:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "cmd=$(jq -r '.tool_input.command // empty'); if [[ \"$cmd\" == *\"production\"* ]]; then echo 'BLOCKED: Production access requires approval'; exit 1; fi"
}]
}
]
}
}
Note: Use string matchers (
"Bash") not object matchers.
Key features:
Examples:
Location: ~/.claude/settings.json
When to use:
Configuration:
{
"hooks": {
"PreToolUse": [
{
"hooks": [{
"type": "command",
"command": "echo \"$(date): $(jq -r '.tool_name')\" >> ~/.claude/audit.log"
}]
}
]
}
}
Key features:
Examples:
Claude Code loads settings in this priority (highest first):
claude --flag).claude/settings.local.json).claude/settings.json)~/.claude/settings.json)Important: Multiple hooks from different scopes can respond to the same event. When they do, all matching hooks execute in parallel.
Is this hook part of a plugin's core functionality?
├─ YES → Plugin hooks (hooks/hooks.json in plugin)
└─ NO ↓
Should all team members on this project have this hook?
├─ YES → Project hooks (.claude/settings.json)
└─ NO ↓
Should this hook apply to all my Claude sessions?
├─ YES → Global hooks (~/.claude/settings.json)
└─ NO → Reconsider if you need a hook at all
Plugin hooks:
Project hooks:
Global hooks:
SessionStart hooks now receive additional input fields via stdin:
| Field | Type | Description |
|---|---|---|
session_id | string | Unique session identifier |
source | enum | "startup" | "resume" | "clear" | "compact" |
agent_type | string | Agent name if --agent flag used, empty otherwise |
The agent_type field enables scope-appropriate context injection:
# Skip heavy context for review agents
input_data = json.loads(sys.stdin.read())
if input_data.get("agent_type") in ["code-reviewer", "quick-query"]:
print(json.dumps({"hookSpecificOutput": {"additionalContext": "Minimal"}}))
This is particularly useful for:
hooks/hooks.json, .claude/settings.json, or
~/.claude/settings.json) is confirmed to exist or is created at the correct path."hooks": "./hooks/hooks.json" to plugin.json (duplicate-load
guard); this absence is verified before the hook is deployed.Frequently asked questions
Select hook scope (plugin, project, global) by audience.
The source record exposes this install command: npx skills add https://github.com/athola/claude-night-market --skill "plugins/abstract/skills/hook-scope-guide". Inspect the command and pinned source before running it.
The pinned source record declares support for: claude code.
Alternatives
oaustegard/claude-skills
Generate hierarchical _FEATURES.md files that describe what a codebase DOES from a user/consumer perspective, anchored to source symbols via tree-sitting. Supports large complex codebases through feature-driven decomposition into sub-feature files. Uses a multi-pass synthesis: orientation → detail → overview rewrite. Use when someone says "what does this do", "document features", "feature inventory", "_FEATURES.md", or needs to understand a codebase's purpose before modifying it. Complements tre
apollographql/skills
Guide for creating effective skills for Apollo GraphQL and GraphQL development. Use this skill when: (1) users want to create a new skill, (2) users want to update an existing skill, (3) users ask about skill structure or best practices, (4) users need help writing SKILL.md files.
terrylica/cc-skills
Park a draft message/text in macOS Notes for the operator to review and edit, then read it back before acting (e.g. before sending to a real person). Notes is the source of truth (AppleScript CRUD, iCloud-synced, provenance-stamped with the Claude Code session UUID); Stickies is a best-effort view-only desktop mirror. Use whenever you draft something a human should confirm/edit before it is sent or committed — messages, replies, announcements, anything outbound. TRIGGERS - park this draft, park
narrative-io/narrative-skills-marketplace
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "