Copilot New Hook.prompt
--- description: Scaffold a new hook configuration for lifecycle automation in agent sessions name: New Hook agent: Copilot Customization Builder tools: ['search', 'edit/editFiles'] --- # New Hook Configuration Create a new hook configuration file for lifecycle automation. ## Inputs - Hook purpose (what it automates): `${input:hookPurpose}` - Hook event type: `${input:hookEvent:PreToolUse, PostToolUse, SessionStart, Stop, UserPromptSubmit, PreCompact, SubagentStart, SubagentStop}` - Scope (`workspace` for `.github/hooks/` or `agent` for agent frontmatter): `${input:hookScope}` ## What are hooks? Hooks execute custom shell commands at key lifecycle points during agent sessions. They provide deterministic, code-driven automation that runs regardless of how the agent is prompted. ## Hook events | Event | When It Fires | Common Use Cases | |-------|---------------|------------------| | `SessionStart` | First prompt of a new session | Initialize resources, log session start | | `UserPromptSubmit` | User submits a prompt | Audit requests, inject context | | `PreToolUse` | Before agent invokes any tool | Block dangerous operations, require approval | | `PostToolUse` | After tool completes | Run formatters, log results | | `PreCompact` | Before context is compacted | Export important context | | `SubagentStart` | Subagent is spawned | Track nested agent usage | | `SubagentStop` | Subagent completes | Aggregate results, cleanup | | `Stop` | Agent session ends | Generate reports, cleanup | ## Requirements 1. Inspect existing hooks in `.github/hooks/` (if any) and match conventions. 2. Create the hook configuration: - **Workspace scope**: Create a JSON file at `.github/hooks/<name>.json` - **Agent scope**: Add a `hooks:` field in the agent's `.agent.md` frontmatter (requires `chat.useCustomAgentHooks`) 3. Hook configuration format (JSON):
fill the variables
This prompt has 2 variables. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.
{input:hookPurpose}{input:hookScope}
Unlock with Pro →when to use it
Community prompt sourced from the open-source GitHub repo trsdn/github-copilot-agent (MIT). A "Copilot New Hook.prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
productivitycommunitydeveloper
source
trsdn/github-copilot-agent · MIT
more in Productivity
Productivity✓ tested
Summarize a doc into decisions & actions
chief of staff who extracts what to DO, not just what was said
Productivity✓ tested
Draft a reply to a hard email
calm, direct communicator who de-escalates without caving
Productivity✓ tested
Turn a brain-dump into a weekly plan
planning coach who protects your focus, not just your calendar