Question · Vibe coding with Claude Code course · Module 8: Slack clone

Quiz: Why jq and file_path in a hook

Why does the command of the formatting hook start with f=$(jq -r '.tool_input.file_path')?

Answer options

  • It pulls out of the JSON that Claude Code passes to the hook on standard input the path of the edited file, so Prettier formats only that file
  • It installs Prettier if the project does not have it
  • It saves the list of all repository files in the variable f
  • It checks whether the edited file has type errors

You can check the correct answer by solving this task in the CodeWorlds game.