with one click
proactive-patterns
// Expertise in designing proactive auto-triggering components. Use when creating skills, agents, hooks, or commands that should activate automatically based on context, events, or checkpoints.
// Expertise in designing proactive auto-triggering components. Use when creating skills, agents, hooks, or commands that should activate automatically based on context, events, or checkpoints.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | proactive-patterns |
| description | Expertise in designing proactive auto-triggering components. Use when creating skills, agents, hooks, or commands that should activate automatically based on context, events, or checkpoints. |
| title | Proactive Patterns: Creating Auto-Triggering Components |
| stratum | 2 |
| branches | ["agentic"] |
Expertise in designing skills, agents, and commands that activate proactively based on context, keywords, events, or checkpoints. Use this skill when creating components that should trigger automatically rather than requiring explicit invocation.
IMPORTANT CLARIFICATION: The "Keyword-Based (Skills)" section previously documented here was INCORRECT. Skills do NOT auto-load based on ## Activation Keywords sections - that was a documentation convention, not a real feature. Skills are discovered via the description field in SKILL.md YAML frontmatter.
Skills are discovered when Claude determines they're relevant based on YAML frontmatter.
How it actually works:
.claude/skills/skill-name/SKILL.mdname and descriptiondescription and autonomously decides when to use skillDesign guidelines:
---
name: python-testing
description: Expertise in Python testing patterns including pytest, fixtures, mocking, and coverage. Use when user asks about testing, pytest, fixtures, or test coverage.
---
When to use:
Agents can be invoked proactively based on their description.
How it works:
description field defines when to useDesign guidelines:
# Good - specific trigger condition
description: Use PROACTIVELY when user wants to organize files. Applies SEACOW thinking.
# Good - clear scope
description: Use PROACTIVELY after completing significant tasks to suggest improvements.
# Bad - too vague
description: Helps with files.
# Bad - no proactive signal
description: Organizes files using SEACOW framework.
Format:
Use PROACTIVELY when [specific condition]. [What it does in 10-15 words].
When to use:
Hooks intercept events before they happen.
How it works:
bash, file, stop, prompt, allwarn (show message) or block (prevent action)Hook file format:
# Hook Name
## Event
bash | file | stop | prompt | all
## Pattern
[regex pattern to match]
## Action
warn | block
## Message
[What to show the user]
Example - Prevent dangerous commands:
# No Force Push
## Event
bash
## Pattern
git push.*--force|git push -f
## Action
block
## Message
Force push blocked. Use a safer alternative or explicitly override.
When to use:
Available events:
| Event | Triggers On |
|---|---|
bash | Before shell commands |
file | Before file operations |
stop | Before conversation ends |
prompt | Before AI responds |
all | Any tool use |
These hooks maintain goal focus during long sessions. From the planning-with-files pattern.
The core principle: Context window = RAM (volatile, limited). Filesystem = Disk (persistent, unlimited). Anything important gets written to disk.
When to use:
Add hooks to .claude/settings.local.json (create if it doesn't exist):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit|Bash",
"hooks": [
{
"type": "command",
"command": "bash .claude/scripts/read-plan.sh 2>/dev/null || true"
}
]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "echo '[Reminder] Update task_plan.md if phase complete' && [ -d knowledge-base ] && echo '[Knowledge] Capture insights ā 00-inbox/ | Distill learnings ā 02-learnings/'"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": ".claude/scripts/check-complete.sh"
},
{
"type": "command",
"command": "bash .claude/scripts/check-knowledge.sh 2>/dev/null || true"
}
]
}
]
}
}
Note: If you already have a settings.local.json, merge the hooks section into your existing file.
The hooks use three scripts in .claude/scripts/:
| Script | Hook | Purpose |
|---|---|---|
read-plan.sh | PreToolUse | Smart plan reader ā shows plan or detects empty task_plan.md and prompts to populate/delete |
check-complete.sh | Stop | Verifies all phases in task_plan.md are marked complete before session end |
check-knowledge.sh | Stop | Shows knowledge-base status and prompts for captures/promotions (silently skips if no knowledge-base/) |
Copy during setup:
mkdir -p .claude/scripts
cp ~/.claude/scripts/read-plan.sh .claude/scripts/
cp ~/.claude/scripts/check-complete.sh .claude/scripts/
cp ~/.claude/scripts/check-knowledge.sh .claude/scripts/
chmod +x .claude/scripts/*.sh
The PostToolUse KB reminder ([ -d knowledge-base ] && echo ...) only fires when knowledge-base/ exists. Standard projects without a knowledge-base see only the plan reminder.
| Hook | Trigger | Purpose |
|---|---|---|
| PreToolUse | Before Write/Edit/Bash | Re-reads task_plan.md to refresh goals |
| PostToolUse | After Write/Edit | Reminds to update plan status |
| Stop | Before session ends | Verifies all phases complete via check-complete.sh |
Run /task-plan to create a properly structured plan, or create manually. The hooks expect a plan file with this structure:
# Task: [Your Task Name]
### Phase 1: [Phase Name]
**Status:** pending | in_progress | complete
- [ ] Step 1
- [ ] Step 2
### Phase 2: [Phase Name]
**Status:** pending
- [ ] Step 1
The check-complete.sh script counts ### Phase headers and **Status:** complete lines to verify completion
The Manus hooks above handle session focus (hot zone). For full temperature gradient support, the hooks also prompt knowledge capture:
PostToolUse ā Mid-Session KB Awareness:
The PostToolUse hook conditionally reminds about knowledge capture when knowledge-base/ exists:
[Reminder] Update task_plan.md if phase complete
[Knowledge] Capture insights ā 00-inbox/ | Distill learnings ā 02-learnings/
The second line only appears in projects with a knowledge-base/ directory.
Stop ā Session End KB Review (check-knowledge.sh):
At session end, check-knowledge.sh shows zone counts and prompts:
Gradient Transition Prompts:
| Trigger | Mechanism | Prompt |
|---|---|---|
| After every Write/Edit | PostToolUse (conditional) | "Capture insights ā 00-inbox/ / Distill ā 02-learnings/" |
| Session end | check-knowledge.sh | "Inbox has N items ā process before stopping?" |
| Session end | check-knowledge.sh | "Working has N drafts ā any ready to promote?" |
| Session end (empty KB) | check-knowledge.sh | "KB is empty. Any insights worth capturing?" |
Temperature-Aware Frontmatter:
When creating files, include temperature in frontmatter:
---
date created: 2026-01-17
temperature: inbox | working | learnings | reference | archive
tags: []
---
This enables future automation (scripts that find stale inbox items, etc.).
See Also: docs/CONCEPTS.md ā "Context Temperature Gradient"
Commands require explicit /slash invocation but are discoverable.
How it works:
.claude/commands//command-nameCommand file format:
---
allowed-tools: Read, Write, Glob, Grep
argument-hint: "[optional arguments description]"
---
# Command prompt/instructions here
[What the command should do when invoked]
Example:
---
allowed-tools: Read, Write, Glob, AskUserQuestion
argument-hint: "[effort-level: minimal|standard|comprehensive]"
---
# Initialize Workspace
When invoked, analyze the current workspace and offer to scaffold it for AI-assisted work.
1. Check if CLAUDE.md exists
2. If not, ask about effort level
3. Create appropriate structure
When to use:
| I want to... | Use |
|---|---|
| Load knowledge when topic relevant | Description (Skill YAML) |
| Offer help at certain conditions | Description (Agent) |
| Prevent/warn about actions | Hook |
| Let user explicitly invoke | Command |
Should this trigger automatically?
ā
āā NO ā Command (explicit /slash)
ā
āā YES ā What triggers it?
ā
āā Topic/context relevant ā Skill (YAML description)
ā
āā Condition in workflow ā Agent (description-based)
ā
āā Specific event (bash/file) ā Hook
Components can use multiple trigger mechanisms:
User asks about testing patterns
ā pytest-skill loads (description relevant)
ā workflow-improver notices pattern (checkpoint)
ā Offers to create test helper agent
/deploy command exists for explicit deploys
Hook warns on any direct production file changes
Both protect production, different mechanisms
# Bad - when does this load?
description: Helps with stuff
# Bad - when does this trigger?
description: Helps with stuff
# Bad - frustrating user experience
## Event: all
## Pattern: .*
## Action: block
---
name: kubernetes-expertise
description: Deep expertise in Kubernetes patterns and best practices. Use when user asks about k8s, kubectl, pods, deployments, services, ingress, helm, or cluster management.
---
# Kubernetes Expertise
## Purpose
Deep expertise in Kubernetes patterns and best practices.
---
## Content
[Kubernetes conventions, common patterns, troubleshooting tips]
Triggers when: Claude determines k8s expertise is relevant to conversation
name: code-reviewer
description: Use PROACTIVELY when user completes writing a function or file. Reviews code for issues.
tools:
- Read
- Grep
skills:
- code-review-conventions
Triggers when: Function/file writing completes
# No Secrets in Code
## Event
file
## Pattern
(password|secret|api_key)\s*=\s*['"][^'"]+['"]
## Action
warn
## Message
Potential secret detected in code. Consider using environment variables.
Triggers when: File write contains potential secrets
/command-name.claude/skills/skill-patterns/SKILL.md - Designing skills.claude/skills/agent-patterns/SKILL.md - Designing agentsdocs/03-ongoing-usage.md - Daily workflow patterns