AI / GitHub Copilot CLI Fundamentals Interview Questions
What are Copilot CLI hooks and what can they be used for?
Hooks are user-defined scripts that Copilot CLI invokes automatically at specific points during a session - for example, before or after Copilot modifies files. They let you inject custom logic (validation, notifications, formatting) into the Copilot workflow without modifying the agent's core behaviour.
| Aspect | Detail |
|---|---|
| Configuration | Defined in the Copilot CLI config or a hooks configuration file |
| Hook events | Pre-task, post-task, pre-file-write, post-file-write, and others depending on the version |
| Input payload | Hooks receive a JSON payload describing the current action |
| Decision control | Hooks can allow, block, or modify Copilot's planned actions |
| Use cases | Auto-format code after edits, run linters, send Slack notifications, enforce security policies |
# Example hook: run prettier after every file write # hooks config (format may vary - check docs for current schema) hooks: post-file-write: - command: "npx prettier --write {file}" description: "Auto-format after Copilot edits" # Example hook: block writes to sensitive paths # A hook can inspect the planned file path and return # a decision to allow or deny the write
For detailed information about hooks - including configuration formats, supported events, input payloads, and decision control - see the GitHub Copilot hooks reference in the official documentation.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
