# Send Claude Code Runner to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "claude-code-runner",
    "name": "Claude Code Runner",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/lhl09120/claude-code-runner",
    "canonicalUrl": "https://clawhub.ai/lhl09120/claude-code-runner",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/claude-code-runner",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-runner",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "clawhub.json",
      "scripts/run_claude.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "claude-code-runner",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T11:28:07.751Z",
      "expiresAt": "2026-05-08T11:28:07.751Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-runner",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-runner",
        "contentDisposition": "attachment; filename=\"claude-code-runner-0.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "claude-code-runner"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/claude-code-runner"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/claude-code-runner",
    "downloadUrl": "https://openagent3.xyz/downloads/claude-code-runner",
    "agentUrl": "https://openagent3.xyz/skills/claude-code-runner/agent",
    "manifestUrl": "https://openagent3.xyz/skills/claude-code-runner/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/claude-code-runner/agent.md"
  }
}
```
## Documentation

### Overview

A wrapper skill for running Claude Code programmatically in non-interactive environments. Uses PTY (pseudo-terminal) to handle TTY-required operations and automatically responds to confirmation prompts.

### Features

PTY-based execution: Works in non-TTY environments (containers, CI/CD, background processes)
Auto-respond to prompts: Automatically answers "Do you want to..." confirmations
User switching: Runs as specified non-root user
File synchronization: Copies project to temp directory, executes, syncs changes back
Timeout handling: Configurable timeout with proper cleanup
Output capture: Captures and returns full stdout/stderr

### Installation

# Clone the skill
git clone https://github.com/lhl09120/claude-code-runner-en.git

# Make script executable
chmod +x claude-code-runner-en/scripts/run_claude.py

### Basic Usage

from claude_code_runner import run_claude_code

result = run_claude_code(
    workdir='/path/to/project',
    prompt='Refactor the authentication module to use JWT tokens',
    user='lighthouse',
    timeout=300
)

print(result)

### Via Command Line

python3 scripts/run_claude.py /path/to/project "Your task description here"

### Advanced Options

result = run_claude_code(
    workdir='/root/repo/my-project',
    prompt='''
    1. Review the codebase
    2. Identify security vulnerabilities
    3. Fix any issues found
    4. Add appropriate tests
    ''',
    user='developer',
    timeout=600  # 10 minutes
)

### run_claude_code(workdir, prompt, user='lighthouse', timeout=300)

Execute a Claude Code task in a PTY environment.

Parameters:

workdir (str): Working directory containing the project
prompt (str): Natural language task description
user (str): User to run as (default: 'lighthouse')
timeout (int): Timeout in seconds (default: 300)

Returns:

str: Combined stdout and stderr output

Behavior:

Copies project to temporary directory
Changes ownership to specified user
Executes Claude Code via PTY
Auto-responds to confirmation prompts
Syncs changes back to original directory
Cleans up temporary files

### 1. Automated Code Review

result = run_claude_code(
    workdir='/root/repo/project',
    prompt='Review this codebase and identify potential bugs or improvements'
)

### 2. Refactoring Tasks

result = run_claude_code(
    workdir='/root/repo/legacy-app',
    prompt='Refactor the database layer to use SQLAlchemy ORM instead of raw SQL'
)

### 3. Adding Features

result = run_claude_code(
    workdir='/root/repo/api-service',
    prompt='''
    Add a new REST endpoint for user profile management:
    - GET /api/users/{id}/profile
    - PUT /api/users/{id}/profile
    - Include validation and error handling
    - Add unit tests
    '''
)

### 4. Bug Fixes

result = run_claude_code(
    workdir='/root/repo/web-app',
    prompt='Fix the memory leak in the WebSocket connection handler'
)

### Requirements

Python 3.8+
Claude Code installed and in PATH
Unix-like environment (Linux/macOS)
Root or sudo access (for user switching)

### Environment Variables

CLAUDE_CODE_USER: Default user to run as (default: 'lighthouse')
CLAUDE_CODE_TIMEOUT: Default timeout in seconds (default: 300)

### Customization

Edit scripts/run_claude.py to customize:

Auto-response keywords
Temp directory location
Sync behavior
Output formatting

### "Permission denied" errors

Ensure the script is run with sufficient privileges to:

Create temporary directories
Change file ownership
Switch to target user

### Claude Code not found

Make sure Claude Code is installed and in the system PATH:

which claude

### Task timeout

Increase the timeout for long-running tasks:

run_claude_code(workdir, prompt, timeout=600)  # 10 minutes

### Interactive prompts not auto-responded

Add new prompt patterns to the auto-respond logic:

if b'new prompt text' in output:
    os.write(master_fd, b'y\\n')

### Limitations

Requires Unix-like environment (uses PTY)
Requires root/sudo for user switching
Claude Code must be installed separately
May not handle all edge cases of interactive prompts

### License

MIT License

Copyright (c) 2026 lhl09120

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

See LICENSE file for full details.

### v1.0.0 (2026-02-27)

Initial release
PTY-based Claude Code execution
Auto-response to confirmation prompts
File synchronization
User switching support
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: lhl09120
- Version: 0.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-01T11:28:07.751Z
- Expires at: 2026-05-08T11:28:07.751Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/claude-code-runner)
- [Send to Agent page](https://openagent3.xyz/skills/claude-code-runner/agent)
- [JSON manifest](https://openagent3.xyz/skills/claude-code-runner/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/claude-code-runner/agent.md)
- [Download page](https://openagent3.xyz/downloads/claude-code-runner)