Slack Notification Skill
Part of Cardo — "Spawn many. Swarm the objective."
Send notifications to {{SLACK_CHANNEL}} channel. Always tag the project owner and reply to thread when available.
Prerequisites
bash
# Required environment variables export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/... export SLACK_MEMBER_ID=U0XXXXXXX # Project owner's Slack user ID
Thread Context
When triggered from Slack via @Claude, capture the thread timestamp from the triggering message at the start of your session:
bash
# Capture from the Slack message that triggered this session # This keeps all replies in the same thread THREAD_TS="<thread_ts from triggering slack message>"
If no thread context is available (e.g., triggered from web UI), notifications will post as new messages to the channel.
Helper Function
bash
slack_notify() {
local message="$1"
local thread_ts="${2:-}" # Pass thread_ts as second argument if available
# Tag project owner using member ID from environment
local tagged_message="<@${SLACK_MEMBER_ID}> ${message}"
if [ -n "$thread_ts" ]; then
# Reply to existing thread
curl -s -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"${tagged_message}\",\"thread_ts\":\"${thread_ts}\"}" \
"$SLACK_WEBHOOK_URL"
else
# Post to channel (new thread)
curl -s -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"${tagged_message}\"}" \
"$SLACK_WEBHOOK_URL"
fi
}
# Usage:
# slack_notify "PR ready for review" "$THREAD_TS"
Notification Templates
All templates pass $THREAD_TS to reply in the triggering thread.
PR Ready for Review
bash
slack_notify "PR Ready
PR: #${PR_NUMBER} - ${PR_TITLE}
Issue: Closes #${ISSUE_NUMBER}
Link: https://github.com/{{GITHUB_OWNER}}/{{GITHUB_REPO}}/pull/${PR_NUMBER}" "$THREAD_TS"
Blocked / Need Input
bash
slack_notify "Blocked
Issue: #${ISSUE_NUMBER} - ${ISSUE_TITLE}
Phase: ${CURRENT_PHASE}
Problem: ${ERROR_SUMMARY}
_Need your help to proceed._" "$THREAD_TS"
Input Needed
bash
slack_notify "Input Needed
Issue: #${ISSUE_NUMBER} - ${ISSUE_TITLE}
Question: ${QUESTION}
_Waiting for your response._" "$THREAD_TS"
Phase Complete
bash
slack_notify "${PHASE_NAME} Complete
Issue: #${ISSUE_NUMBER}
Next: ${NEXT_PHASE}" "$THREAD_TS"
PR Merged
bash
slack_notify "Merged!
PR: #${PR_NUMBER} merged
Issue: #${ISSUE_NUMBER} closed" "$THREAD_TS"
Comments Received on PR
bash
slack_notify "PR Feedback
PR: #${PR_NUMBER} has new review comments
Reviewer: ${REVIEWER}
Addressing feedback now..." "$THREAD_TS"
Morning Digest
bash
# Morning digest posts as new message (no thread context)
slack_notify "Morning Summary
*While you slept:*
Completed: ${COMPLETED_ISSUES}
PRs ready: ${READY_PRS}
Blocked: ${BLOCKED_ISSUES}
Needs input: ${NEEDS_INPUT}
*Budget:* \$${SPENT}/\$200 (${PERCENT}%) this month"
Raw Curl Commands
If helper function not available:
Post to Channel (New Thread)
bash
curl -s -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"<@${SLACK_MEMBER_ID}> Your message here\"}" \
"$SLACK_WEBHOOK_URL"
Reply to Thread
bash
# Use THREAD_TS captured from session context
curl -s -X POST -H 'Content-type: application/json' \
--data "{
\"text\":\"<@${SLACK_MEMBER_ID}> Your message here\",
\"thread_ts\":\"${THREAD_TS}\"
}" \
"$SLACK_WEBHOOK_URL"
With Formatting
bash
curl -s -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"<@${SLACK_MEMBER_ID}> *Bold* _italic_ \`code\`\n- Bullet point\n- Another point\",\"thread_ts\":\"${THREAD_TS}\"}" \
"$SLACK_WEBHOOK_URL"
When to Notify
| Event | Notify? | Template |
|---|---|---|
| Issue picked up | No | -- |
| Phase complete | No (unless blocked) | -- |
| Need human input | Yes | Input Needed |
| Blocked after 3 attempts | Yes | Blocked |
| PR created | Yes | PR Ready |
| PR has review comments | Yes | Comments Received |
| PR merged | Yes | PR Merged |
| Session ending (sleep hours) | Yes | Morning Digest |
Setting Up SLACK_MEMBER_ID
To get your Slack member ID:
- •Go to Slack
- •Click on your profile
- •Click "..." menu → "Copy member ID"
- •Set as environment variable:
export SLACK_MEMBER_ID=U0XXXXXXX
Error Handling
bash
response=$(slack_notify "Test message") if echo "$response" | grep -q "ok"; then echo "Notification sent" else echo "Failed to send notification: $response" fi
Security Notes
- •Never hardcode
SLACK_WEBHOOK_URLin files - •Webhook URL is secret — treat like a password
- •If compromised, regenerate in Slack app settings
- •
SLACK_MEMBER_IDis not sensitive but keep in env for consistency