uk-legal-mcp: Command for Claude Code

.claude/commands/bug.md

bug is a command for Claude Code from paulieb89/uk-legal-mcp. It costs 0 tokens per session (447 once invoked), scanned A, original, MIT.

A bug-fixing command that requires a failing test before changing the code, then checks the fix and records rules for preventing similar bugs. A test is a repeatable check that confirms software behaves correctly.

In plain words
What is it for?
Use it to reproduce a bug, identify its cause, write a test that shows the failure, apply the smallest fix, and run the relevant and full test suites.
Why use it?
It prevents bugs from being fixed without proof and helps stop the same problem from returning. It also checks that the change does not break other behavior.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is paulieb89/uk-legal-mcp's own configuration. It tells Claude Code how to work on uk-legal-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything uk-legal-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to paulieb89/uk-legal-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/paulieb89/uk-legal-mcp/main/.claude/commands/bug.md
Clone the repo
git clone --depth 1 https://github.com/paulieb89/uk-legal-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bug

README.md
[![agentmods](https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/bug/github.svg)](https://agentmods.dev/commands/paulieb89/uk-legal-mcp/bug)
Your own site
<a href="https://agentmods.dev/commands/paulieb89/uk-legal-mcp/bug"><img src="https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/bug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bug

Your own site · 80×15
<a href="https://agentmods.dev/commands/paulieb89/uk-legal-mcp/bug"><img src="https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/bug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 447 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00447
Opus 5 $0.00000 $0.00224
Sonnet 5 $0.00000 $0.00089
Haiku 4.5 $0.00000 $0.00045

Measured 12d ago against content hash 973f4f1c7cfa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

bug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/bug.md · 43 lines

What it actually says

/bug — Fix a bug and lock it in as a test

The incident-to-eval flywheel. Never close a bug without completing all three steps. Argument: description of the bug.

Step 1: Reproduce and understand

  • Find the exact failing case (input → wrong output)
  • Identify the root cause in source code
  • Check if this is a known antipattern (read .claude/rules/ for the relevant area)

Step 2: Write the failing test FIRST

Before touching the implementation:

  • Add a test that captures the wrong behaviour (it should FAIL right now)
  • Name it test_<what_was_wrong> — e.g. test_legislation_citation_section_prefix_wrong
  • Run it to confirm it fails: uv run pytest tests/test_<file>.py::test_<name> -v

Step 3: Fix the implementation

  • Make the minimum change to fix the bug
  • python -m py_compile on the changed file
  • Run the new test — it should now PASS
  • Run the full suite — nothing else should break: uv run pytest -m "not live" -q

Step 4: Encode the invariant

If this bug class has occurred before or is likely to recur:

  • Add a rule to the relevant .claude/rules/<area>.md file
  • If it's a critical antipattern, add it to the root CLAUDE.md under the relevant section

Commit format

fix(<module>): <what was wrong and what is now correct>

Fixes: <description of the failure>
Root cause: <one sentence>
Guard: <test name that locks this in>

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

What NOT to do

  • Do not fix the bug without a test — the next agent session won't know this class of bug exists
  • Do not add a workaround at the prompt level — if the code is wrong, fix the code
  • Do not close the bug before the full test suite passes
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 43 lines · 0 tokens per session scan A 973f4f1c7cfa

Subscribe to this mod's changes

bug is a command published in the GitHub repository paulieb89/uk-legal-mcp (16 stars, last pushed 7d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 447 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.