
Create Hook
- 1k repo stars
- Updated July 14, 2026
- am-will/codex-skills
create-hook is a skill that creates or updates Codex hooks at global or project scope by writing the hook config, scripts, and any required feature-flag config.
About
create-hook is a skill that creates or updates Codex hooks at global or project scope. It asks for scope and hook type when ambiguous, then writes the hook config, scripts, and any required feature-flag config across five event types (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop). A developer uses it to automate deterministic behavior around Codex tool use, such as prevention, logging, or prompt shaping.
- Creates or updates Codex hooks at global or project scope
- Covers SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop
- Writes hook config, scripts, and feature-flag config
Create Hook by the numbers
- Data as of Aug 3, 2026 (Skillselion catalog sync)
create-hook capabilities & compatibility
- Capabilities
- hook authoring · codex config
- Use cases
- ci cd · orchestration
What create-hook says it does
Create or update Codex hooks for global or project scope by asking for scope and hook type when ambiguous, then writing the hook config, scripts, and any required feature flag config.
Use `PreToolUse` for prevention.
npx skills add https://github.com/am-will/codex-skills --skill create-hookAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| repo stars | ★ 1k |
|---|---|
| Last updated | July 14, 2026 |
| Repository | am-will/codex-skills ↗ |
What it does
Create or update Codex hooks at global or project scope, writing config, scripts, and feature flags.
Who is it for?
Developers who want to add deterministic Codex hooks for prevention, logging, or prompt shaping.
When should I use this skill?
The user wants to add Codex hooks and describes the behavior they want.
What you get
A scoped Codex hook is written with config, scripts, and feature flags, then verified by triggering it.
By the numbers
- 5 hook event types
- global and project scopes
Files
Create Hook
Use when the user wants to add Codex hooks and explains the behavior they want.
Workflow
1. Determine scope.
- If the user says
global, use the personal/home scope. - If the user says
project, use the repo scope. - If scope is missing or unclear, ask:
Should this be global or project-scoped?
2. Determine hook type.
- If the event is missing or unclear, ask which hook they want:
SessionStartUserPromptSubmitPreToolUsePostToolUseStop- If the user wants more than one, keep them separate unless they explicitly want shared behavior.
3. Determine behavior.
- Ask what the hook should do if the intent is not already clear.
- Prefer the smallest deterministic script that satisfies the request.
4. Write the hook files in the chosen scope.
- Global:
~/.codex/hooks.jsonand~/.codex/hooks/ - Project:
<repo>/.codex/hooks.jsonand<repo>/.codex/hooks/ - Keep script paths explicit and relative where practical.
5. Enable the feature flag if the target Codex build still gates hooks.
- Set
[features] codex_hooks = truein the relevantconfig.toml.
6. Keep the hook output clear.
- Use
statusMessagefor a short visible signal. - For logging hooks, write to a repo-local or home-local log file.
- For blocking hooks, return a nonzero exit only when the hook should actually stop the tool.
7. Verify the result.
- Run a command that should trigger the hook.
- Confirm the log, output, or blocking behavior matches the requested scope and event.
Practical defaults
- Use
PreToolUsefor prevention. - Use
PostToolUsefor logging, formatting, or test follow-up. - Use
UserPromptSubmitfor prompt shaping and injected context. - Use
SessionStartfor startup context. - Use
Stopfor end-of-turn checks.
interface:
display_name: "Create Hook"
short_description: "Create or update Codex hooks for global or project scope"
default_prompt: "Use $create-hook to add or update Codex hooks. If the scope is unclear, ask whether it should be global or project-scoped. If the hook type is unclear, ask which hook event they want. Then create the hook config, scripts, and any needed feature-flag config."
Hook Scope
Scope choices
- Global / personal
~/.codex/hooks.json~/.codex/hooks/~/.codex/config.toml
- Project / repo
<repo>/.codex/hooks.json<repo>/.codex/hooks/<repo>/.codex/config.toml
Hook events
SessionStartUserPromptSubmitPreToolUsePostToolUseStop
Useful defaults
PreToolUse: block or rewrite before executionPostToolUse: log, format, or validate after executionUserPromptSubmit: inject instructions or reject bad promptsSessionStart: seed session contextStop: final checks or continuation prompts
Related skills
FAQ
Which hook events are supported?
SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, and Stop.
Where do global hooks live?
In ~/.codex/hooks.json and ~/.codex/hooks/.