/clautohotkey:ahk-evalfrom clautohotkey
Evaluates AHK v2 expressions via a live REPL, returning results without creating script files. Useful for testing snippets, checking syntax, or running ad-hoc expressions.
Ships in clautohotkey. 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.
None: SKILL.md is the whole skill.
Evaluate AHK v2 expressions and return results. The fork binary ships a repl subcommand — a persistent read-eval-print session over stdin/stdout. Prefer it over generating harness scripts: no temp file, no #EnableEval boilerplate (the gate is implied), and one process evaluates any number of expressions with state carried between lines.
The user supplies one or more AHK expressions (or, less commonly, a multi-line block). You:
repl /Diag=json — one JSON result line per input line, in order.ok:false, pass the error type and message through verbatim.Start every Bash call below with these two lines. The first sets AHK_EXE (the
interpreter from harness.env, as this shell spells it) and makes wslpath work under
Git Bash; the second gives the run a scratch folder of its own.
source "${CLAUDE_PLUGIN_ROOT}/hooks/_harness-env.sh"
JOB_DIR="${CLAUDE_JOB_DIR:-$(mktemp -d)}"
repl (preferred)One expression per line. Comma compounds work (x := 1, y := 2). Lines evaluate in global scope and state persists between lines, so a sequence like x := 10 then x * 4 works. Errors never end the session — every line gets its result line.
# Single expression — no temp file, no harness
printf '%s\n' 'StrSplit("a,b,c", ",").Length' \
| timeout 5 "$AHK_EXE" repl /Diag=json
# Stateful sequence — heredoc, one result line per input line
timeout 5 "$AHK_EXE" repl /Diag=json <<'EOF'
x := 10
x * 4
EOF
Wire format (/Diag=json — exactly one stdout line per input line, never desynchronizes):
{"kind":"result","ok":true,"type":"Integer","value":"42"}
{"kind":"result","ok":false,"type":"SyntaxError","value":"Missing operand."}
{"kind":"result","ok":true,"type":"Unset","value":""}
Without /Diag=json (text mode): values print to stdout, void/unset prints nothing, objects print as <ClassName object>, errors print one Type: Message line to stderr. Prefer JSON — the 1:1 line mapping is what lets you attribute results when piping several expressions.
EOF (pipe end) or .exit exits 0; ExitApp(n) typed into the session exits n; timeout kill exits 124.
repl <script.ahk> loads the script, runs its auto-execute section, then opens the session against its live state — globals, functions, classes, hotkeys, and timers all reachable:
timeout 10 "$AHK_EXE" repl /ErrorStdOut /Diag=json "$(wslpath -w "$SCRIPT")" <<'EOF'
MyGlobalConfig["mode"]
MyClass.Instance.Count
EOF
/ErrorStdOut matters here: a load-time parse error in the script happens before the REPL takes over error routing.
When the user provides a block the REPL can't take line-by-line (function definitions, loops with bodies, classes), inline it into a temp script:
#Requires AutoHotkey v2.1-alpha.30
<USER_CODE>
Encourage Print(...) calls in the block — there's no implicit result to surface.
TEMP_FILE="$JOB_DIR/ahk_eval_$$.ahk"
WIN_PATH=$(wslpath -w "$TEMP_FILE")
timeout 5 "$AHK_EXE" /Headless /ErrorStdOut "$WIN_PATH" \
1>"$JOB_DIR/ahk_eval_out.txt" \
2>"$JOB_DIR/ahk_eval_err.txt"
exit_code=$?
stdout=$(cat "$JOB_DIR/ahk_eval_out.txt" 2>/dev/null)
stderr=$(cat "$JOB_DIR/ahk_eval_err.txt" 2>/dev/null)
rm -f "$TEMP_FILE" "$JOB_DIR/ahk_eval_out.txt" "$JOB_DIR/ahk_eval_err.txt"
| Input | Result line value |
|---|---|
StrSplit("a,b,c", ",").Length | 3 |
SubStr("hello world", 7) | world |
RegExMatch("abc123", "\d+", &m) ? m[0] : "none" | 123 |
Format("{:04d}", 42) | 0042 |
Round(3.14159, 2) | 3.14 |
[10, 20, 30][2] | 20 |
ok:false lines carry the error class in type and the message in value. Pass both through verbatim, then add a one-line interpretation if the fix is obvious. Because the session survives errors, a batch of lines always yields a full set of results — report all of them, not just the first failure.
<ClassName object>, not contents — chain an accessor or JSON.Stringify-style expression if the user wants contents.value is capped at ~4K characters per line.|| combo (e.g. (() => x? || 42)()) crashes the Eval preparse — fall back to Mode B.; inside a string literal is eaten as a comment, same as in scripts — escape it (`;) or keep it flush against a non-space character.repl must be the first argument; flags and the optional script follow./Diag=json in Mode A so results map 1:1 to input lines." inside the expression; for lines containing ', use a quoted heredoc (<<'EOF') instead.$JOB_DIR (never a fixed name in /tmp) and are cleaned up in every code path.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub truecrimedev/clautohotkey --plugin clautohotkey19 skills in this plugin
/ahk-audit-errorsAudit AHK v2 code for silent failures and inadequate error handling. Hunts for empty catch blocks, swallowed errors, broad bare-catches that hide unrelated failures, and fallbacks that mask problems from the user. TRIGGER when: user says "audit errors", "check error handling", "find silent failures", "review error handling", "scan for swallowed errors", "empty catch blocks", "/ahk-audit-errors".
/ahk-comCOM automation and interop for AHK v2 — driving Excel / Word / WMI / Internet Explorer via IDispatch, COM events, ComValue / SafeArrays, and direct vtable ComCall. Use when automating another application, wiring COM events, or calling a COM interface. TRIGGER when: user says "automate Excel/Word", "COM object", "ComObject", "ComCall", "WMI query", "COM event", "IDispatch", "SafeArray", "ComValue", "VARIANT". Examples: "automate Excel from AHK", "query WMI for processes", "hook IE navigation events"
/ahk-convertConvert AHK v1 code to AHK v2. Applies comprehensive v1-to-v2 conversion rules including command syntax, expression changes, GUI rewrites, and object model updates. TRIGGER when: user says "convert to v2", "v1 to v2", "upgrade script", "migrate from v1", "convert this old script", "make this v2".
/ahk-debug-dashboardShow a compact debug state dashboard during an active debugging session. Queries MCP resources for connection status, breakpoints, variables, and call stack. TRIGGER when: user says "debug dashboard", "show debug state", "debug status", "what's the debugger showing", "debug overview".
/ahk-dllcallNative calls and raw memory for AHK v2 — DllCall to Windows/native APIs, Buffer + NumGet/NumPut for structs, StrPut/StrGet, CallbackCreate, and the alpha.30 typed Struct. Use when calling a DLL/WinAPI function, building or reading a struct, or passing a callback to native code. TRIGGER when: user says "DllCall", "call a Windows API", "Buffer", "NumPut/NumGet", "struct", "pointer", "CallbackCreate", "StrGet/StrPut", "marshal", "user32/kernel32". Examples: "call GetCursorPos", "build a RECT struct", "pass a callback to EnumWindows"
/ahk-docsSearch AHK v2 documentation for a function, method, directive, or concept. Returns relevant documentation excerpts with syntax and examples. TRIGGER when: user says "docs for", "how does X work in AHK", "AHK docs", "look up", "what is the syntax for", "documentation".
Other plugins' skills for the same job