uk-law-agent
uk-law-agent
A cross-platform AI agent skill for UK legal research: finding, reading, and citing UK legislation and case law from two public, unauthenticated data sources.
It works in Claude Code, Cursor, Codex, Gemini CLI, GitHub Copilot, Windsurf,
and 30+ other agents that load SKILL.md skills. Install it into all of them with
a single npx command - no GitHub required.
This is legal research tooling, not legal advice. It helps locate and verify primary sources and produce properly cited output; it does not substitute for advice from a qualified lawyer.
Install
Into AI agents (all detected agents at once)
npx uk-law-agent install
This copies the skill into every agent's skills directory that is already present
on your machine (~/.claude/skills/, ~/.cursor/skills/, ~/.codex/skills/,
~/.gemini/skills/, etc.). Options:
npx uk-law-agent install --all # every supported agent, detected or not
npx uk-law-agent install --agent "Claude Code" # one agent only
npx uk-law-agent install --dry-run # preview without writing
npx uk-law-agent list-agents # show known agents + detection status
For Claude Code, the install also drops two subagents into ~/.claude/agents/:
uk-legal-researcher- dispatched for multi-step research, returns a finished cited memo.uk-legal-plain-english- dispatched after research, rewrites that memo into a plain-English brief for a non-lawyer.
Other agents have no subagent layer and use the skill inline. They lose nothing: the
full workflow, the memo structure and the plain-English spec all live inside SKILL.md
and references/, so every supported agent can produce both outputs.
Use the scripts directly (no agent needed)
npx uk-law-agent lex search-sections "unfair dismissal" --json
npx uk-law-agent caselaw search --query "unfair dismissal" --court eat --per-page 10
lex and caselaw are passthroughs to the bundled Python scripts. This is handy
for quick lookups or scripting without an agent in the loop.
Manual install (clone + copy)
If you prefer not to use npx, clone the repo and copy the skill directory into your agent's skills folder:
git clone https://tig.sshah.email/Cheeba/uk-law-agent.git
# Claude Code
cp -r uk-law-agent/.claude/skills/uk-legal-research ~/.claude/skills/
cp uk-law-agent/.claude/agents/*.md ~/.claude/agents/
# Cursor
cp -r uk-law-agent/.claude/skills/uk-legal-research ~/.cursor/skills/
# Codex / Gemini CLI / Copilot / Windsurf ... same idea:
cp -r uk-law-agent/.claude/skills/uk-legal-research ~/.codex/skills/ # Codex
cp -r uk-law-agent/.claude/skills/uk-legal-research ~/.gemini/skills/ # Gemini CLI
See npx uk-law-agent list-agents for every supported target directory.
skillfish (optional, GitHub only)
The repo is also skillfish-compatible (it has a SKILL.md). If you mirror it to
GitHub, users can install it with npx skillfish add TBC/uk-law-agent. Note
that skillfish's add command only works with GitHub repos, which is why this repo
ships its own npx uk-law-agent install that works from any git host.
Data sources and their limits
Lex API - https://lex.lab.i.ai.gov.uk
UK legislation only, published by i.AI (UK Government Incubator for AI), open source at github.com/i-dot-ai/lex. Covers 220,000 Acts and Statutory Instruments, 2.1M provisions, 92,000 explanatory note sections, and 2.5M amendments.
- Experimental. It is a lab service and may change behaviour or disappear without notice.
- Verified gap: no case law. The
/caselaw/*routes described in the project's own README return HTTP 404 on the live deployment. Do not use it for judgments.
Find Case Law - https://caselaw.nationalarchives.gov.uk
The National Archives' official judgment database. Used for all case law lookups.
- Published under the Open Justice Licence - attribution is required when quoting or reproducing judgment text.
- Verified gap: no Scottish Court of Session/High Court of Justiciary and no Northern Ireland court judgments. Coverage is UK-wide apex courts (UK Supreme Court, Privy Council), England & Wales courts, and UK-wide tribunals only. Scots and NI first-instance/intermediate appellate judgments must be sourced from scotcourts.gov.uk and judiciaryni.uk respectively - this tool does not reach them.
Using the skill
Once installed, the skill is loaded by description-match whenever a query touches
UK legislation, case law, or statutory research. The agent runs the helper scripts
to search and fetch sources, then synthesises a cited answer. See
.claude/skills/uk-legal-research/SKILL.md for the full research method,
non-negotiable rules, and the memo output structure.
Plain-English output
The default output is a formal, OSCOLA-cited memo. Ask for a plain-English version and the skill rewrites it as a brief aimed at an intelligent non-lawyer: what the law says, what it means for you, what to watch out for, what is not certain, and a glossary.
The rewrite is a translation step, never a research step. It adds no citation, date or legal claim that is not already in the memo, and it carries every caveat through - jurisdiction, currency date, coverage gaps, and the research-not-advice disclaimer. It never turns "I did not find X" into "there is no X", and it never hardens a hedge. The cited memo remains the authoritative artifact; the brief sits alongside it.
This works on every supported agent. On Claude Code it runs as the
uk-legal-plain-english subagent; elsewhere the same spec runs inline from SKILL.md.
The rules are in .claude/skills/uk-legal-research/references/plain-english.md.
Scripts are stdlib-only Python 3 - invoke them with python3 (macOS/Linux) or
python (Windows). From a shell:
python3 scripts/lex.py healthcheck
python3 scripts/lex.py search-sections "unfair dismissal" --json
python3 scripts/lex.py lookup-act ukpga/1996/18
python3 scripts/lex.py search-amendment-sections ukpga/1996/18/section/98
python3 scripts/caselaw.py search --query "unfair dismissal" --court eat --per-page 10
python3 scripts/caselaw.py get eat/2026/119 --max-paras 20
File layout
.claude/
skills/uk-legal-research/
SKILL.md entry point, research method, rules, output structure
references/
lex-api.md Lex endpoint table, schemas, gotchas
caselaw-api.md Find Case Law params, court codes, coverage limits
legislation-types.md 27 legislation types, categories, jurisdictions, extent
research-playbooks.md step-by-step sequences per question type
citation-guide.md OSCOLA formatting
plain-english.md plain-English rewrite rules for a lay audience
scripts/
lex.py CLI for the Lex API
caselaw.py CLI for Find Case Law
lexlib.py shared HTTP/throttle/parsing helpers
agents/
uk-legal-researcher.md Claude Code subagent (dispatched for multi-step research)
uk-legal-plain-english.md Claude Code subagent (rewrites a memo into plain English)
bin/
cli.js npx installer + script passthrough (zero deps)
package.json npm package definition
README.md
LICENSE
Requirements
- Python 3, standard library only - no
pip install, no virtualenv required. - Node.js >= 18 only if you use
npx uk-law-agent install/ the npx CLI. - Internet access to
lex.lab.i.ai.gov.ukandcaselaw.nationalarchives.gov.uk.
Rate limits
- Lex API: 60 requests/minute, 1000 requests/hour.
- Find Case Law: 1000 requests per rolling 5-minute window.
Scripts and agents should work breadth-first (search/lookup) before depth (full text fetches), and avoid re-fetching content already retrieved in the same session.
Licensing and attribution
The tooling in this repo (scripts, skill markdown, installer) is MIT licensed - see LICENSE.
The AI-writing patterns in references/plain-english.md are adapted from the
humanizer skill (MIT, 2025 Siqi Chen), which is
itself based on
Wikipedia:Signs of AI writing,
maintained by WikiProject AI Cleanup.
Find Case Law content is published under the Open Justice Licence. Any quoted or reproduced judgment text must carry appropriate attribution to The National Archives per that licence. Lex API content is drawn from UK legislation.gov.uk data via the experimental Lex service; treat it as provisional and verify against legislation.gov.uk where certainty matters.
Not legal advice
Everything produced by this skill - search results, extracted provisions, case summaries, citation tables, synthesised answers - is legal research, not legal advice. It is not a substitute for consulting a qualified solicitor or barrister, and outputs should always disclose their own gaps and coverage limits rather than present a confident answer where the underlying sources did not support one.