startup-hook-skill

Creates SessionStart hooks that install dependencies for Claude Code web sessions.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/amirbiron/claude-skills --skill startup-hook-skill-amirbiron
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: startup-hook-skill
Source: https://github.com/amirbiron/claude-skills/tree/main/skills/session-start-hook
Command: npx skills add https://github.com/amirbiron/claude-skills --skill startup-hook-skill-amirbiron

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Claude Code on the web starts sessions in fresh containers without your project's dependencies installed, so tests and linters fail until someone sets up the environment manually. This Skill automates the creation of a SessionStart hook that installs everything the project needs before work begins. ## Core Features & Use Cases - Dependency Analysis: Detects package managers from manifest files like package.json, pyproject.toml, Cargo.toml, go.mod, and Gemfile, plus README documentation. - Hook Generation: Writes an idempotent, non-interactive bash hook in .claude/hooks/ and registers it in .claude/settings.json, with support for async mode and remote-only execution via $CLAUDE_CODE_REMOTE. - End-to-End Validation: Runs the hook, a linter, and a sample test to confirm the environment works, then commits and pushes the result. - Use Case: You want Claude Code web sessions on your Node.js repo to run npm install automatically so tests and ESLint work from the first prompt. ## Quick Start Set up a SessionStart hook for this repository so dependencies install automatically and tests and linters run in Claude Code web sessions.

Frequently Asked Questions about startup-hook-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a SessionStart hook for Claude Code on the web?

Create an executable bash script in .claude/hooks/session-start.sh that installs your dependencies, then register it under the SessionStart hooks key in .claude/settings.json. Validate it by running the script directly with CLAUDE_CODE_REMOTE=true.

How do I install dependencies automatically in Claude Code web sessions?

A SessionStart hook runs when the remote session starts, so placing commands like npm install or pip install in the hook script prepares the environment. The container state is cached after the hook completes, speeding up later sessions.

What is the difference between async and synchronous SessionStart hooks?

Synchronous hooks guarantee dependencies are installed before the session starts but delay session launch. Async hooks run in the background with a timeout, reducing startup latency but risking race conditions if the agent needs dependencies before installation finishes.

Can I run a hook only in Claude Code remote environments?

Yes, check the CLAUDE_CODE_REMOTE environment variable at the start of the script and exit early when it is not set to true. This keeps local sessions unaffected while configuring remote containers.

Why does my SessionStart hook fail in Claude Code web sessions?

Common causes include missing execute permissions on the script, interactive commands that block for input, or non-idempotent install steps. Test locally with CLAUDE_CODE_REMOTE=true and ensure the script uses set -euo pipefail with non-interactive commands.