askill
claude-craft

claude-craftSafety 95Repository

Claude Code extensibility — agents, commands, hooks, skills, rules, and configuration. Use when creating, configuring, or troubleshooting Claude Code components, or when agent.md, /command, hooks.json, SKILL.md, .claude/rules, settings.json, MCP server, PreToolUse, or create agent/command/hook are mentioned.

3 stars
1.2k downloads
Updated last week

Package Files

Loading files...
SKILL.md

Claude Code Extensibility

Create and configure the six Claude Code extension points: agents, commands, hooks, skills, rules, and configuration.

Component Map

ComponentPurposeLocationInvocation
AgentsSpecialized subagentsagents/*.mdTask tool (subagent_type)
CommandsReusable promptscommands/*.mdUser: /command-name
HooksEvent handlerssettings.json or hooks/hooks.jsonAutomatic on events
SkillsCapability packagesskills/*/SKILL.mdAuto-triggered by context
RulesConvention files.claude/rules/*.mdLoaded on demand
ConfigSettings & MCPsettings.json, .mcp.jsonLoaded at startup

Scope Hierarchy

ScopeLocationVisibility
Personal~/.claude/You only
Project.claude/ or rootTeam via git
Plugin<plugin>/Plugin users

Routing

TaskUse
Creating agents, commands, hooks, rules, configThis skill
Creating skills (Claude-specific features)This skill + skillcraft for base spec
Creating skills (cross-platform spec)skillcraft
Packaging/distributing pluginsclaude-plugins

Agents

Specialized subagents with focused expertise, invoked via the Task tool.

Frontmatter

---
name: security-reviewer       # Required: kebab-case, matches filename
description: |                 # Required: triggers + examples
  Use this agent for security vulnerability detection.
  Triggers on security audits, OWASP, injection, XSS.

  <example>
  Context: User wants security review.
  user: "Review auth code for vulnerabilities"
  assistant: "I'll use the security-reviewer agent."
  </example>
model: inherit                 # Optional: inherit(default)|haiku|sonnet|opus
tools: Glob, Grep, Read       # Optional: comma-separated (default: inherit all)
disallowedTools: Write, Edit   # Optional: deny specific tools
skills: tdd-fieldguide, debugging  # Optional: auto-load skills (NOT inherited)
maxTurns: 50                   # Optional: max agentic turns
memory: user                   # Optional: user|project|local — persistent memory
hooks:                         # Optional: lifecycle hooks scoped to this agent
  PreToolUse:
    - matcher: "Bash"
      hooks:
        - type: command
          command: "./scripts/validate.sh"
---

See agents/frontmatter.md for complete schema.

Archetypes

TypePurposeTypical Tools
AnalyzerExamine without modifyingGlob, Grep, Read, Skill, Task, TaskCreate, TaskUpdate, TaskList, TaskGet
ImplementerBuild and modify codeFull access (inherit)
ReviewerProvide feedbackRead-only + Skill + Task tools
TesterCreate and manage testsRead, Write, Edit, Bash, ...
ResearcherFind and synthesize info..., WebSearch, WebFetch

See agents/types.md for details.

Model Selection

ModelWhen to Use
inheritRecommended default — adapts to parent context
haikuFast exploration, simple tasks, low-latency
sonnetBalanced cost/capability (default if omitted)
opusNuanced judgment, security/architecture review

Tool Configuration

Baseline (always include when restricting):

tools: Glob, Grep, Read, Skill, Task, TaskCreate, TaskUpdate, TaskList, TaskGet

Only restrict tools when there's a specific safety reason. See agents/tools.md.

Agent Body Structure

# Agent Name

You are a [role] specializing in [expertise].

## Process

### Step 1: [Stage]
- Action items

## Output Format

Structured output spec.

## Constraints

**Always:** Required behaviors
**Never:** Prohibited actions

Validation Checklist

  • name matches filename (kebab-case, 1-3 words)
  • description has WHAT, WHEN, triggers, 2-3 examples
  • tools uses comma-separated valid names (case-sensitive)
  • Body has clear role, process, output format, constraints

References

ReferenceContent
agents/frontmatter.mdYAML schema and fields
agents/types.mdArchetypes and patterns
agents/tools.mdTool configuration patterns
agents/discovery.mdHow agents are found and loaded
agents/patterns.mdBest practices, multi-agent patterns
agents/tasks.mdTask tool patterns
agents/task-tool.mdTask tool integration
agents/performance.mdPerformance optimization
agents/advanced-features.mdResumable agents, CLI config
agents/agent-vs-skill.mdAgents vs Skills distinction

Commands

Custom slash commands — reusable prompts invoked by users.

Frontmatter

---
description: Deploy to environment with validation   # Required
argument-hint: <environment> [--skip-tests]          # Shown in autocomplete
allowed-tools: Bash(*), Read                          # Restrict tool access
model: claude-3-5-haiku-20241022                     # Override model
---

See commands/frontmatter.md for complete schema.

Core Features

FeatureSyntaxPurpose
Arguments$1, $2, $ARGUMENTSDynamic input from user
Bash execution<bang>`command`Include shell output in context
File references@path/to/fileInclude file contents
Tool restrictionsallowed-tools:Limit Claude's capabilities

Quick Example

---
description: Fix a specific GitHub issue
argument-hint: <issue-number>
---

Fix issue #$1 following our coding standards.
Review the issue, implement a fix, add tests, and create a commit.

Usage: /fix-issue 123

Argument Patterns

  • Positional: $1, $2, $3/compare old.ts new.ts
  • All arguments: $ARGUMENTS/fix memory leak in auth
  • With file refs: @$1/analyze src/main.ts

See commands/arguments.md for advanced patterns.

Scopes

ScopeLocationShows in /help
Project.claude/commands/"(project)"
Personal~/.claude/commands/"(user)"
Plugin<plugin>/commands/Plugin name

Subdirectories create namespaces: commands/frontend/component.md/component.

Validation Checklist

  • Filename is kebab-case .md (verb-noun pattern preferred)
  • description is action-oriented, under 80 chars
  • argument-hint uses <required> and [optional] syntax
  • allowed-tools uses correct case-sensitive names
  • Bash commands tested in terminal first

References

ReferenceContent
commands/frontmatter.mdComplete frontmatter schema
commands/arguments.mdArgument handling patterns
commands/bash-execution.mdShell command execution
commands/file-references.mdFile inclusion syntax
commands/permissions.mdTool restriction patterns
commands/namespacing.mdDirectory organization
commands/sdk-integration.mdAgent SDK usage
commands/community.mdCommunity examples

Hooks

Event handlers that automate workflows, validate operations, and respond to Claude Code events.

Hook Types

TypeBest ForResponse FormatDefault Timeout
commandDeterministic checks, external toolsExit codes + JSON600s
promptComplex reasoning, context-aware validation{"ok": bool, "reason": "..."}30s
agentMulti-step verification requiring tool access{"ok": bool, "reason": "..."} (up to 50 turns)60s

Prompt hooks: Send prompt + hook input to a Claude model (Haiku by default, override with model field). Return {"ok": true} to proceed or {"ok": false, "reason": "..."} to block.

Agent hooks: Spawn a subagent with tool access (allowedTools) for multi-step verification. Same ok/reason response format as prompt hooks.

Events

EventWhenCan BlockMatcherCommon Uses
PreToolUseBefore tool executesYesTool nameValidate commands, check paths
PostToolUseAfter tool succeedsNoTool nameAuto-format, run linters
PostToolUseFailureAfter tool failsNoTool nameError logging, retry logic
PermissionRequestPermission dialog shownYesTool nameAuto-allow/deny rules
UserPromptSubmitUser submits promptNo(none)Add context, log activity
NotificationClaude sends notificationNoNotification typeExternal alerts, desktop notify
StopClaude finishes respondingNo(none)Cleanup, verify completion
SubagentStartSubagent spawnsNoAgent typeTrack spawning, setup resources
SubagentStopSubagent finishesNoAgent typeLog results, trigger follow-ups
TeammateIdleTeam agent about to idleNo(none)Coordination, reassignment
TaskCompletedTask marked completedNo(none)Validation, notifications
Setup--init or --maintenanceNo(none)Initialize environment
PreCompactBefore context compactionNoTrigger typeBackup conversation
SessionStartSession starts/resumesNoStart reasonLoad context, show status
SessionEndSession endsNoEnd reasonCleanup, save state

See hooks/hook-types.md for detailed per-event documentation.

Configuration Format

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write|Edit(*.ts|*.tsx)",
        "hooks": [
          {
            "type": "command",
            "command": "biome check --write \"$file\"",
            "timeout": 10
          }
        ]
      }
    ]
  }
}
LocationScopeFormat
.claude/settings.jsonProject (shared)Direct "hooks" key
.claude/settings.local.jsonProject (local)Direct "hooks" key
~/.claude/settings.jsonPersonalDirect "hooks" key
<plugin>/hooks/hooks.jsonPluginWrapped in {"description": "...", "hooks": {...}}

Matchers

{"matcher": "Write"}                    // Exact match
{"matcher": "Edit|Write"}               // Multiple tools (OR)
{"matcher": "*"}                        // All tools
{"matcher": "Write(*.py)"}              // File pattern
{"matcher": "Write|Edit(*.ts|*.tsx)"}   // Multiple + pattern
{"matcher": "mcp__memory__.*"}          // MCP server tools

Lifecycle event matchers:

  • SessionStart: startup, resume, clear, compact
  • SessionEnd: clear, logout, prompt_input_exit, bypass_permissions_disabled, other
  • Notification: permission_prompt, idle_prompt, auth_success, elicitation_dialog
  • SubagentStart/Stop: Agent type name (e.g., Explore, Plan, db-agent)
  • PreCompact: manual, auto

See hooks/matchers.md for advanced patterns.

Exit Codes

CodeMeaning
0Success, continue execution
2Block operation (PreToolUse only), stderr shown to Claude
OtherWarning, stderr shown to user, continues

JSON Output (Advanced)

{
  "continue": true,
  "suppressOutput": false,
  "systemMessage": "Context for Claude",
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow|deny|ask",
    "permissionDecisionReason": "Explanation",
    "updatedInput": {"modified": "field"}
  }
}

Execution Model

All matching hooks run in parallel (not sequentially). Identical handlers are automatically deduplicated. Design hooks to be independent — they cannot see each other's output.

Hot-swap: Hooks added via /hooks menu take effect immediately. Manual edits to settings files require a session restart or /hooks menu visit.

Stop hooks: Fire whenever Claude finishes responding, not only at task completion. Do NOT fire on user interrupts. To prevent infinite loops, check stop_hook_active in the input JSON and exit early if true.

Component-Scoped Hooks

Skills, agents, and commands can define hooks in frontmatter. All hook events are supported. Stop hooks in agent/skill frontmatter are automatically converted to SubagentStop events at runtime.

---
name: my-skill
hooks:
  PreToolUse:
    - matcher: "Write|Edit"
      hooks:
        - type: prompt
          prompt: "Validate this write operation..."
  Stop:  # Converted to SubagentStop at runtime
    - hooks:
        - type: command
          command: "./scripts/on-complete.sh"
---

Environment Variables

VariableAvailabilityDescription
$CLAUDE_PROJECT_DIRAll hooksProject root directory
${CLAUDE_PLUGIN_ROOT}Plugin hooksPlugin root (use for portable paths)
$filePostToolUse (Write/Edit)Path to affected file
$CLAUDE_ENV_FILESessionStartWrite env vars to persist for session
$CLAUDE_CODE_REMOTEAll hooksSet if running in remote context

Validation Checklist

  • Hook scripts are executable (chmod +x)
  • Matchers use correct case-sensitive tool names
  • Timeouts set (default: 600s command, 30s prompt, 60s agent; max: 10 minutes)
  • Scripts use set -euo pipefail and quote variables
  • Plugin hooks use ${CLAUDE_PLUGIN_ROOT} for paths

References

ReferenceContent
hooks/hook-types.mdPer-event documentation
hooks/matchers.mdAdvanced matcher patterns
hooks/schema.mdComplete configuration schema
hooks/security.mdSecurity best practices
hooks/examples.mdReal-world implementations

Skills (Claude-Specific)

Claude Code extends the base Agent Skills specification with additional features. For the cross-platform spec, load skillcraft.

Frontmatter Extensions

FieldTypeDescription
allowed-toolsstringSpace-separated tools that run without permission prompts
user-invocablebooleanDefault true. Set false to prevent /skill-name access
disable-model-invocationbooleanPrevents auto-activation; requires manual Skill tool
contextstringinherit (default) or fork for isolated subagent execution
agentstringAgent for context: fork (e.g., Explore, analyst)
modelstringOverride model: haiku, sonnet, or opus
hooksobjectLifecycle hooks active while skill loaded
argument-hintstringHint shown after /skill-name (e.g., [file path])

Tool Restrictions

# Space-separated list
allowed-tools: Read Grep Glob

# With Bash patterns
allowed-tools: Read Write Bash(git *) Bash(npm run *)

# MCP tools (double underscore format)
allowed-tools: Read mcp__linear__create_issue

Tool names are case-sensitive. See skills/integration.md for patterns.

String Substitutions

PatternReplaced With
$ARGUMENTSUser input after /skill-name
${CLAUDE_SESSION_ID}Current session identifier
${CLAUDE_PLUGIN_ROOT}Plugin root directory path

Context Modes

  • inherit (default): Runs in main conversation with full history access
  • fork: Runs in isolated subagent context; prevents context pollution
context: fork
agent: analyst
model: haiku

See skills/context-modes.md for patterns.

References

ReferenceContent
skills/context-modes.mdFork vs inherit patterns
skills/integration.mdCommands, hooks, MCP integration
skills/performance.mdToken impact, optimization
skills/preprocessing-safety.mdSafe preprocessing patterns

Preprocessing

Claude Code preprocesses <bang>`command` syntax — executing shell commands and injecting output before content reaches Claude. This powers live context in commands (git state, PR details, environment info).

Critical: Preprocessing runs in both command files AND SKILL.md files, including inside markdown code fences. There is no escape mechanism.

Where preprocessing runs

ContextPreprocessedSafe to use literal !?
Command files (commands/*.md)YesYes — intentional
SKILL.mdYesNo — use <bang> instead
References, EXAMPLES.mdNoYes — great for copy-paste demos
Rules, CLAUDE.md, agentsNoYes

Writing SKILL.md files

When documenting or referencing the preprocessing syntax in a SKILL.md, use <bang> as a stand-in for !. Agents interpret <bang> as !.

Add an HTML comment explaining the convention:

<!-- <bang> = exclamation mark; used as stand-in to avoid triggering preprocessing -->

Then use <bang> for any inline references:

  • <bang>`git status` — injects current git status
  • <bang>`gh pr view --json title` — injects PR details

Move real copy-paste examples with literal ! to reference files — those are not preprocessed.

Writing reference files

Reference files (references/, EXAMPLES.md) are not preprocessed. Use literal ! freely — these serve as copy-paste sources for command authors:

See commands/bash-execution.md for the full reference with real ! syntax.

Intentional preprocessing in skills

Skills that genuinely run commands at load time should declare it in frontmatter:

metadata:
  preprocess: true

Validation

Run /skillcheck to scan SKILL.md files for unintentional preprocessing patterns. The linter respects metadata.preprocess: true and skips intentional uses.

See skills/preprocessing-safety.md for detailed examples, common mistakes, and the full convention.


Rules

Reusable convention files in .claude/rules/ for project patterns.

Rules vs CLAUDE.md

AspectCLAUDE.md.claude/rules/
LoadingAutomatic at session startOn-demand via reference
ContentProject setup, key commandsReusable conventions
SizeConcise (~200-500 lines)Can be detailed

CLAUDE.md: One-off instructions, project commands, key file locations. rules/: Formatting conventions, architecture patterns, workflow guidelines.

File Conventions

  • UPPERCASE.md — All caps with .md extension
  • Topic-focused — One concern per file
  • Kebab-case for multi-word: API-PATTERNS.md, CODE-REVIEW.md

Path-Specific Rules

---
paths:
  - "src/api/**/*.ts"
  - "lib/**/*.ts"
