project-hook-setup

Use when setting up project-specific hooks for Claude Code enforcement. Load during INIT state when .claude/hooks/ is missing, or when creating new project. Installs 5 hooks that read from .claude/config/project.json (tests, health, dependencies).

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "project-hook-setup" with this command: npx skills add ingpoc/skills/ingpoc-skills-project-hook-setup

Project Hook Setup

Per-project setup for Claude Code hooks. These hooks read from .claude/config/project.json for project-specific settings.

Purpose

Installs 5 project-specific hooks that enforce:

  • Test verification before marking tested
  • File existence before marking complete
  • Health checks for API projects
  • Dependency validation
  • Session entry protocol

When to Use

SituationAction
New projectRun during INIT
.claude/hooks/ missingRun setup
Project config changedRe-run setup
Adding dependenciesUpdate config, re-run

Quick Check

# Check if project hooks exist
ls .claude/hooks/

# Check if config exists
cat .claude/config/project.json

Interactive Config

Setup prompts for project configuration:

SettingDescriptionExample
Project typeFramework usedfastapi, django, node
Dev server portLocal development port8000
Health checkCommand to verify servercurl -sf http://localhost:8000/health
Test commandHow to run testspytest
Required envEnvironment variables neededDATABASE_URL, API_KEY
Required servicesServices to be runningredis://localhost:6379

Setup Steps

1. Install Hooks

# Interactive mode (prompts for config)
.skills/project-hook-setup/scripts/setup-project-hooks.sh

# Non-interactive mode (for agents/automation)
.skills/project-hook-setup/scripts/setup-project-hooks.sh --non-interactive

# Auto-confirm prompts
.skills/project-hook-setup/scripts/setup-project-hooks.sh --yes

# Use existing config
.skills/project-hook-setup/scripts/setup-project-hooks.sh --config /path/to/config.json

# Environment variable (agent mode)
CLAUDE_NON_INTERACTIVE=1 .skills/project-hook-setup/scripts/setup-project-hooks.sh

Non-interactive flags:

FlagPurpose
--non-interactive / -nSkip all prompts (keeps existing config)
--yes / -yAuto-confirm all prompts
--config / -c <path>Use existing config file

This:

  • Creates .claude/config/project.json (or uses provided config)
  • Copies 5 hook templates to .claude/hooks/
  • Sets executable permissions

2. Verify Installation

.skills/project-hook-setup/scripts/verify-project-hooks.sh

Hooks Installed

HookEventPurposeReads From
verify-tests.pyPreToolUseRun tests before testedproject.json → test_command
verify-files-exist.pyPreToolUseCheck files before completefeature-list.json
verify-health.pyPreToolUseCheck server healthproject.json → health_check
require-dependencies.pyPreToolUseValidate env, servicesproject.json
session-entry.shCLI utilitySession entry protocolproject.json

Note: session-entry.sh is a CLI utility. Use: .claude/hooks/session-entry.sh

Settings.json Configuration

Setup script configures .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {"type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/verify-tests.py"},
          {"type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/verify-files-exist.py"},
          {"type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/verify-health.py"},
          {"type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/require-dependencies.py"}
        ]
      }
    ]
  }
}

Note: Uses $CLAUDE_PROJECT_DIR for project-relative paths.

Exit Criteria (Code Verified)

# Config exists with required fields
[ -f ".claude/config/project.json" ]
jq -e '.project_type' .claude/config/project.json >/dev/null
jq -e '.health_check' .claude/config/project.json >/dev/null
jq -e '.test_command' .claude/config/project.json >/dev/null

# Hooks exist and executable
[ -d ".claude/hooks" ]
[ -x ".claude/hooks/verify-tests.py" ]
[ -x ".claude/hooks/verify-files-exist.py" ]
[ -x ".claude/hooks/verify-health.py" ]
[ -x ".claude/hooks/require-dependencies.py" ]
[ -x ".claude/hooks/session-entry.sh" ]

# Verify script passes
.skills/project-hook-setup/scripts/verify-project-hooks.sh

Scripts

ScriptPurpose
setup-project-hooks.shMain setup (config + hooks + settings + validate)
configure-project-settings.pyConfigure .claude/settings.json
validate-settings.pyValidate hooks configured in settings.json
prompt-project-config.shInteractive config creation
verify-project-hooks.shVerify hook files exist
install-hooks.shCopy templates to .claude/hooks/

Project Config Schema

.claude/config/project.json:

{
  "project_type": "fastapi|django|node|python|other",
  "dev_server_port": 8000,
  "health_check": "curl -sf http://localhost:8000/health",
  "test_command": "pytest",
  "required_env": ["DATABASE_URL", "API_KEY"],
  "required_services": ["redis://localhost:6379"]
}

Troubleshooting

ProblemSolution
Config missingRun setup-project-hooks.sh to create
Hook can't read configCheck JSON syntax, verify required fields
Tests not foundUpdate test_command in project.json
Health check failsServer not running or wrong port
Permission deniedRun: chmod +x .claude/hooks/*

Integration

This skill is called by the initializer skill during INIT state:

5. Setup hooks:
   - Check: ~/.claude/hooks/verify-state-transition.py exists (global)
   - Check: .claude/hooks/verify-tests.py exists (project)
   - If missing, load respective setup skill

Next Steps

After project hooks: Continue with feature breakdown and implementation.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

async-programming-skill

No summary provided by upstream source.

Repository SourceNeeds Review
General

scroll-storyteller

No summary provided by upstream source.

Repository SourceNeeds Review
General

browser-testing

No summary provided by upstream source.

Repository SourceNeeds Review