Skip to content
Agentmart
Submit a tool

remote-debug

Drive Claude Code to debug an issue on a remote node over SSH — connect, set up an environment, copy scripts/probes across, run repros, and capture findings.

Skill by yiliu30

IndexedMIT★ 2
Write a review

Chalk Labs

Need help deploying remote-debug?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/yiliu30-remote-debug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Drive Claude Code to debug an issue on a remote node over SSH — connect, set up an environment, copy scripts/probes across, run repros, and capture findings. Use when the user says we're 'on a remote node', hands you ssh credentials, or asks to reproduce / debug / set up on a remote host. Covers pexpect-based ssh/scp when sshpass is unavailable, minimal standalone repros, and isolating a root cause by comparing machines.

Use cases: writing, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/remote-debug

What's inside

Skill name
remote-debug
Description
Drive Claude Code to debug an issue on a remote node over SSH — connect, set up an environment, copy scripts/probes across, run repros, and capture findings. Use when the user says we're 'on a remote node', hands you ssh credentials, or asks to reproduce / debug / set up on a remote host. Covers pexpect-based ssh/scp when sshpass is unavailable, minimal standalone repros, and isolating a root cause by comparing machines.
License
MIT
Instructions
109 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Remote Debugging with Claude Code

A general workflow for using Claude Code to debug an issue on a **remote node** over
SSH: connect, provision an environment, copy minimal scripts/probes across, run
reproductions, and (when relevant) compare a working node against a failing one to
isolate the variable.

## When to use

- The prompt starts with `ssh ...`, or the user says "we are on a remote node".
- The user hands you a host + credentials and asks to reproduce / debug / set up there.
- A bug only reproduces in a remote environment you can't run locally (specific
  hardware, OS, driver, network, or data).
- You need to A/B two machines to find which layer is the deciding variable.

## Golden rules

1. **Assume the remote is SHARED.** Treat installs, upgrades, service restarts,
   reboots, and `rm -rf` as destructive — get explicit user go-ahead before any of
   them. Read-only inspection (listing packages, reading files, running a probe) is
   fine to do directly.
2. **Back up before patching anything in place.** `cp x x.bak` first, tell the user
   the backup path, and offer to revert at the end.
3. **Change one variable at a time.** When comparing a PASS vs FAIL node, keep
   everything identical except the one thing under test (same binary, same inputs).
4. **Prefer a minimal standalone repro over the full app.** A small script that
   exercises only the suspect behavior removes the rest of the app from the equation
   and makes the result attributable to one thing.
5. **Record findings as you go**, in a file, not just in chat — long sessions get
   compacted and chat context is lost. A short `*_finding.md` with the evidence table
   survives.

## Step 1 — Establish the connection

First check whether non-interactive SSH already works (key-based):

```bash
ssh -o BatchMode=yes -o ConnectTimeout=5 USER@HOST 'echo ok' 2>&1
```

If it needs a password and `sshpass` is **not** installed (common), don't try to pipe
the password. Use a small `pexpect` helper instead. Use `python3` (bare `python` is
often absent).

`/tmp/ssh_run.py`:

```python
#!/usr/bin/env python3
import sys, pexpect
host, password, cmd = sys.argv[1], sys.argv[2], sys.argv[3]
child = pexpect.spawn(f"ssh -o StrictHostKeyChecking=no {host} {cmd!r}",
                      encoding="utf-8", timeout=600)
i = child.expect([r"[Pp]assword:", pexpect.EOF])
if i == 0:
    child.sendline(password); child.expect(pexpect.EOF)
print(child.before)
```

Run: `python3 /tmp/ssh_run.py USER@HOST 'secret' 'whoami'`

A matching `/tmp/scp_run.py` (swap the spawn line for `scp LOCAL host:REMOTE`) copies
files across. If `pexpect` is missing: `python3 -m pip install --user pexpect`.

Once connected, prefer setting up an SSH key (`ssh-copy-id`) so later commands are
non-interactive — ask the user before modifying `authorized_keys` on a shared box.

### Quoting trap (learned the hard way)

Nested SSH + inline scripts break on quote/backslash escaping (e.g. a `\t` inside a
Python one-liner becomes a literal tab over the wire → `SyntaxError`). **Don't** send
multi-line scripts through `ssh '...'`. Instead: write the script to a local file,
`scp` it over, then `ssh host 'python3 /remote/path/script.py'`.

## Step 2 — Survey the remote environment (read-only)

Before changing anything, capture the state relevant to the bug. Tailor to the issue,
but typically: OS/kernel (`uname -a`, `/etc/os-release`), installed package versions
of the suspect components, library/binary versions actually loaded (`ldd`,
`readlink -f`), env vars, and how the framework/app reports the resource. Write the
output into the finding doc. When comparing two nodes, lay it out as a table so the
**single differing column** is obvious.

## Step 3 — Set up an environment (if needed)

Follow the user's global conventions (e.g. `uv` for Python envs, a short name, a
standard venvs dir). If the network is flaky, apply the project's proxy settings. When
A/B-ing nodes, mirror the same toolchain versions as the known-good node so the
environment itself isn't an accidental confound.


## Step 4 — Patch / verify a fix (carefully)

- Testing a code patch on the remote? **Back up first** (`cp f f.bak`), make the
  change reversible (env-driven and default-off when possible), and tell the user
  exactly what changed and how to revert.
- If the fix is an install/upgrade/restart on a shared node, **stop and ask** —
  describe the exact action and that it touches shared state. Don't run it unprompted.
- Re-run the repro to confirm. A fix that removes error A but exposes error B is not
  done — report the new blocker rather than calling it fixed.


## Cleanup checklist

- Revert in-place patches you weren't told to keep (restore the `.bak`).
- Remove throwaway probes/scripts from `/tmp` if asked; leave reusable checkers in the repo.
- Summarize for the user: root cause, fix applied, and anything still pending a
  decision (especially actions on shared state that need their go-ahead).

From yiliu30/z2h, MIT.

More from yiliu30/z2h

Signals

Stars
2
Forks
0
Open issues
1
Last commit (this folder)
Jun 3, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from yiliu30

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get remote-debug running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying remote-debug?

CallGet help
Cite this page

remote-debug skill. Agent Mart. https://agentmart.dev/skills/yiliu30-remote-debug (last updated 2026-10-24)