/bawa:improve-architecturefrom bawa
Surveys a C# and WinUI codebase for architectural hot spots, proposes modular refactoring, and executes changes one step per commit with behavior preserved.
Ships in bawa. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Features pile up, and an app that was easy to change gets hard to change. A check-in catches that early: survey, propose, let the user pick, then refactor in small steps that keep behavior the same. The target shape for apps that grow is in architecture.md.
Any one signal is enough:
improve-loop skill calls this skill there)..xaml.cs) over 300 lines.PropertyChanged
on a model that many bindings watch.Use these words exactly, so proposals stay comparable:
Change no code in this step.
Read CLAUDE.md, ARCHITECTURE.md, docs/adr/, and docs/FIXLOG.md
where they exist.
Find hot spots:
git log --since=30.days --name-only --format= | Where-Object { $_ } | Group-Object | Sort-Object Count -Descending | Select-Object -First 20 Count, Name
Get-ChildItem src -Recurse -Include *.cs, *.xaml | Where-Object FullName -notmatch '\\(obj|bin)\\' | ForEach-Object { [pscustomobject]@{ Lines = (Get-Content $_.FullName).Count; File = $_.FullName } } | Sort-Object Lines | Select-Object -Last 20
Map the structure: projects and their references (dotnet list src/<App>/<App>.csproj reference), interfaces and their
implementations, classes that touch the UI thread and also do I/O, and
what runs on which thread.
Look for C# and WinUI friction:
Code-behind that grows: event handlers in .xaml.cs that hold rules,
call the store, or build strings. A page's code-behind wires events
and moves focus; the rules live in a model or in Core.
A view model that owns everything (a god model). The template's
AppModel is fine for a few pages; past that, each page gets its own
model and AppModel keeps only what pages share.
{Binding} where {x:Bind} works. x:Bind is compiled and checked
at build time; Binding uses reflection and fails silently at run
time.
Wrappers that only forward calls.
App code that reaches into a library's internals
(InternalsVisibleTo for anything but the test project).
Test hooks outside the agent modes. --selftest, APP_SNAPSHOT, and
APP_SEED are the agreed launch flags; anything else test-only goes
in the test project.
Fast-changing state on a model that every page binds to.
Slow work on the UI thread (SQLite queries over large tables, file
I/O, image decoding), or .Result and .Wait() on a task, which can
deadlock it.
Interfaces with one implementation and no test adapter.
Drifted copies: the same private type defined in two files:
Get-ChildItem src -Recurse -Filter *.cs | Select-String -Pattern 'private (sealed )?(partial )?(class|record|struct) (\w+)' |
ForEach-Object { $_.Matches[0].Groups[4].Value } | Group-Object | Where-Object Count -gt 1 | Select-Object Name, Count
A settings or detail page that lives far from its feature. Pages live in the feature's folder.
Pure logic inside the WinUI project, which dotnet test cannot reach.
Move it into <App>.Core as a plain type that takes plain values. The
template's ItemTitle is the pattern.
Core that references WinUI. <App>.Core targets net10.0 with no
Microsoft.UI namespace: Select-String -Path src\<App>.Core\*.cs -Pattern 'Microsoft\.UI' finds nothing.
Deletion test for each candidate: if you deleted this module, would its complexity concentrate in one place (keep it) or spread to every caller (it earns its place)? Pass-throughs fail the test.
Write docs/architecture-review-<YYYY-MM-DD>.md, one card per candidate:
## <Title in domain nouns> [Strong | Worth exploring | Speculative]
Files: src/App/Pages/EditorPage.xaml.cs (1,750 lines), ...
Signal: <which trigger above>
Problem: <what is hard to change today, with one example>
Proposal: <the new module and its interface, 15 lines of C# at most>
Benefits: <locality and leverage; which tests get simpler>
Proof of same behavior: <unit tests, self-test, snapshots, golden files, perf baseline>
Plan: <one commit per step>
End with a top recommendation and a short "considered, not
recommended" list. Saying "the code is fine" is a valid result: then
every card is Speculative or there are none.
Stop and ask the user which candidate to do. In an unattended loop, do the
top recommendation only if it is Strong. Leave the rest in the file.
dotnet test tests/<App>.Core.Tests passes, with new tests at the
interface you are about to change.tools/selftest.ps1 exits 0.tools/snap.ps1, then copy %TEMP%\<App>-shots to
%TEMP%\<App>-shots-before. After the refactor, snap again and
compare each PNG pair (Get-FileHash; look at any pair whose hashes
differ)../build.ps1 -Dev) after every step.ARCHITECTURE.md: projects, layers, dependency direction, seams.docs/adr/ only when the decision is hard to reverse,
surprising without context, and a real trade-off.docs/FIXLOG.md entry for any bug the refactor found. Every entry
ends with a Rule: line.Done when the review file exists, the chosen refactor is committed in
steps, dotnet test, tools/selftest.ps1, and the snapshots give the same
results before and after, and ARCHITECTURE.md matches the code.
What SKILL.md sets; muted values are Claude Code's defaults
22 skills in this plugin
/agent-cliOptional command line and MCP server for a Windows app, so Claude Code, Codex, and scripts can drive it (list, add, change, search, act) through the running app. Use when the user wants agents to work with their app or its data, asks for a CLI, an MCP server, or automation for the app, or says "Claude should be able to use my app"./app-briefOne-page brief (docs/BRIEF.md) for a new Windows app, written before any code. Use when the user has an app idea, wants to replace an app they pay for, or the research and clone skills are done./app-iconWindows app icon drawn as an SVG (Icon/AppIcon.svg), rendered by tools/make-icon.ps1 into a multi-size AppIcon.ico and AppIcon.png, and reviewed on light and dark taskbar and Start backgrounds, with hand-tuned small sizes. Use when the user wants an app icon, a better icon, or a taskbar or Start icon.npx claudepluginhub daveebbelaar/bawa --plugin bawaOther plugins' skills for the same job