Agent skill
pexpect-cli
Persistent pexpect sessions for automating interactive terminal applications. Use when you need to control interactive programs like ssh, databases, or debuggers that require user input.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/pexpect-cli
SKILL.md
Usage
# Start a new session
pexpect-cli --start
# 888d9bf4
# Start with a label
pexpect-cli --start --name ssh-prod
# a3f4b2c1
# Execute code in a session
pexpect-cli 888d9bf4 <<'EOF'
child = pexpect.spawn("bash")
child.sendline("pwd")
child.expect(r"\$")
print(child.before.decode())
EOF
# List sessions
pexpect-cli --list
# Stop a session
pexpect-cli --stop 888d9bf4
Examples
SSH Session
session=$(pexpect-cli --start --name ssh-session)
pexpect-cli $session <<'EOF'
child = pexpect.spawn('ssh [email protected]')
child.expect('password:')
child.sendline('mypassword')
child.expect('\$')
print("Connected!")
EOF
# Run commands
pexpect-cli $session <<'EOF'
child.sendline('uptime')
child.expect('\$')
print(child.before.decode())
EOF
Database Interaction
session=$(pexpect-cli --start --name db-session)
pexpect-cli $session <<'EOF'
child = pexpect.spawn('sqlite3 mydb.db')
child.expect('sqlite>')
child.sendline('.tables')
child.expect('sqlite>')
print("Tables:", child.before.decode())
EOF
Available in Namespace
pexpect: The pexpect modulechild: Persistent child process variable (persists across executions)
See README.md for installation, monitoring, and advanced usage.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?