---

# API Development Rules

Referencing Rules

Rules are NOT auto-loaded. Reference from CLAUDE.md:

# CLAUDE.md
Follow `.claude/rules/FORMATTING.md` for all code conventions.

Or use @ syntax: @./project-specific/FORMATTING.md

See rules.md for detailed patterns and anti-patterns.


Configuration

File Locations

ScopeSettingsMCP
Personal~/.claude/settings.json~/.claude.json
Project (shared).claude/settings.json.mcp.json
Project (local).claude/settings.local.json
Managed (org)System-level path

Precedence (highest first): Managed > CLI args > Local > Project > User.

MCP Server Setup

Project MCP (.mcp.json):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {"GITHUB_TOKEN": "${GITHUB_TOKEN}"}
    }
  }
}

Personal MCP (~/.claude.json):

{
  "mcp_servers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}

Key Settings

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": ["Bash(npm run lint)"],
    "deny": ["Read(./.env)"],
    "defaultMode": "acceptEdits"
  },
  "hooks": {},
  "enabledPlugins": {"plugin@marketplace": true},
  "model": "claude-sonnet-4-5-20250929"
}

See config/mcp-patterns.md, config/workflows.md, and config/troubleshooting.md for details.


Testing & Debugging

# Debug mode — shows skill/agent/hook loading details
claude --debug

# Force reload after changes
/clear

# Test hook manually
echo '{"tool_name": "Write", "tool_input": {"file_path": "test.ts"}}' | ./hooks/my-hook.sh

# Verify commands appear
/help

External Resources

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

92/100Analyzed 2/23/2026

Highly comprehensive reference skill covering all six Claude Code extension points (agents, commands, hooks, skills, rules, config) with detailed schemas, validation checklists, code examples, and routing guidance. Excellent structure with tables, clear when-to-use guidance, and extensive reference links. Well-suited for both learning and lookup. Tags and proper skills folder location support discoverability.

95
90
90
95
90

Metadata

Licenseunknown
Version-
Updatedlast week
Publisheroutfitter-dev

Tags

apici-cdgithubgithub-actionslintingllmobservabilitypromptingsecuritytesting