.claude/skills/review-mcode/SKILL.md
Scan for hot loops over raw buffers that would benefit from MCode (native C) optimization
npx skillsauth add cwilliams5/Alt-Tabby review-mcodeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enter planning mode. Scan the codebase for MCode optimization opportunities. Use parallelism where possible.
MCode replaces AHK-interpreted tight loops with native C machine code embedded as base64. The project already has an MCode pipeline (tools/native_benchmark/native_src/) and a working example (src/gui/icon_alpha.ahk). Adding a new function to an existing MCode module is low cost — the infrastructure exists.
All four must be true:
query_function_visibility.ps1 to check call frequency — a loop called 1x/session vs 100x/sec changes the MCode ROI. Use query_callchain.ps1 <funcName> -Reverse to trace all invocation contexts. Use query_timers.ps1 to check if the candidate is inside a timer callback (hot path signal).Buffer / NumGet / NumPut, not AHK objectsStrPut, InStr, SubStr, Sort, RegExMatch etc.NumGet / NumPut inside loops (pixel processing, binary protocol parsing, buffer scanning)src/gui/icon_alpha.ahk — template for MCode embedding (base64 → CryptStringToBinary → VirtualProtect)tools/native_benchmark/native_src/icon_alpha.c — reference C source (no CRT, no imports, pure computation)tools/native_benchmark/ — benchmark harness and native build pipelineFocus on files with buffer/binary operations:
src/gui/gui_paint.ahk — rendering, pixel manipulationsrc/core/ — icon extraction, process info, any binary data handlingsrc/shared/ipc_pipe.ahk — binary pipe protocol parsingsrc/pump/ — icon resolution, bitmap processingNumGet or NumPut usageFor each candidate:
| File | Function | Loop Description | Est. Worst Case | Qualifies? | Why |
|------|----------|-----------------|----------------|-----------|-----|
| foo.ahk:42 | ScanBuffer() | NumGet loop over 256KB icon bitmap, ~65k iterations | ~65ms | Yes | Pure buffer, no AHK objects, scales with icon count |
| bar.ahk:100 | ParseWindows() | Loop over window array calling WinGetTitle | ~2ms | No | Bottleneck is Win32 calls, not AHK loop |
For qualifying candidates, additionally note:
icon_alpha) or needs a new oneIgnore any existing plans — create a fresh one.
tools
Create a new git worktree and switch the session into it
tools
Spawn agent to trace code flow via query tools — answer only, no context cost
tools
Commit, push, and create a PR for the current branch
tools
Retire a shader by moving its files to legacy/shaders_retired