Who this is for
Developers about to refactor who want a controlled plan, not a half-migrated mess they lose track of partway through.
The moment this saves you
I start a refactor with a clear picture in my head, get three files deep, lose the thread, and end up with a half-migrated mess that's worse than what I started with and risky to ship.
See it work
Messy spoken thought in. A clean, structured artifact out.
Planning a refactor. The problem is our API routes are all giant functions with the validation, business logic, and database stuff all mixed together, it's untestable and every change is scary. The target is to split each into three layers, a thin route handler, a service layer for logic, and a repository for data access. The safe way to do this, I'll start with the most isolated route, the one with no shared dependencies, prove the pattern there, write tests, then migrate the rest one route at a time, never more than one in flight. The risk is touching the shared user service, that's used everywhere, save that for last and do it carefully. I do not want a big-bang rewrite, incremental only.
Refactor plan, June 5, 2026
- Problem: API routes are giant functions mixing validation, business logic, and data access. Untestable; every change is risky.
- Target state: Split each into three layers, thin route handler, service layer (logic), repository (data access).
- Safe step order:
1. Start with the most isolated route (no shared deps), prove the pattern, write tests 2. Migrate the rest one route at a time, never more than one in flight 3. Save the shared user service (used everywhere) for last, do it carefully
- Constraint: Incremental only, NO big-bang rewrite
The workflow
Record a voice note
Hit the hotkey and talk, no formatting, no typing.
Tag it with this context
Contextli shapes your words into the structured output above.
Find it later
Everything's searchable and organised by context.
Pull it into Claude or ChatGPT
Bring your contexts straight into your AI tools with the Contextli MCP.
Your raw recording and transcription stay on your device, so you can always go back to the original.
The prompt behind this context
I'm going to talk through a refactor I'm planning. Turn it into a refactor plan: a bold "Refactor plan, [today's date]" heading, then labeled parts: **Problem** (what's wrong with the current code), **Target state** (the desired structure), **Safe step order** (a NUMBERED list of the migration steps in the order I describe, preserving which to do first and last and why), and **Constraint** (any rule I set, e.g. incremental only). Keep my technical reasoning and ordering exactly. Don't invent steps or risks I didn't raise. Output only the plan.
Make it your own. This is a starting point. Once it's in Contextli, tweak the instructions so the output comes out exactly how you like it.
Use this context
One tap adds it to your clipboard. Open Contextli and paste to add it.
Next, open Contextli, Contexts, Import, paste.
Make it your own. This is a starting point. Once it's in Contextli, tweak the instructions so the output comes out exactly how you like it.
Your raw recording and transcription stay on your device, so you can always go back to the original.
Related contexts
Technical Spec Note
You've figured out the approach in your head and writing the spec feels like a tax. Talk it through, the problem, the approach, the tradeoffs, the open questions. You get a structured skeleton you can flesh out, instead of staring at a blank design doc.
Code Decision Log
Right after you make the call, while the tradeoffs are still fresh, talk through why you went this way and what you rejected. Three months from now when someone asks 'why a queue here?', the answer is already written down.
Learning Log
You finally figure out that tricky thing, a flag, a pattern, a gotcha, and three weeks later you're googling the exact same thing. Say what you learned and the context. You build a searchable log of your own hard-won lessons, so you only have to learn each one once.