alirezarezvani/claude-code-skill-factory / generated-skills/hook-factory
hook-factory
FlaggedGenerate production-ready Claude Code hooks with interactive Q&A, automated installation, and enhanced validation. Supports 10 templates across 7 event types for comprehensive workflow automation.
examples/load-context/README.md
View on GitHub# load-context
## Overview
Load project-specific context when Claude Code session starts
**Event Type:** `SessionStart`
**Complexity:** beginner
**Language:** all
## How It Works
Triggers once when session begins or resumes
1. Claude Code detects the configured event
2. Hook matcher checks if conditions are met
3. Hook command executes with safety wrappers
4. Result is processed (silent failure on errors)
## Use Cases
- Load TODO list
- Display project status
- Show recent git changes
- Load custom project instructions
## Prerequisites
- None (uses standard Unix commands)
## Installation
### Manual Installation
1. Open your Claude Code settings file:
- **Project-level:** `.claude/settings.json`
- **User-level:** `~/.claude/settings.json`
2. Add this hook configuration to the `hooks` array:
```json
{
"hooks": {
"SessionStart": [
{
"matcher": {
"source": ["startup", "resume"]
},
"hooks": [
{
"type": "command",
"command": "# Load project context\nif [ -f TODO.md ]; then\n echo \"# Project TODO List\"\n cat TODO.md\nelse\n echo \"No TODO.md found\"\nfi",
"timeout": 60
}
]
}
]
}
}
```
3. Save the file and restart Claude Code.
## Configuration
### Customize Behavior
You can modify the hook by editing `hook.json`:
**Available Customizations:**
**CONTEXT_FILE:** File to load for context
- Options: todo, agents, project_status, custom
**CONTEXT_LOAD_LOGIC:** Logic to load and display context
## Safety Notes
Read-only operations recommended. Fast execution required.
**Safety Features:**
- ✅ Tool detection prevents errors if dependencies missing
- ✅ Silent failure mode (`|| exit 0`) never interrupts workflow
- ✅ Appropriate timeout settings
- ✅ No destructive operations
## Troubleshooting
### Hook Not Triggering
1. Check that the event type matches your use case
2. Verify file patterns in matcher (if applicable)
3. Check Claude Code logs: `~/.claude/logs/`
### Command Errors
1. Verify required tools are installed
2. Test command manually in terminal
3. Check timeout settings
## Advanced
### Combining with Other Hooks
You can combine this hook with others by adding them to the same event type array.
### Custom Modifications
- Customize command parameters
- Add conditional logic
- Combine with other tools
---
**Generated by hook-factory** | 2025-10-30
**Template:** session_start_context_loader
**Version:** 1.0
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |