---
name: log-solution
description: >-
  Save a structured solution doc when a hard problem gets solved.
  Use after debugging a tricky issue or finding a non-obvious workaround.
  Triggers on "log this solution", "save this fix", "document what we found",
  "save for future reference", "write this up".
user_invocable: true
---

# Log Solution — Save a Fix

## Instructions

Ask the user:
1. **Category** — auth / gemini / supabase / expo / vercel / ocr
2. **Short name** — 3-5 word slug e.g. `jwt-not-sent-header`
3. **Symptom** — what did you see?
4. **Root cause** — why did it happen?
5. **Fix** — exact steps or code
6. **Prevention** — what to watch for next time?

Then write to `docs/solutions/{category}/{name}.md`:

```markdown
---
category: {category}
date: {today}
---

# {Title}

## Symptom
{what the user saw}

## Root cause
{why it happened}

## Fix
{exact steps or code}

## Prevention
{what to do differently}
```

After writing: offer to add a one-liner to the relevant `maps/{mobile or backend}/gotchas.md`.
