skills/codex/cc-hooks-creator/SKILL.md
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: cc-hooks-creator description: Create, configure, and debug Claude Code hooks -- shell commands that execute at lifecycle events (PreToolUse, PostToolUse, Stop, SessionStart, etc.). Use when building file protection, code formatting, notifications, context loading, or any automation triggered by Claude Code events. Covers inline commands, Python scripts, JSON output, state management, and security. --- > **Platform Note:** This
npx skillsauth add frank-luongt/faos-skills-marketplace skills/codex/cc-hooks-creatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Platform Note: This skill was designed for multi-agent execution. In Codex, treat sub-agent instructions as sequential steps to complete thoroughly within a single agent context.
Create effective Claude Code hooks -- shell commands that execute automatically at specific lifecycle points, enabling deterministic control over Claude's behavior.
| Event | When It Runs | Common Use Cases |
|---|---|---|
| PreToolUse | Before tool executes | Block operations, validate inputs, auto-approve |
| PostToolUse | After tool completes | Format files, log operations, validate output |
| Stop | When Claude finishes | Remind to store learnings, validate completion |
| SubagentStop | When subagent completes | Validate subagent output |
| UserPromptSubmit | When user submits prompt | Add context, validate prompts |
| SessionStart | Session begins | Load context, set environment |
| SessionEnd | Session ends | Cleanup, logging |
| PreCompact | Before context compact | Save important context |
Input (JSON via stdin):
{
"session_id": "abc123",
"transcript_path": "/path/to/transcript.jsonl",
"cwd": "/current/directory",
"hook_event_name": "EventName",
"tool_name": "Write",
"tool_input": {"file_path": "/path/to/file"}
}
Output (exit codes):
Advanced JSON output (exit 0):
{
"decision": "block",
"reason": "Explanation for Claude",
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow|deny|ask"
}
}
Inline command (simple):
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "jq -r '.tool_input.command' >> ~/.claude/bash-log.txt"
}]
}]
}
}
Python script (complex):
#!/usr/bin/env python3
import json, sys
def main():
input_data = json.load(sys.stdin)
tool_name = input_data.get("tool_name", "")
tool_input = input_data.get("tool_input", {})
# Your logic here...
sys.exit(0) # Allow
# print("Error message", file=sys.stderr); sys.exit(2) # Block
if __name__ == "__main__":
main()
Add to ~/.claude/settings.json (user) or .claude/settings.json (project):
{
"hooks": {
"EventName": [{
"matcher": "ToolPattern",
"hooks": [{
"type": "command",
"command": "/path/to/hook-script.py",
"timeout": 30
}]
}]
}
}
Matcher patterns: Exact ("Write"), Regex ("Edit|Write"), All ("*" or "")
#!/usr/bin/env python3
import json, sys
PROTECTED = ['.env', 'package-lock.json', '.git/', 'credentials']
input_data = json.load(sys.stdin)
file_path = input_data.get('tool_input', {}).get('file_path', '')
if any(p in file_path for p in PROTECTED):
print(f"Protected file: {file_path}", file=sys.stderr)
sys.exit(2)
sys.exit(0)
#!/usr/bin/env python3
import json, sys, subprocess
input_data = json.load(sys.stdin)
file_path = input_data.get('tool_input', {}).get('file_path', '')
if file_path.endswith('.py'):
subprocess.run(['black', file_path], capture_output=True)
elif file_path.endswith(('.ts', '.tsx', '.js', '.jsx')):
subprocess.run(['npx', 'prettier', '--write', file_path], capture_output=True)
sys.exit(0)
#!/usr/bin/env python3
import json, sys, os
result = os.popen('git log --oneline -5 2>/dev/null').read()
output = {
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": f"Recent commits:\n{result}"
}
}
print(json.dumps(output))
sys.exit(0)
For hooks tracking state across invocations:
import json, os
from datetime import datetime
STATE_FILE = os.path.expanduser("~/.claude/hook_state.json")
def load_state():
if os.path.exists(STATE_FILE):
with open(STATE_FILE) as f:
return json.load(f)
return {"invocations": 0, "last_run": None}
def save_state(state):
with open(STATE_FILE, 'w') as f:
json.dump(state, f)
chmod +x /path/to/hook.pyecho '{"tool_name":"Write"}' | /path/to/hook.pyclaude --debugCtrl+O in Claude Code"$VAR" not $VAR..)| Avoid | Why | Instead |
|---|---|---|
| Inline commands for complex logic | Hard to debug, no error handling | Use Python/Bash scripts |
| Missing timeout | Hook can hang indefinitely | Set "timeout": 30 |
| No exit code handling | Unclear success/failure | Use 0 (allow), 2 (block) |
| Modifying tool input without reason | Confuses Claude | Only modify when necessary, document why |
| Missing try/except | JSON parse errors crash hook | Wrap in try/except |
development
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: databricks-mlflow-evaluation --- # MLflow 3 GenAI Evaluation ## Before Writing Any Code 1. **Read GOTCHAS.md** - 15+ common mistakes that cause failures 2. **Read CRITICAL-interfaces.md** - Exact API signatures and data schemas ## End-to-End Workflows Follow these workflows based on your goal. Each step indicates which reference files to read. ### Workflow 1: First-Time Evaluation Setup For users new to MLflow GenAI evalu
development
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: databricks-lakebase-provisioned --- # Lakebase Provisioned Patterns and best practices for using Lakebase Provisioned (Databricks managed PostgreSQL) for OLTP workloads. ## When to Use Use this skill when: - Building applications that need a PostgreSQL database for transactional workloads - Adding persistent state to Databricks Apps - Implementing reverse ETL from Delta Lake to an operational database - Storing chat/agent m
tools
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: databricks-jobs --- # Databricks Lakeflow Jobs ## Overview Databricks Jobs orchestrate data workflows with multi-task DAGs, flexible triggers, and comprehensive monitoring. Jobs support diverse task types and can be managed via Python SDK, CLI, or Asset Bundles. ## Reference Files | Use Case | Reference File | | ----------------------
development
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: databricks-genie --- # Databricks Genie Create and query Databricks Genie Spaces - natural language interfaces for SQL-based data exploration. ## Overview Genie Spaces allow users to ask natural language questions about structured data in Unity Catalog. The system translates questions into SQL queries, executes them on a SQL warehouse, and presents results conversationally. ## When to Use This Skill Use this skill when: -