notification-triggers
БесплатноЗапускает вложенные скриптыНе проверенConfigurable regex-based alert system for detecting patterns in tool calls and session activity. Supports error triggers, content regex matching, token…
от oimiragieo★ 48 звёзд на GitHubОб этом скилле
Notification Triggers
Step 1: Gather Context
Read relevant files and understand requirements
Step 2: Execute
Perform the skill's main function using available tools
Step 3: Output
Return results and save artifacts if applicable
- Follow existing project patterns: Follow this practice for best results
- Document all outputs clearly: Follow this practice for best results
- Handle errors gracefully: Follow this practice for best results
# Invoke this skill
/notification-triggers [arguments]
# Or run the script directly
node .claude/skills/notification-triggers/scripts/main.cjs --help
Trigger Configuration Schema
Notification triggers are defined in .claude/context/runtime/notification-triggers.json:
{
"version": "1.0",
"triggers": [
{
"id": "unique-trigger-id",
"name": "Human-readable trigger name",
"description": "What this trigger detects",
"type": "error|regex|token_threshold|pattern",
"enabled": true,
"condition": {
"pattern": "regex pattern to match",
"minTokens": 120000,
"minOccurrences": 3,
"scope": "session|task|global"
},
"actions": [
{
"type": "log|alert|spawn_agent|interrupt",
"target": "agent-name|file-path",
"message": "Action message template"
}
]
}
]
}
Condition Fields:
pattern— JavaScript RegExp (error/regex triggers)minTokens— Token threshold for alert (token_threshold trigger)minOccurrences— Pattern match count before triggering (pattern trigger)scope— Where to evaluate: current session, task, or cumulative
Action Types:
log— Write to.claude/context/runtime/notifications.jsonlalert— Display alert in session outputspawn_agent— Create Task() to handle the notificationinterrupt— Pause execution for user input
Trigger Evaluation Workflow
Step 1: Load Configuration
- Read
.claude/context/runtime/notification-triggers.json - Validate schema against notification-triggers.schema.json
- Filter to enabled triggers only
Step 2: Evaluate Conditions For each enabled trigger:
- Error triggers: Check tool output for exception patterns
- Regex triggers: Match
patternagainst tool stdout/stderr - Token threshold: Sum session tokens, compare to
minTokens - Pattern triggers: Count regex occurrences in recent output, compare to
minOccurrences
Step 3: Execute Matched Actions If condition is true:
- Process action in order (log → alert → spawn → interrupt)
- Render message templates with context variables
- Record trigger fire in
.claude/context/runtime/notification-log.jsonl
Step 4: Record Event
{
"timestamp": "ISO-8601",
"triggerId": "id",
"triggerName": "name",
"matched": true,
"context": {
"sessionId": "current session",
"taskId": "current task",
"tokenCount": number
}
}
Action Execution Logic
Log Action
// Append to notifications.jsonl
fs.appendFileSync(
notificationsPath,
JSON.stringify({
timestamp: new Date().toISOString(),
triggerId: trigger.id,
message: renderTemplate(action.message, context),
severity: 'info|warn|error',
}) + '\n'
);
Alert Action
// Write to stdout with standard format
console.log(`\n🔔 NOTIFICATION [${trigger.name}]\n${renderedMessage}\n`);
Spawn Agent Action
// Create async task to handle notification
Task({
task_id: `notify-${trigger.id}-${Date.now()}`,
subagent_type: action.target,
prompt: `Handle notification: ${trigger.description}\nContext: ${JSON.stringify(context)}`,
});
Interrupt Action
// Pause and ask user
const response = await AskUserQuestion({
question: `${trigger.name}: ${action.message}\n\nContinue? [y/n]`,
});
if (response.toLowerCase() !== 'y') {
process.exit(0);
}
Example Configurations
Example 1: High Token Usage Alert
{
"id": "token-threshold-warning",
"name": "High Token Usage Warning",
"description": "Alert when session exceeds 120K tokens",
"type": "token_threshold",
"enabled": true,
"condition": {
"minTokens": 120000,
"scope": "session"
},
"actions": [
{
"type": "log",
"message": "Session token count: ${tokenCount}
Установить notification-triggers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadBashGrepWriteTaskUpdateВложенные файлы
FAQ
Что делает скилл notification-triggers?
Configurable regex-based alert system for detecting patterns in tool calls and session activity. Supports error triggers, content regex matching, token threshold triggers, and pattern detection with configurable actions.
Как установить скилл notification-triggers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл notification-triggers запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic