Skip to content

Tools & Hooks Integration

Custom Skills can access Claude Code's tool set and integrate with the Hooks system.

Tool List

Standard tools available to Skills:

ToolTypeDescription
ReadRead-onlyRead files
WriteWriteCreate/overwrite files
EditWriteExact string replacement
BashExecuteRun shell commands
GlobRead-onlyFile pattern matching
GrepRead-onlyText search
WebFetchNetworkFetch web content
WebSearchNetworkSearch the internet

Configuring Tool Permissions

yaml
allowed-tools:
  - Read
  - Write
  - Edit

Principle: Only grant tools the Skill genuinely needs.

Read-Only Analysis Skill

yaml
allowed-tools:
  - Read
  - Bash    # Only for git log, npm ls, etc.

Code Generation Skill

yaml
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash    # Run tests for verification

Hooks Integration

Hooks allow automatic actions on specific events.

Available Event Hooks

json
{
  "hooks": {
    "PreToolUse": {
      "bash": "echo 'About to run: $TOOL_NAME'"
    },
    "PostToolUse": {
      "bash": "npm run lint"
    }
  }
}

Skill + Hook Combo

Scenario: A code-gen Skill that auto-formats after every file write.

SKILL.md:

yaml
---
name: component-generator
description: Generate React components with tests and stories
allowed-tools: [Read, Write, Edit, Bash]
---

settings.json:

json
{
  "hooks": {
    "PostToolUse": [
      {
        "tool": "Write",
        "command": "npx prettier --write $FILE_PATH"
      }
    ]
  }
}

MCP Tools

If MCP servers are configured (e.g., CodeGraph), Skills can call MCP tools too.

yaml
# Skill using CodeGraph
name: code-explorer
description: Explore codebase structure using CodeGraph
allowed-tools:
  - Read
  - mcp__codegraph__codegraph_search
  - mcp__codegraph__codegraph_context

Security Best Practices

  1. Never use wildcards in allowed-tools
  2. Restrict Bash to specific commands (via settings.json permissions)
  3. Sensitive operations (deploy, publish) should not be allowlisted
  4. Hook commands run outside Claude Code's process — audit script safety

Next Steps

  • Examples — Build a complete Skill from scratch