Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
am-will avatar

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)
At a glance

create-hook capabilities & compatibility

Capabilities
hook authoring · codex config
Use cases
ci cd · orchestration
From the docs

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.
SKILL.md
Use `PreToolUse` for prevention.
SKILL.md
npx skills add https://github.com/am-will/codex-skills --skill create-hook

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars1k
Last updatedJuly 14, 2026
Repositoryam-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

SKILL.mdMarkdownGitHub ↗

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:
  • SessionStart
  • UserPromptSubmit
  • PreToolUse
  • PostToolUse
  • Stop
  • 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.json and ~/.codex/hooks/
  • Project: <repo>/.codex/hooks.json and <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 = true in the relevant config.toml.

6. Keep the hook output clear.

  • Use statusMessage for 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 PreToolUse for prevention.
  • Use PostToolUse for logging, formatting, or test follow-up.
  • Use UserPromptSubmit for prompt shaping and injected context.
  • Use SessionStart for startup context.
  • Use Stop for end-of-turn checks.

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/.

Automation & Workflowsagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.