Claude Code Hooks is a collection of ready-to-use automation scripts for Claude Code. Operations teams can copy, paste, and customize these hooks to streamline workflows, enhance security, and set up notifications. Connects to Claude Code and integrates with CLI tools.
git clone https://github.com/karanb192/claude-code-hooks.gitClaude Code Hooks is a collection of ready-to-use automation scripts for Claude Code. Operations teams can copy, paste, and customize these hooks to streamline workflows, enhance security, and set up notifications. Connects to Claude Code and integrates with CLI tools.
[{"step":1,"action":"Identify the workflow you want to automate or enhance. Common use cases include file cleanup, CI/CD notifications, security scans, or log rotation.","tip":"Check the claude-code-hooks repository for pre-built scripts that match your use case. For example, look for hooks labeled 'file-cleanup', 'github-notifier', or 'security-scan'."},{"step":2,"action":"Copy the relevant hook script and paste it into your local environment or CI/CD pipeline. For example, save the GitHub release notifier script as `github-release-to-slack.sh`.","tip":"Ensure the script has executable permissions: `chmod +x github-release-to-slack.sh`."},{"step":3,"action":"Customize the placeholders in the script (e.g., GitHub token, Slack webhook URL, repository name). Replace sensitive values with environment variables or secrets management tools.","tip":"Use `export` to set environment variables temporarily: `export GITHUB_TOKEN=your_token_here`. For production, use tools like GitHub Secrets or AWS Secrets Manager."},{"step":4,"action":"Test the hook locally or in a staging environment. For the GitHub release notifier, manually trigger a release or simulate one using the GitHub API.","tip":"Add debug logging to the script (e.g., `echo \"Release tag: $RELEASE_TAG\"`) to verify the script is working as expected."},{"step":5,"action":"Deploy the hook to your production environment. For CI/CD workflows, add the script to your pipeline (e.g., GitHub Actions, Jenkins). For local automation, set up a cron job or systemd timer.","tip":"Schedule the hook to run at appropriate intervals. For file cleanup, use `0 3 * * *` to run daily at 3 AM. For notifications, trigger it on specific events (e.g., GitHub webhooks)."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/karanb192/claude-code-hooksCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use claude-code-hooks to [TASK]. For example: 'Use claude-code-hooks to automatically scan the /tmp directory for files older than 7 days and delete them safely.' or 'Use claude-code-hooks to set up a GitHub webhook that notifies #alerts channel in Slack whenever a new release is published in the main branch.'
Here’s the automation script generated using claude-code-hooks to streamline the release notification process:
```bash
#!/bin/bash
# GitHub Release Notifier to Slack
# Hook: github-release-to-slack
# Description: Posts a Slack notification to #alerts when a new release is published in the main branch
GITHUB_TOKEN="ghp_1234567890abcdef"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/T123/B456/C789"
REPO="acme-corp/web-app"
# Fetch the latest release from GitHub
RELEASE_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/releases/latest")
# Extract release details
RELEASE_TAG=$(echo "$RELEASE_INFO" | jq -r '.tag_name')
RELEASE_NAME=$(echo "$RELEASE_INFO" | jq -r '.name')
RELEASE_URL=$(echo "$RELEASE_INFO" | jq -r '.html_url')
# Format Slack message
SLACK_MESSAGE=$(jq -n --arg tag "$RELEASE_TAG" \
--arg name "$RELEASE_NAME" \
--arg url "$RELEASE_URL" \
'{"text": ":rocket: *New Release Published!*", "attachments": [{"color": "#36a64f", "fields": [{"title": "Tag", "value": $tag, "short": true}, {"title": "Name", "value": $name, "short": true}, {"title": "Release Notes", "value": $url, "short": false}]}]}')
# Send to Slack
curl -X POST -H 'Content-type: application/json' \
--data "$SLACK_MESSAGE" \
"$SLACK_WEBHOOK_URL"
echo "Release notification sent to Slack for $REPO:$RELEASE_TAG"
```
### Key Features:
- **GitHub API Integration**: Uses a personal access token to fetch release data securely.
- **Slack Webhook**: Posts a rich, formatted message to the #alerts channel with release details.
- **Automation-Ready**: Can be triggered via GitHub Actions or a cron job.
- **Error Handling**: Silent failure on API issues (can be enhanced with logging).
This hook reduces manual notifications and ensures the team is instantly alerted to new releases, improving response times for critical updates.Where Money Chats
AI assistant built for thoughtful, nuanced conversation
Agents that listen, think and act for you.
IronCalc is a spreadsheet engine and ecosystem
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan