legalize-es-spanish-legislation
Query, browse, and analyze Spanish legislation stored as Markdown files with full Git history in the legalize-es repository.
What this skill does
# Legalize ES — Spanish Legislation Git Repository
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
## What It Is
`legalize-es` is a Git repository containing 8,600+ Spanish laws as Markdown files, with every legislative reform recorded as a Git commit. Each law is a single `.md` file named by its BOE identifier (e.g. `BOE-A-1978-31229.md` for the Spanish Constitution). Reform history goes back to 1960.
**Key capabilities:**
- Full text search across all laws with `grep`
- Exact diff between any two versions of a law using `git diff`
- Timeline of all reforms to a specific law using `git log`
- Historical state of any law at any point in time using `git show`/`git checkout`
---
## Setup
```bash
# Clone the full repo (includes all history)
git clone https://github.com/legalize-dev/legalize-es.git
cd legalize-es
# Shallow clone if you only need current state (much faster)
git clone --depth 1 https://github.com/legalize-dev/legalize-es.git
cd legalize-es
```
All law files live in the `spain/` directory.
---
## File Structure
```
spain/
├── BOE-A-1978-31229.md # Constitución Española
├── BOE-A-1995-25444.md # Código Penal
├── BOE-A-2015-11430.md # Estatuto de los Trabajadores
├── BOE-A-2000-323.md # Ley de Enjuiciamiento Civil
└── ... (8,600+ laws)
```
### YAML Frontmatter
Every file starts with structured metadata:
```yaml
---
titulo: "Constitución Española"
identificador: "BOE-A-1978-31229"
pais: "es"
rango: "constitucion"
fecha_publicacion: "1978-12-29"
ultima_actualizacion: "2024-02-17"
estado: "vigente"
fuente: "https://www.boe.es/eli/es/c/1978/12/27/(1)"
---
```
**`rango` values:**
- `constitucion`
- `ley-organica`
- `ley`
- `real-decreto-ley`
- `real-decreto-legislativo`
**`estado` values:**
- `vigente` — currently in force
- `derogado` — repealed
---
## Key Commands
### Find a Law by Topic
```bash
# Search law titles in frontmatter
grep -rl "trabajo" spain/ | head -20
# Search for a keyword across all law bodies
grep -rl "huelga" spain/
# Case-insensitive search for a concept
grep -rli "protección de datos" spain/
```
### Read a Specific Article
```bash
# Find Article 18 of the Constitution
grep -A 20 "Artículo 18" spain/BOE-A-1978-31229.md
# Find an article with context (10 lines before, 30 after)
grep -B 10 -A 30 "Artículo 135" spain/BOE-A-1978-31229.md
```
### Find a Law by Its BOE Identifier
```bash
# If you know the BOE ID
cat spain/BOE-A-1995-25444.md
# Search by partial identifier
ls spain/ | grep "BOE-A-1995"
```
### Filter by Law Type
```bash
# List all Organic Laws
grep -rl 'rango: "ley-organica"' spain/
# List all currently active laws
grep -rl 'estado: "vigente"' spain/
# List all repealed laws
grep -rl 'estado: "derogado"' spain/
```
---
## Git History Commands
### See All Reforms to a Law
```bash
# Full reform history of the Spanish Constitution
git log --oneline -- spain/BOE-A-1978-31229.md
# With dates
git log --format="%h %ad %s" --date=short -- spain/BOE-A-1978-31229.md
# With full commit messages (includes reform source URL)
git log -- spain/BOE-A-1978-31229.md
```
### Diff Between Two Versions
```bash
# Diff of a specific reform commit
git show 6660bcf -- spain/BOE-A-1978-31229.md
# Diff between two commits
git diff 6660bcf^..6660bcf -- spain/BOE-A-1978-31229.md
# Diff between two dates
git diff $(git rev-list -1 --before="2011-01-01" HEAD) \
$(git rev-list -1 --before="2012-01-01" HEAD) \
-- spain/BOE-A-1978-31229.md
```
### Read Historical Version of a Law
```bash
# State of the Constitution as of 2010-01-01
git show $(git rev-list -1 --before="2010-01-01" HEAD):spain/BOE-A-1978-31229.md
# Check out law at a specific commit (read-only inspection)
git show abc1234:spain/BOE-A-1978-31229.md
```
### Find When a Specific Text Was Added or Removed
```bash
# Find which commit introduced "estabilidad presupuestaria"
git log -S "estabilidad presupuestaria" -- spain/BOE-A-1978-31229.md
# Find which commit changed a specific phrase
git log -G "límite de déficit estructural" --oneline -- spain/BOE-A-1978-31229.md
```
---
## Programmatic Access Patterns
### Shell Script: Extract All Law Titles
```bash
#!/bin/bash
# Extract titles and identifiers from all laws
for file in spain/*.md; do
id=$(grep 'identificador:' "$file" | head -1 | sed 's/.*: "//;s/".*//')
title=$(grep 'titulo:' "$file" | head -1 | sed 's/.*: "//;s/".*//')
echo "$id | $title"
done
```
### Shell Script: Find Laws Updated After a Date
```bash
#!/bin/bash
# Laws updated after 2023-01-01
TARGET_DATE="2023-01-01"
grep -rl "ultima_actualizacion:" spain/ | while read file; do
date=$(grep 'ultima_actualizacion:' "$file" | head -1 | grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}')
if [[ "$date" > "$TARGET_DATE" ]]; then
echo "$date $file"
fi
done | sort -r
```
### Python: Parse Law Frontmatter
```python
import os
import yaml
def parse_law(filepath):
"""Parse a law Markdown file and return frontmatter + body."""
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Extract YAML frontmatter between --- delimiters
if content.startswith('---'):
parts = content.split('---', 2)
if len(parts) >= 3:
metadata = yaml.safe_load(parts[1])
body = parts[2].strip()
return metadata, body
return {}, content
# Example: list all active laws
laws_dir = 'spain'
active_laws = []
for filename in os.listdir(laws_dir):
if filename.endswith('.md'):
filepath = os.path.join(laws_dir, filename)
meta, body = parse_law(filepath)
if meta.get('estado') == 'vigente':
active_laws.append({
'id': meta.get('identificador'),
'titulo': meta.get('titulo'),
'rango': meta.get('rango'),
'ultima_actualizacion': meta.get('ultima_actualizacion'),
})
# Sort by last update
active_laws.sort(key=lambda x: x['ultima_actualizacion'] or '', reverse=True)
for law in active_laws[:10]:
print(f"{law['ultima_actualizacion']} [{law['rango']}] {law['titulo']}")
```
### Python: Get Reform History via Git
```python
import subprocess
import json
def get_reform_history(boe_id):
"""Get all commits that modified a law file."""
filepath = f"spain/{boe_id}.md"
result = subprocess.run(
['git', 'log', '--format=%H|%ad|%s', '--date=short', '--', filepath],
capture_output=True, text=True
)
reforms = []
for line in result.stdout.strip().split('\n'):
if line:
hash_, date, subject = line.split('|', 2)
reforms.append({'hash': hash_, 'date': date, 'subject': subject})
return reforms
# Example usage
history = get_reform_history('BOE-A-1978-31229')
for reform in history:
print(f"{reform['date']} {reform['hash'][:7]} {reform['subject']}")
```
### Python: Compare Two Versions of a Law
```python
import subprocess
def diff_law_versions(boe_id, commit_before, commit_after):
"""Get unified diff between two versions of a law."""
filepath = f"spain/{boe_id}.md"
result = subprocess.run(
['git', 'diff', f'{commit_before}..{commit_after}', '--', filepath],
capture_output=True, text=True
)
return result.stdout
def get_law_at_date(boe_id, date_str):
"""Get the text of a law as it was on a given date (YYYY-MM-DD)."""
filepath = f"spain/{boe_id}.md"
# Find the last commit before date
rev = subprocess.run(
['git', 'rev-list', '-1', f'--before={date_str}', 'HEAD'],
capture_output=True, text=True
).stdout.strip()
if not rev:
return None
content = subprocess.run(
['git', 'show', f'{rev}:{filepath}'],
capture_output=True, text=True
).stdout
return content
# Example: see Constitution before and after 2011 reform
old_text = get_law_at_date('BOE-A-1978-31229', '2011-09-26')
new_text = get_law_at_date('BOE-A-1978-31229', '2011-0Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.