Skip to content
Skill Authoring
Skill

/create-hook

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.

From plugin
codex-skills
1k22 skills

Claude Code

$ npx -y skills add am-will/codex-skills --skill create-hook --agent claude-code

SKILL.md

create-hook.SKILL.md
name: create-hook
description: 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.

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.
Read more
@am-will
Ships withcodex-skills

A collection of Codex/agent skills for planning, documentation access, frontend development, and browser automation.

Stars on GitHub

Momentum

stars in total
1.0k
Star history of am-will/codex-skills on GitHub, a chart by star-history.com

Other skills on codex-skills.

agent-browser

agent-browser

A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and…

frontend-design

frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web…

gemini-computer-use

gemini-computer-use

Build and run Gemini 2.5 Computer Use browser-control agents with Playwright. Use when a user wants to automate web browser tasks…

img-to-frontend

img-to-frontend

Use when the user wants an end-to-end premium visual design workflow for any type of website or web page created directly from…

More skills from other plugins.

gstack-openclaw-ceo-review

gstack-openclaw-ceo-re…

Use when asked to review a plan, challenge a proposal, run a CEO review, poke holes in an approach, think bigger about scope, or…

gstack3w138k
@garrytan@garrytanInstall Skill
book-to-skill

book-to-skill

Converts books and documents (PDF, EPUB, DOCX, HTML, Markdown, plain text, RTF, MOBI/AZW with Calibre) into structured agent…

@virgiliojr94@virgiliojr94Install Skill
distilly

distilly

Set up the owner profile so a personal agent knows who it works for (first-run setup, \"get to know me\"), or distill colleague,…

@titanwings@titanwingsInstall Skill

Questions about create-hook.

Which coding agents can use create-hook?
create-hook installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.