I put all 8,642 Spanish laws in Git – every reform is a commit
I put all 8,642 Spanish laws in Git – every reform is a commit
I built a pipeline that converts all Spanish state legislation into version-controlled Markdown. Each law is a file, each reform is a real git commit with the historical date. 8,642 laws, 27,866 commits.
The idea: legislation is just patches on patches on patches. Git already solves this. Instead of reading "strike paragraph 3 and replace with...", you get an actual diff.
The repo is the product. Browse any law, git log to see its full reform history, git diff to see exactly what changed.
Built the pipeline in ~4 hours with Claude Code. Source is BOE (Spain's official gazette) consolidated legislation API.
Exploring whether there's a business here — structured legislation API for legaltech/compliance, or just a useful open dataset. Curious what HN would build with this data.
cool idea, how far back (in time) do those 27k commits go?
Just thinking how this could maybe used for (automated) research / visualization on the evolution of (spanish - in this case) law
> how far back (in time) do those 27k commits go
Looking at the commit dates (which seem to be derived from the original publication dates) the history seems quite sparse/incomplete(?) I mean, there have only been 26 commits since 2000.
That's true, but it might not be as important here.
Spain is not a country with a Common Law legal system entirely like the US or the UK. They have a civil law system where prior court judgement does not form a strictly binding precedent. Prior judgements can be important, but case law is not really a thing.
Laws are often cascaded as well. Specifically in this case, Spain is subdivided into Comunidades Autonomas - each have their own elected parliament. And inside those are cities with their own local laws.
So while this project does track laws, is there any facility to determine which laws from which bodies are relevant to a specific activity in a specific location?
Oooh Can you elaborate a bit how the gazette is publishing them? Like what format did you have to parse. And how many documents were there in total? I tried doing the same for German laws 1-2 years ago but LLMs weren't smart enough yet. And the costs would've been at least a couple of thousand €.
Ed: Nevermind, I missed the "BOE (Spain's official gazette) consolidated legislation API" part. Sending jealous greetings from Germany. We just have a bunch of PDFs in Germany. And the private entity that has been publishing them for decades even claims copyright on them!
That could actually be a git commit log with date, votes and other metadata.
But getting the entire country's law into git is already an impressive feat.
Congratulations! This is a very cool project. A few years ago there were similar ones -- browse gitlaw.
In Brazil we have lexml, a standard to describe the law and their changes over time. It's surprisingly complex.
Hah! XML strikes again. :-)
I understand that Spain was a participant in LexML as well... I gather they've since converted to something else?