uk-legal-mcp: Command for Claude Code

.claude/commands/audit.md

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

A command for checking whether the uk-legal-mcp server follows its required technical and documentation rules before development begins.

In plain words
What is it for?
It compiles Python files, runs the non-live tests, and audits tool descriptions and Parliament API parameters and response fields.
Why use it?
It finds syntax errors, failing tests, incorrect tool descriptions, and mismatches with Parliament's API before implementation work starts.

Command for Claude Code

Written for Claude Code: installed under .claude/.

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 →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is uv run python tests/audit_descriptions.py.

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/audit.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 audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/audit/github.svg)](https://agentmods.dev/commands/paulieb89/uk-legal-mcp/audit)
Your own site
<a href="https://agentmods.dev/commands/paulieb89/uk-legal-mcp/audit"><img src="https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/audit/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 audit

Your own site · 80×15
<a href="https://agentmods.dev/commands/paulieb89/uk-legal-mcp/audit"><img src="https://agentmods.dev/badge/commands/paulieb89/uk-legal-mcp/audit.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 519 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.00519
Opus 5 $0.00000 $0.00260
Sonnet 5 $0.00000 $0.00104
Haiku 4.5 $0.00000 $0.00052

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

Security

Grade A, and why

audit 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/audit.md · 59 lines

How it starts

The opening of the file, as written. The whole thing — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/audit — Conformance check before starting work

Run a full conformance audit of the uk-legal-mcp server. Report PASS / WARN / FAIL per check. Do not start any implementation work until this audit is complete.

Step 1: Syntax check all source modules

python -m py_compile src/gateway.py
python -m py_compile src/deps.py
python -m py_compile src/envelope.py
python -m py_compile src/xml_safe.py
for each file in src/modules/**/tools.py:
    python -m py_compile <file>

Report: PASS if all compile clean, FAIL with filenames if any fail.

Step 2: Run the non-live test suite

uv run pytest -m "not live" -q

Report: PASS with count, or FAIL with the first failure output.

Step 3: Check tool description conformance

uv run python tests/audit_descriptions.py

Report: PASS if all descriptions follow 4-part pattern, WARN with list of deviating tools.

Step 4: Parliament param audit (static, no network)

uv run python tests/audit_parliament_params.py

Report: PASS if no wire-name mismatches, WARN with specific param names that diverge from Swagger.

Step 5: Parliament response field audit (static, no network)

uv run python tests/audit_parliament_responses.py

Report: PASS if no schema mismatches, WARN with field names that are consumed but undeclared.

Step 6: Check for known antipatterns in source

Search src/ for:

  • RuntimeError in tools — should be ToolError (WARN with locations)
  • lxml.etree.fromstring directly — should use parse_xml from xml_safe (FAIL if found)
  • ctx.request_context.lifespan_state — removed v2 API (FAIL if found)

Final output

Print a summary table:

Check Status Notes
Syntax ... ...
Non-live tests ... ...
Description conformance ... ...
Parliament params ... ...
Parliament responses ... ...
Antipattern scan ... ...

Read the full file on GitHub · 59 lines

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 · 59 lines · 0 tokens per session scan A e2a1cd72cbfb

Subscribe to this mod's changes

audit is a command published in the GitHub repository paulieb89/uk-legal-mcp (16 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 519 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.