holenlin

Claude Code Runner

開発v0.1.0
作者:holenlin更新日 2026-05-18全 2 バージョン · 最新版の公開日 2026-02-27claude-code-runner@clawhub_lhl09120/claude-code-runner
コード生成スクリプトツール

AlphaMoatによると、2026-09時点でClaude Code Runnerのダウンロード数は3,862、スター数は2で、AIスキル全体5,078件中2,701位、開発では577件中351位です。

インストール数
101
ダウンロード数
3862
スター数
2
総合順位
#2,701
全体の上位 54% · 開発の上位 61%
プラットフォームインストール数ダウンロード数スター数コメント
ClawHub ↗10135131-
SkillHub ↗10038622—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

実行ユーザーの切り替え、プロジェクトの一時ディレクトリへのコピー、タスク実行後の変更同期、標準出力・エラーの取得ができます。確認プロンプトには自動応答します。Unix系環境とClaude Codeが必要で、ユーザー切り替えにはrootまたはsudo権限が必要です。自動応答や変更の同期は実際の影響を伴うため、実行前にタスクの権限、一時コピー、同期範囲を確認してください。

資料公開日 2026-10-29

できること

  • 非対話環境でPTY経由の実行フローを計画する。
  • 実行ユーザー、タイムアウト、プロジェクト同期の設定を確認する。
  • 確認プロンプトへの自動応答がもたらす影響を点検する。

使う場面

  • 非対話環境でClaude Code呼び出しをラップするとき。
  • 一時ディレクトリ、ユーザー切り替え、タイムアウト、出力取得の挙動を確認するとき。
  • 自動確認、root/sudo権限、プロジェクトへの変更同期を行う前に、タスクと書き戻し範囲を確認するとき。

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

Runnerの実行手順と、自動確認・ファイル同期の動作を要約してください。
PTYラッパーを使う前の権限、一時ファイル、書き戻し範囲のチェックリストを作成してください。

月次の推移

ダウンロード数3862
860247240842026-03 · ダウンロード数 10822026-05 · ダウンロード数 24962026-06 · ダウンロード数 27252026-07 · ダウンロード数 33362026-08 · ダウンロード数 35172026-09 · ダウンロード数 386226-0326-09
スター数2
1222026-03 · スター数 12026-05 · スター数 12026-06 · スター数 12026-07 · スター数 22026-08 · スター数 22026-09 · スター数 226-0326-09

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。 同名の別スキルがあるため、変更前のデータは現在ダウンロード数が最も多いこのスキルに帰属させています。

月ダウンロード数前月比スター数
2026-093862—2
2026-083517+5.4%2
2026-073336+22.4%2
2026-062725+9.2%1
2026-052496—1
2026-031082—1

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 2026-10-23。

5.3 KB・ClawHub v0.1.0
---
name: claude-code-runner
description: "Execute programming tasks via Claude Code using PTY-based invocation. Handles non-TTY environments, auto-responds to prompts, and manages file synchronization."
---

# Claude Code Runner

## 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.
すべて表示(全 223 行)

## 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

```bash
# 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
```

## Usage

### Basic Usage

```python
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

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

### Advanced Options

```python
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
)
```

## API Reference

### `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:**
1. Copies project to temporary directory
2. Changes ownership to specified user
3. Executes Claude Code via PTY
4. Auto-responds to confirmation prompts
5. Syncs changes back to original directory
6. Cleans up temporary files

## Use Cases

### 1. Automated Code Review

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

### 2. Refactoring Tasks

```python
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

```python
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

```python
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)

## Configuration

### 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

## Troubleshooting

### "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:
```bash
which claude
```

### Task timeout

Increase the timeout for long-running tasks:
```python
run_claude_code(workdir, prompt, timeout=600)  # 10 minutes
```

### Interactive prompts not auto-responded

Add new prompt patterns to the auto-respond logic:
```python
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.

## Changelog

### v1.0.0 (2026-02-27)
- Initial release
- PTY-based Claude Code execution
- Auto-response to confirmation prompts
- File synchronization
- User switching support

開発の人気スキル

データ月:2026-09 · ダウンロード数、スター数、インストール数は公開スキルレジストリ(ClawHub、SkillHub)から月単位で集計しています。詳しくはデータの方法論をご覧ください。