Claude Code hook

Probity

TDD enforcement and guardrail hooks for Claude Code, Codex and Copilot CLI from the TDD Guard author.

241 stars 30 forksHooks Plugin marketplace Source

Install

Inside Claude Code
/plugin marketplace add nizos/probity
From source
git clone https://github.com/nizos/probity.git

From the README

Probity

Probity forces AI coding agents to follow your rules. It hooks into your agent and checks every file write and shell command before it happens. When an action breaks a rule, Probity blocks it and tells the agent why.

You can use it to enforce Test-Driven Development with the built-in rule, block destructive commands, or keep unwanted patterns out of your code. Writing your own rules takes a few lines of TypeScript, and one config works across most coding agents.

Probity is featured on the Modern Software Engineering channel, where Emily Bache and Nizar Selander discuss what TDD looks like when an agent writes the code. A separate Q&A with factor10's Jimmy Nilsson covers using Probity on real projects, and links the full kata run.

How it works

When a rule is broken, the agent sees a reason and a path forward:

The agent corrects course and continues.

Rules can be deterministic, matching commands or file content by string or regex, or AI-validated using official SDKs. Both kinds can read recent session activity, so actions are judged in context.

Quick start

Create probity.config.ts at your project root:

Then wire it into your agent. One-time setup per agent.

Built-in rules

- enforceTdd(): failing test first, minimal implementation, refactor on green
- forbidCommandPattern(): block shell commands by pattern
- requireCommand(): require a prior command (e.g. tests before commit)
- forbidContentPattern(): block writes containing a pattern
- enforceFilenameCasing(): enforce a filename casing style

FAQ

Does it work with my agent?
Probity currently works with Claude Code, Codex, and GitHub Copilot CLI, with more coming.

Does it work with my language?
Probity reads each agent's session transcript directly, so there are no per-framework reporters to install.…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Repository
nizos/probity
Type
Hooks
Language
TypeScript
License
MIT
Last updated
26 October 2026
Topics
agentic-codingclaude-codecodexcoding-agentgithub-copilotguardrailshookspolicytdd

FAQ

What is Probity?

TDD enforcement and guardrail hooks for Claude Code, Codex and Copilot CLI from the TDD Guard author. It is a hook for Claude Code, from nizos/probity on GitHub.

How do I install Probity?

Run /plugin marketplace add nizos/probity inside Claude Code, then follow the setup in the README.

Is Probity popular?

nizos/probity has 241 GitHub stars and 30 forks. It was last updated on 26 October 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.