원클릭으로
hook-migrator
Migrate Claude Code hook implementations to use @goodfoot/claude-code-hooks.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Migrate Claude Code hook implementations to use @goodfoot/claude-code-hooks.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | hook-migrator |
| description | Migrate Claude Code hook implementations to use @goodfoot/claude-code-hooks. |
Migrate existing Claude Code hook implementations to @goodfoot/claude-code-hooks TypeScript SDK.
Load github:github skill, then fork and clone the target repository:
// Fork repository
const { data: fork } = await octokit.rest.repos.createFork({ owner, repo });
// Clone to /home/node/hook-repos
git clone https://github.com/${yourUsername}/${repo}.git /home/node/hook-repos/${repo}
Multiple hook projects: If reports/hook-repositories.typescript.csv exists, read it to find all internal paths for each repository. The CSV has columns: repo, internal_path, and other metadata.
# Parse CSV for all internal paths in a repository
internal_paths=$(grep "^${repo}," reports/hook-repositories.typescript.csv | cut -d',' -f2)
# Process each internal path
for internal_path in $internal_paths; do
# internal_path is relative to repo root (e.g., "packages/hooks", "plugins/claude-hooks")
hook_dir="/home/node/hook-repos/${repo}/${internal_path}"
# Run analysis and conversion for this hook project
# ... steps 2-7 below apply to each internal_path
done
When a repository has multiple internal paths, process all of them before moving to the next repository. Each internal path is treated as a separate hook project with its own:
hooks.json configurationhooks/src/ TypeScript sourcespackage.json build scriptFind all hooks.json files and assess conversion feasibility. See references/candidate-analysis.md.
Good candidates have:
Status reporting: For hook projects assessed as "concerning" or "poor candidate", append the result to reports/hook-repositories-status.csv with columns:
repo - Repository namedirectory - Full path to hook project directoryinternal_path - Relative path within repo (empty if root-level)status - One of: good, concerning, poor_candidate# Create CSV if it doesn't exist
mkdir -p reports
if [ ! -f reports/hook-repositories-status.csv ]; then
echo "repo,directory,internal_path,status" > reports/hook-repositories-status.csv
fi
# Append result (internal_path may be empty for root-level hooks)
echo "${repo},${directory},${internal_path},${status}" >> reports/hook-repositories-status.csv
Skip concerning/poor candidates and continue to the next repository. Only proceed with conversion for "good" candidates.
Load the "claude-code-hooks:sdk" skill for implementation guidance.
cd /home/node/hook-repos/${repo}
npm install @goodfoot/claude-code-hooks --save-dev
Add build script to package.json:
{
"scripts": {
"build:hooks": "claude-code-hooks -i 'hooks/src/*.ts' -o './hooks.json'"
}
}
For each hook in the existing hooks.json:
hooks/src/preToolUseHook, postToolUseHook, stopHook, etc.preToolUseOutput, postToolUseOutput, etc.See references/conversion-patterns.md for patterns.
Critical rules:
logger from context, never console.logexport default for each hooktool_input, tool_name)npm run build:hooksSpawn a subagent for full validation:
Use Task tool with subagent_type="general-purpose" to:
1. Run existing test suite (npm test, pytest, bun test, etc.)
2. Create hook-specific tests in test/hooks/
3. Verify each converted hook matches original behavior
4. Report any failures with details
Subagent prompt template:
Validate hook migration in /home/node/hook-repos/${repo}:
1. Run existing tests: [detect and run test command]
2. For each hook in hooks/src/*.ts:
- Create test in test/hooks/ using vitest
- Test with mock inputs matching original hook's matchers
- Verify output structure matches SDK spec
3. Build hooks: npm run build:hooks
4. Report: tests passed/failed, coverage, any issues
Return structured summary of validation results.
After validation passes:
cd /home/node/hook-repos/${repo}
git add -A
git commit -m "Migrate hooks to @goodfoot/claude-code-hooks SDK
- Convert bash/command hooks to TypeScript
- Add build:hooks script
- Add hook tests"
git push origin main
| Original Type | Factory | Output Builder |
|---|---|---|
| Bash command | preToolUseHook | preToolUseOutput |
| Post-execution | postToolUseHook | postToolUseOutput |
| Stop/completion | stopHook | stopOutput |
| Session init | sessionStartHook | sessionStartOutput |
| User prompt | userPromptSubmitHook | userPromptSubmitOutput |
| Subagent stop | subagentStopHook | subagentStopOutput |
You must load this skill if you are creating or updating standalone documentation.
This skill should be used when the user asks to "skillify this", "turn this into a skill", "make a skill out of what we just did", "generalize this task into a reusable skill", or otherwise wants to capture a just-completed session task as a new skill or fold it into an existing one.
Browser automation using the puppeteer NPM package. Use when performing tasks on websites as a user would, taking screenshots, filling forms, or navigating web applications.
Load this skill immediately after a user mentions "@goodfoot/claude-code-hooks" or Claude Code hooks.
Load this skill immediately after a user mentions "@goodfoot/codex-hooks" or Codex hooks.
Load this skill immediately after a user mentions "@goodfoot/codex-hooks" or Codex hooks.