| name | redesign |
| description | Interactive workflow for redesigning library code. Research existing patterns, brainstorm approaches, sketch rewrites of application files, create branches for each option, compare changes, and merge the winner. |
Redesign Workflow
A structured workflow for exploring design alternatives for library code, centered around how changes affect application/consumer code.
Overview
6 phases, alternating between agent work and user decisions:
- Research — Understand the existing code
- Brainstorm — Propose design approaches
- Sketch — Write application-file rewrites for each approach
- Branch & Implement — Create git branches and implement each option
- Compare — User reviews changes across branches
- Merge — User picks a winner
Phase 1: Research
When the user identifies code to redesign:
- Read all relevant source files in the target area
- Identify the public API surface and internal structure
- Find all consumers/application files that use the target code
- Summarize your findings and ask the user to confirm:
- Your understanding of the current design
- Which application file(s) will serve as the "test case" for the redesign
Present clearly:
- Current API surface (classes, functions, protocols)
- Key abstractions and their responsibilities
- Consumer/application files that depend on this code
- Pain points or code smells you notice
Phase 2: Brainstorm
Propose 3–5 distinct design approaches. For each:
- Name — short, descriptive, lowercase-with-hyphens (becomes a branch name)
- Core idea — 2–3 sentences
- Key API changes — what's different from current
- Trade-offs — what gets better, what gets worse
- Difficulty — low / medium / high
Present as a numbered list. Ask the user:
- Which approaches to explore further
- Whether they have their own ideas to add
Phase 3: Sketch
For each selected approach, write a sketch of how the target application file would look after the redesign.
Rules:
- Show the full application file as it would look post-redesign
- Use real function/class names from the proposed API
- Add comments marking where the API differs from current
- Do NOT implement the library side yet — this is a vision of the consumer experience
- Keep sketches concise — focus on the API surface, not boilerplate
Present all sketches. Ask: "Which of these do you want me to implement? I'll create a branch for each."
Phase 4: Branch & Implement
First, note the current branch — this is the base for all redesign branches.
For each selected approach:
git checkout <base-branch>
git checkout -b redesign/<approach-name>
git add -A
git commit -m "redesign: <approach-name> — <one-line description>"
After implementing ALL branches, return to the base branch and call the redesign_compare tool:
Use the redesign_compare tool with base_branch set to the base branch name.
This opens an interactive viewer for the user.
Phase 5: Compare
The user reviews changes using the interactive viewer (opened by redesign_compare tool or /redesign-compare command). They can:
- Browse the list of redesign branches with file-change stats
- View the full diff for any branch
- Cycle between branches
Wait for the user to tell you which approach they prefer, or if they want modifications.
Phase 6: Merge
When the user picks a winner, tell them to run:
/redesign-merge
This command handles:
- Selecting the winning branch
- Merging it into the base branch
- Optionally deleting the other redesign branches
Tips
- Keep scope focused — redesign one thing at a time
- The application file is the north star — if it doesn't look better, the redesign isn't worth it
- Don't gold-plate during branching — get the API right first, polish later
- Commit frequently so diffs are clean
- Minimize the diff — only change the core library file(s) being redesigned. Consumer/application files get sketched in comments or left as TODOs, not rewritten in full. The user will adapt those themselves.
- Don't update every consumer — touching stability_predictor, init.py exports, example files, etc. in the same branch bloats the diff and mixes design signal with mechanical updates. Focus the branch on the new abstraction.