I'm a software developer. Claude Code is a CLI tool designed for coding tasks - writing code, debugging, refactoring. So naturally, I used it to write a 230-line legal appeal against a government disability decision.
Here's how a programming tool became my most powerful ally in a deeply personal, completely non-technical challenge.
The Problem
My mother has severe spinal degeneration. After 45 years of physically demanding work, multiple surgeries, and recent osteoporotic vertebral fractures, she applied for disability benefits and care allowance from the national pension and disability insurance agency.
The response? Rejected.
The expert medical commission concluded:
- Her spine condition was "congenital" (born with it)
- Treatment was "completed"
- She could perform daily activities independently
- Only 30% disability recognized (50% required for benefits)
Reading the decision, I knew it was wrong. But how do you argue against a medical commission with mountains of paperwork, complex regulations, and 25+ years of medical history?
The Chaos: 50+ Scanned Medical Documents
My mother's medical history was a nightmare to navigate:
spine-findings/ # Spine-related medical records (12 files)
additional-findings/ # Additional medical findings (8 files)
application-docs/ # Original application attachments (15 files)
new-findings-2026/ # Recent findings from January 2026 (20+ files)
commission-opinion/ # The commission's expert opinion (6 files)
All scanned as JPG images. Handwritten doctor's notes from 1998. Faded hospital discharge papers. CT scan reports. Years of medical history trapped in pixels.
Step 1: OCR with Google Gemini API
First challenge: extract text from images.
Side note: Claude Code can also read images and perform OCR directly. However, for bulk processing of 50+ scanned medical documents - many with handwritten notes and faded text from the 1990s - Google's Gemini with "thinking mode" produced significantly better results. Claude Code's OCR is decent for quick reads, but Gemini's accuracy on difficult documents was noticeably superior.
I wrote a simple Python script using Google's Gemini API:
from google import genai
from google.genai import types
def extract_text_from_image(client, image_path):
with open(image_path, "rb") as f:
image_data = f.read()
contents = [
types.Content(
role="user",
parts=[
types.Part.from_bytes(
mime_type="image/jpeg",
data=image_data,
),
types.Part.from_text(
text="Extract all text from this image. "
"Preserve formatting and structure. "
"If handwritten, transcribe to readable form."
),
],
),
]
# Using Gemini's thinking mode for better accuracy
config = types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_level="HIGH"),
)
result = []
for chunk in client.models.generate_content_stream(
model="gemini-3-pro-preview",
contents=contents,
config=config,
):
if chunk.text:
result.append(chunk.text)
return "".join(result)
The script processed entire folders:
python extract_ocr.py "new-findings-2026/"
# Found 24 images without TXT:
# - scan_001.jpg
# - scan_002.jpg
# ...
# Processing: scan_001.jpg... OK -> scan_001.txt
Result: Every medical document now had a searchable .txt companion file.
Step 2: Building Context with CLAUDE.md
Claude Code uses a CLAUDE.md file for project-specific context. I created one explaining the case:
# CLAUDE.md
## Repository Purpose
Document repository for a disability benefits appeal case.
## Document Structure
- **spine-findings/** - Spine medical records (JPG + OCR'd TXT)
- **commission-opinion/** - Expert commission documents
- **appeal-drafts/** - Appeal document versions
## Key Context for Appeal
Main contested points from the expert opinion:
- Health history incorrectly characterized as congenital
- Treatment incorrectly marked as concluded
- Independence incorrectly assessed
- New osteoporotic fractures not considered
- Date of injury incorrectly stated
## Working with Documents
Read .txt versions for text content.
Reference official disability regulations for legal basis.
Use formal legal/medical terminology.
Now Claude Code understood the project structure and goals.
Step 3: The Iterative Writing Process
This is where Claude Code shined. I started with rough notes:
I disagree with the expert opinion because:
- My condition isn't congenital - first problems at age 51
- Treatment ongoing - have orthopedic appointment scheduled
- Can't cook, clean, or do laundry independently
- New vertebral fractures in 2025 weren't considered
Claude Code read all the OCR'd medical files, cross-referenced dates and diagnoses, and produced the first draft. But it didn't stop there.
The secret weapon: I asked Claude Code to fetch and read the official disability regulations directly from the government website - the complete guidelines on how bodily impairments are assessed and calculated. With both the medical evidence AND the legal criteria in context, Claude Code could build arguments that directly mapped specific diagnoses to specific regulation paragraphs. For example, it found that "unstable spinal segment" and "severe spinal stenosis" each qualify as separate impairments that should be added together - something the commission had overlooked.
Version 1 → Version 11: Each iteration got better:
- v1: Basic structure, main arguments
- v3: Added specific medical evidence with dates
- v5: Referenced disability regulations and legal basis
- v9: Incorporated new January 2026 findings
- v10: Added disability calculation showing 50%+ should be recognized
- v11: Final polish, comprehensive evidence list
The final appeal grew from rough notes to a 230-line legal document with:
- 7 major sections with subsections
- 30+ specific medical citations with dates
- Legal references to disability insurance law and internal guidelines
- Calculations showing multiple vertebral segments = higher disability %
- Request for home visit to verify living conditions
The Technical Magic: What Claude Code Actually Did
Claude Code isn't just generating text. It's:
Reading and cross-referencing documents:
"The MRI from November 2000 shows NO pathological changes...
If this were congenital, changes would be visible in 2000."
Understanding medical terminology:
"CT scan confirms: 'Fresh osteoporotic fracture of
L4 vertebral body involving anterior and partially middle column.'"
Applying legal frameworks:
"Per disability guidelines Chapter VIII: 'When multiple segments
are affected, add 10% for each additional segment beyond
the first 30%.' L2 + L3 + L4 = 30% + 10% + 10% = 50%"
Finding contradictions:
"The commission's own expert opinion in Section 6 states:
'unstable segment L3-L4' - yet this was NOT considered
in the disability calculation!"
The Document Pipeline
Text file → Review → Iterate → Final .docx and .pdf:
appeal-drafts/
├── appeal_v01.txt # First draft
├── appeal_v05.txt # Major revision
├── appeal_v09.txt # With new evidence
├── appeal_v11.txt # Final text
├── appeal_v11.docx # Formatted Word doc
└── appeal_v11.pdf # Print-ready PDF
For the final step, I used Claude Code's docx skill - a built-in capability that converts text documents into properly formatted Word files. One command, and the plain text appeal became a professional document with:
- Correct headers and formal structure
- Proper spacing and margins for official submissions
- Automatic PDF generation
No manual formatting in Word. No copy-paste headaches. The skill handled everything, producing government-ready documents directly from the terminal.
Key Learnings
1. AI is a multiplier, not a replacement
I still needed to:
- Scan and organize documents
- Provide context and direction
- Verify every fact and citation
- Make judgment calls on arguments
Claude Code amplified my efforts - turning hours of work into minutes.
2. Structure matters
The CLAUDE.md file was crucial. Clear project context meant better outputs from the first prompt.
3. Iteration is natural
Don't expect perfection on v1. The v1→v11 journey wasn't failure - it was refinement. Each version incorporated new information, better arguments, and clearer language.
4. Domain knowledge can be learned
Neither Claude Code nor I are lawyers or medical professionals. But by reading the regulations, understanding the criteria, and carefully citing evidence, we built a comprehensive legal argument.
The Unexpected Outcome
Using a programming tool for a legal appeal sounds absurd. But Claude Code's strengths translate perfectly:
| Coding Task | Legal Appeal Task |
|---|---|
| Reading codebase | Reading medical records |
| Understanding APIs | Understanding regulations |
| Debugging errors | Finding contradictions |
| Refactoring code | Refining arguments |
| Writing documentation | Writing formal appeals |
What Happens Next
The appeal is submitted. We wait for the second-level commission's decision.
But regardless of outcome, this experience taught me that AI tools aren't limited to their intended domains. A CLI built for git commit and npm install became the backbone of a deeply human fight for my mother's dignity and care.
Sometimes the best tool for the job is the one you're already comfortable with.
Have you used AI tools for unexpected tasks? I'd love to hear about creative applications in the comments.
Technical note: The OCR script uses Google's Gemini with "thinking mode" for better accuracy on handwritten and faded documents (Claude Code has OCR too, but Gemini performed better on difficult scans). Claude Code handled document analysis, cross-referencing, fetching and parsing official regulations from government websites, iterative drafting, and final document conversion to DOCX/PDF via the built-in docx skill.
Top comments (0)