pexpect-cli/skill/SKILL.md
Persistent pexpect sessions. Use when automating interactive terminal programs (ssh, databases, debuggers, REPLs).
npx skillsauth add mic92/mics-skills pexpect-cliInstall 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.
Each session is a long-lived Python namespace: all variables, imports, and functions persist across calls.
Exceptions return exit 1 but the session stays alive. Expression results are not echoed; use print().
pexpect-cli --start [--name label] # → prints session id
pexpect-cli --list
pexpect-cli --stop <id> # also kills spawned children
session=$(pexpect-cli --start --name ssh)
pexpect-cli $session <<'EOF'
child = pexpect.spawn('ssh user@host', encoding='utf-8') # encoding → .before is str not bytes
child.expect('password:', timeout=30)
child.sendline('secret')
child.expect(r'\$')
EOF
# child still alive next call
pexpect-cli $session <<'EOF'
child.sendline('uptime')
child.expect(r'\$')
print(child.before)
EOF
Only stdout is returned. stderr and full history go to pueue log (find task id via pueue status --group pexpect).
Always set timeout= on expect(). Catch pexpect.TIMEOUT / pexpect.EOF for robustness.
tools
Get weather forecasts. Use for current weather/multi-day forecasts worldwide.
tools
Deploy and trigger Tasker tasks on Android via the Tasker WebUI and adb. Use for building Tasker automations from JSON.
tools
Take screenshots non-interactively. Use to see the screen, debug UI, or capture a specific region by coordinates.
tools
Manage n8n via its REST API. Use when user asks to access n8n.