claude-code-plugin-ref…
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
Select hook scope (plugin, project, global) by audience. Use when authoring a hook.
$ npx -y skills add athola/claude-night-market --skill hook-scope-guide --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/hook-scope-guideContext preview
The summary Claude sees to decide when to auto-load this skill.
Select hook scope (plugin, project, global) by audience. Use when authoring a hook.
name: hook-scope-guide description: 'Select hook scope (plugin, project, global) by audience. Use when authoring a hook.' category: hook-development
This skill helps you choose the right location for Claude Code hooks based on their purpose, audience, and persistence needs.
> **`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/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
**Only 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**:
**Examples**:
**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):
1. **Enterprise policies** (organization-managed) 2. **Command-line arguments** (`claude --flag`) 3. **Local project settings** (`.claude/settings.local.json`) 4. **Shared project settings** (`.claude/settings.json`) 5. **User settings** (`~/.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**:
A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
States load-bearing decisions, invariants, and weak points. Use when judging a design change. Do not use for gating; use night-market-change-control.
Rebuild the dev environment: uv, Python tiers, pins, traps. Use when onboarding or toolchain breaks. Do not use for daily commands; use night-market-operations.
Classify, gate, and review changes. Use when landing a PR, releasing, or amending rules. Do not use for failure triage; use night-market-debugging-playbook.
Search and record project memory (Discussions, journal, ADRs). Use before re-investigating anything. Do not use for settled battles; see failure-archaeology.
Bind loop 'done' to unfakeable gates. Use to harden egregore/herald loops or promote completion_integrity. Not for QA gates; use night-market-validation-and-qa.