hooks

Integrate custom shell scripts into Kamal deployment lifecycle hooks.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/donnfelker/kamal-skills --skill hooks-donnfelker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks
Source: https://github.com/donnfelker/kamal-skills/tree/main/skills/hooks
Command: npx skills add https://github.com/donnfelker/kamal-skills --skill hooks-donnfelker

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill solves the challenge of integrating custom logic into the Kamal deployment lifecycle, allowing you to gate deploys, notify teams, or perform infrastructure-specific tasks at precise moments.

Core Features & Use Cases

  • Deployment Gating: Automatically abort deployments if pre-flight checks like CI status or uncommitted code changes fail.
  • Lifecycle Automation: Trigger custom scripts at specific points such as pre-build, post-deploy, or during proxy reboots to handle load balancer draining or APM registration.
  • Context-Aware Scripts: Utilize built-in environment variables to make your hooks aware of the specific version, host, and user involved in the deployment.

Quick Start

Ask the agent to create a new pre-deploy hook script in the .kamal/hooks directory that checks if the current git branch is main before allowing the deployment to proceed.

Frequently Asked Questions about hooks

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

FAQPage Schema
How do I add custom shell scripts to my Kamal deployment lifecycle?

You can integrate custom shell scripts into the Kamal deployment lifecycle by placing hook files in the .kamal/hooks directory. These scripts execute at specific points like pre-build, post-deploy, and proxy reboot sequences to manage infrastructure tasks.

Can I gate a Kamal deploy if CI checks fail or there are uncommitted changes?

Yes, Kamal deployment gating is possible by using pre-flight hooks to automatically abort deployments. You can configure custom scripts to check CI status or uncommitted git code changes before allowing the deployment process to proceed.

What environment variables are available to Kamal hooks during execution?

Kamal hooks are context-aware and utilize built-in environment variables during execution. These variables provide your custom scripts with specific details about the deployment, including the target version, destination host, and the user initiating the deploy.

How do I manage load balancer draining during a zero-downtime Kamal deploy?

You manage load balancer draining by triggering custom scripts during proxy reboot sequences in Kamal. This hook execution point allows you to handle APM registration and maintain zero-downtime load balancer management across diverse infrastructure environments.

Does Kamal support post-deploy notifications and audit reporting through hooks?

Kamal supports post-deploy notifications and audit reporting by triggering custom scripts at specific lifecycle points. Utilizing standard Kamal hook conventions satisfies requirements for team notifications and CI/CD integration reporting after deployment completes.