基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Lego4005/foxit-marketplace --skill secure-coder命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| description | Design perfect Claude Code hooks - guided discovery, self-healing, auto-updates |
| triggers | ["hook-architect","hooks","design-hooks","ha"] |
Design perfect Claude Code hooks for any codebase through guided discovery, intelligent recommendations, and self-healing.
Last Updated: January 2026 (Claude Code 2.1.x API)
| Command | What It Does |
|---|---|
/hook-architect | Full guided workflow |
/hook-architect --review | Audit & grade existing hooks (A-F) |
/hook-architect --update | Check Anthropic docs for API updates |
/hook-architect --heal | Auto-fix common issues |
/hook-architect --recipes | Browse hook templates |
| Type | When | Use For |
|---|---|---|
PreToolUse | Before tool runs | Permission gates, file protection, input modification |
PermissionRequest | Permission dialog shown | Auto-allow/deny permissions |
PostToolUse | After tool completes | Logging, auto-format, notifications, feedback to Claude |
UserPromptSubmit | User sends message | Context injection, routing, validation |
SubagentStart | Agent spawns | Enrichment, duplicate detection |
SubagentStop | Agent completes | Output compression, scoring, evaluation |
Stop | Main agent finishes | Control if Claude continues working |
SessionStart | Session starts/resumes | Load context, setup environment |
SessionEnd | Session ends | Cleanup, logging, save state |
PreCompact | Before compaction | Intercept context compression |
Notification | Background alerts | React to permission, idle, auth notifications |
{
"tool_name": "Edit",
"tool_input": {"file_path": "/path/to/file.ts", "old_string": "...", "new_string": "..."},
"tool_use_id": "toolu_01ABC123...",
"session_id": "...",
"cwd": "/project/path"
}
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow|deny|ask",
"permissionDecisionReason": "Why this decision was made",
"updatedInput": {"command": "modified command"}
}
}
Permission Decisions:
allow - Bypass permission system, proceed immediatelydeny - Block the tool call entirelyask - Show user permission dialog (NEW!)DEPRECATED (still works but update your hooks):
{"decision": "approve|block", "reason": "..."}
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "Feedback for Claude about what happened"
}
}
{
"decision": "block",
"reason": "Why blocked"
}
Or add context (printed to stdout or via JSON):
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"additionalContext": "Injected context for this prompt"
}
}
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": "Loaded project context..."
}
}
Special: Use $CLAUDE_ENV_FILE to persist environment variables.
Define hooks directly in Skills, Subagents, and Slash Commands via frontmatter:
---
name: secure-coder
description: Code with security checks
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/security-check.sh"
PostToolUse:
- matcher: "Edit|Write"
hooks:
- type: command
command: "./scripts/run-linter.sh"
once: true # Run only once per session
---
Supported events: PreToolUse, PostToolUse, Stop
Use LLM evaluation instead of shell scripts:
{
"hooks": {
"Stop": [{
"hooks": [{
"type": "prompt",
"prompt": "Evaluate if all tasks are complete. $ARGUMENTS",
"timeout": 30
}]
}]
}
}
LLM responds with:
{"ok": true|false, "reason": "explanation if false"}
| Variable | Description |
|---|---|
$CLAUDE_PROJECT_DIR | Absolute path to project root |
$CLAUDE_PLUGIN_ROOT | Plugin directory (for plugin hooks) |
$CLAUDE_CODE_REMOTE | "true" for web, unset for CLI |
$CLAUDE_ENV_FILE | File to persist env vars (SessionStart only) |
# From plugin templates directory:
./scripts/install-hooks.sh --safety # Essential hooks
./scripts/install-hooks.sh --all # All hooks
./scripts/install-hooks.sh file-guardian # Specific hook
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/file-guardian.sh",
"timeout": 10
}
]
}
],
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/auto-formatter.sh"
}
]
}
]
--review grades hooks A-F on security, performance, reliability--update checks Anthropic docs for API changes--heal auto-fixes: deprecated fields, missing hookEventName, old decision values| Issue | Auto-Fix |
|---|---|
decision: "approve" | → permissionDecision: "allow" |
decision: "block" | → permissionDecision: "deny" |
Missing hookEventName | → Add based on hook type |
Missing set -e | → Add to shell scripts |
| Unquoted variables | → Add quotes |
Match MCP tools with pattern: mcp__<server>__<tool>
{
"matcher": "mcp__memory__.*",
"hooks": [{"type": "command", "command": "..."}]
}
claude --debug # Shows hook matching and execution details