-
-
Paste a Madrid rental contract or open one of three samples in one click. Free, in English, no account.
-
10 not enforceable, 2 worth checking, 6 fine, and 7,141.50 euros over the legal limit. The signing date picks the law.
-
On a phone the margin notes become a bottom sheet. Every flag quotes the article and links to the BOE.
Inspiration
I don't have a bad-landlord story. I've never signed an abusive clause, so I won't pretend I did. What pulled me in is how much a tenant has to take on trust. A Madrid rental contract is written in legal Spanish, and the law behind it changed in March 2019, in May 2023 and again on 8 October 2026 (that last reform still needs a vote in Congress). Most people sign without knowing which clauses wouldn't hold.
It isn't a small group. 525,834 households rent in the Madrid region (INE, Census 2021). In Madrid city, 41% of renting households spend more than 30% of their net income on rent (Banco de España, Annual Report 2025). There are 40,092 international students in in-person universities in the Community of Madrid (FBBVA-Ivie, 2023-24), and plenty of them can't read the contract they're handed. And FACUA found that three in four Madrid agencies it checked still tried to charge tenants fees after that was banned (11 July 2023).
The other reason is mine. The first skill of the Devpost Learn Skill Pack asks what you want to learn. I wrote that I wanted to learn how to make what an AI says checkable. A chatbot can invent an article of the law. I wanted something where every claim can be traced back to the contract and to the BOE.
What it does
You paste the text of a Madrid rental contract, in Spanish, or drop the PDF. Fair Lease marks, on your own text, every clause that Spanish law doesn't allow.
Each flag gives you the exact article (the Spanish quote, an unofficial English translation and a link to the BOE), a plain-English explanation, and what to ask for instead, in Spanish and in English, ready to copy.
The result also does the sums. In the sample full of traps, the contract ties up €11,741.50 at signing. The legal maximum is €4,600. That's €7,141.50 more than the law allows, and the number comes from the contract's own clauses.
A timeline of the law (March 2019, May 2023, 8 October 2026) puts a marker on the signing date, because the date decides which version applies. The same waiver of your right to buy first is fine in a contract signed in 2025 and not enforceable in one signed after the October 2026 reform, which the app tags "pending Congress vote".
It covers the six clauses Spain's consumer ministry listed in May 2026 as the abusive ones it found most often in rental contracts, from agency fees to a penalty of three times the daily rent for handing the keys back late.
It isn't alarmist. A fair contract comes out clean: "No problems found in the 22 rules we check."
"Write to my landlord" builds a message in Spanish with every change you'd ask for. It's filled in from templates tied to the rules, not written by an AI, and you add your name before sending.
It's free, in English, and there's no account. Three sample contracts open in one click. A PDF is read in your browser and the file never leaves your device. Before anything is sent, your browser removes ID numbers, IBANs, phone numbers and emails, and the contract isn't stored. It's an information tool, not legal advice.
How I built it
The AI never gives a verdict. That's the whole design.
- The browser reads the PDF, if you drop one, and removes personal data.
- Claude Sonnet 5.5 reads the contract and returns facts and literal quotes through structured output. No verdicts.
- The code checks that every quote is literally in your text. A quote that isn't there gets dropped, and the app says how many.
- The signing date picks the version of the law.
- 22 public rules, written from the BOE, turn those facts into verdicts, euro amounts and articles. They're in the repo (docs/rules.md).
The three samples skip step 2. Their extraction was recorded once with Claude Opus 5.5 and saved in the repo. Steps 3 to 5 still run for real every time, so the samples open instantly, work without an API key and never fake the part that decides. The app labels them "recorded"; a live check says which model read it.
The stack is Next.js 16.4 (App Router) with TypeScript and Tailwind CSS 4, the Anthropic TypeScript SDK with structured outputs, zod, pdf.js in the browser, Vitest and Playwright, deployed on Vercel. The design is a paper contract with notes in the margin, set in Newsreader and Inter. The underline is painted in the colour of each verdict. On a phone the notes become a bottom sheet, and there's a dark mode.
I tested it with 136 unit tests and 64 browser checks at 1440 and 390 px. A live check with Sonnet 5.5 takes about 14 seconds and costs about $0.05. Recording the three samples with Opus 5.5 cost $0.24 in total. The public site allows 25 live checks a day.
To check that this isn't just asking the AI, I measured it on contracts the rules weren't built on. I wrote six new fictional contracts, labelled their 84 clauses by hand from my legal notes and committed the labels before anything read them (commit 94e242c). Then I ran the same Sonnet 5.5 two ways, three times each: through Fair Lease, and with a plain question and no rules. On that first run Fair Lease got 75 of 84 clauses right in all three runs and Sonnet alone 69.7 on average. Sonnet alone flagged more of the problem clauses (22 of 25, against 17), but it applied an older version of the law to three of the six contracts in every run and called a legal guarantee illegal and an illegal one fine. It never made up a quote or an article. Fair Lease's nine misses were five clauses it had no rule for, three gaps in its rules and one false alarm. I added the four missing rules from my notes, fixed the gaps, and a fresh run got 84 of 84 in all three runs, and 41 of 41 on my original three samples. The whole evaluation cost $3.41 in API calls, and the method, every miss and every raw answer are in eval/README.md.
What I don't claim: the 84 of 84 came after I saw the misses, so it isn't a blind score. The blind number is 75. My labels and my rules have the same author, so the scores show that the app reproduces a hand-checked reading of the law, not that a lawyer audited it. Every contract I measured on is fictional.
Before I created the project folder I had legal research notes (the LAU checked against the BOE) and three fictional contracts with their expected results. I prepared them with AI help. There was no code yet.
Challenges I ran into
Real Claude output broke my hand-made test data. I wrote the expected results (10 not enforceable, 2 worth checking, 6 fine) before any code. When Claude Haiku's output arrived, it had split one clause into two quotes, so the same rule fired twice and I got 11 instead of 10. Claude Opus did the opposite: it merged clause nine into one quote, and the "fine" on the six-month clause disappeared. I fixed both in the rules, and the tests now compare verdicts.
How strict can the quote check be before it throws away real quotes? I made it an exact match after normalising the text, then measured it. Across the three recordings and the live checks, no real quote was lost.
A PDF doesn't keep its text in reading order. A contract in two columns can come out line by line across both columns, and a clause heading can run into the clause before it. I rebuild each page from where every piece of text sits: lines by their baseline, columns by the empty gap between them, paragraphs by the space between lines, with page numbers dropped. I check it on the three sample PDFs and on awkward ones: two columns, no space between paragraphs, a scan and a password.
The law is moving. The October 2026 reform hasn't been voted yet, so the app applies it and says so on screen, instead of presenting it as settled.
And the margin. A clause can trip two rules, so I stack the badges and mark the clause with a "2". The fifth clause, opened in full, was taller than the contract itself, so now only one note is open at a time.
Accomplishments that I'm proud of
- On six contracts labelled before any run, Fair Lease got 75 of 84 clauses right the first time, against 69.7 for the model alone, and 84 of 84 once I fixed the nine misses that run showed.
- The fair contract comes out clean. I care about that as much as the red.
- The AI never decides. The number a tenant will remember, €7,141.50 over the limit, comes from fixed rules, with the quote and the article one click away.
- A PDF works exactly like pasted text, and the file never leaves the browser.
- It's live, it needs no account, and the repo is public under MIT with the scope, PRD and spec next to the code.
What I learned
Write the expected results before the code. My test data looked fine until Claude's real output arrived, and only then did the two bugs show up.
Then test on contracts the code has never seen, and commit the labels before running anything. My six new contracts found nine misses my three samples never could, and the commit is what makes the first number worth reading.
Let the model do the part it's good at, reading and quoting, and let plain code do the part that has to be right: checking quotes, picking the law, giving verdicts. It's easier to trust and easier to test.
A law has versions. For a rental contract the signing date matters as much as the clause.
Planning first paid off in small things. The PRD made me decide the odd states (no signing date, not a contract, API down, daily cap reached, text too long) before building, and all of them are built and tested.
What's next
- Have a tenants' union or a lawyer label real, anonymised contracts, so the labels and the rules no longer share an author.
- Scanned PDFs, which would need OCR.
- Room rentals and student residences, regions with their own law such as Catalonia, a fully Spanish interface, and alerts when the law changes.
- Update the rules once Congress votes on the October 2026 reform.
Built With
- anthropic
- claude
- next.js
- node.js
- pdf.js
- playwright
- react
- tailwindcss
- typescript
- vercel
- vitest
- zod
Log in or sign up for Devpost to join the conversation.