Execute programming tasks via Claude Code using PTY-based invocation. Handles non-TTY environments, auto-responds to prompts, and manages file synchronization.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install claude-code-runner或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install claude-code-runner⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/claude-code-runner/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- 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." ---
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.
# 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
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)
python3 scripts/run_claude.py /path/to/project "Your task description here"
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 projectprompt (str): Natural language task descriptionuser (str): User to run as (default: 'lighthouse')timeout (int): Timeout in seconds (default: 300)Returns:
str: Combined stdout and stderr outputBehavior:
result = run_claude_code(
workdir='/root/repo/project',
prompt='Review this codebase and identify potential bugs or improvements'
)
result = run_claude_code(
workdir='/root/repo/legacy-app',
prompt='Refactor the database layer to use SQLAlchemy ORM instead of raw SQL'
)
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
'''
)
result = run_claude_code(
workdir='/root/repo/web-app',
prompt='Fix the memory leak in the WebSocket connection handler'
)
CLAUDE_CODE_USER: Default user to run as (default: 'lighthouse')CLAUDE_CODE_TIMEOUT: Default timeout in seconds (default: 300)Edit scripts/run_claude.py to customize:
Ensure the script is run with sufficient privileges to:
Make sure Claude Code is installed and in the system PATH:
which claude
Increase the timeout for long-running tasks:
run_claude_code(workdir, prompt, timeout=600) # 10 minutes
Add new prompt patterns to the auto-respond logic:
if b'new prompt text' in output:
os.write(master_fd, b'y\n')
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.
安装 Claude Code Runner 后,可以对 AI 说这些话来触发它
Help me get started with Claude Code Runner
Explains what Claude Code Runner does, walks through the setup, and runs a quick demo based on your current project
Use Claude Code Runner to execute programming tasks via Claude Code using PTY-based invocation
Invokes Claude Code Runner with the right parameters and returns the result directly in the conversation
What can I do with Claude Code Runner in my developer & devops workflow?
Lists the top use cases for Claude Code Runner, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/claude-code-runner/ 目录(个人级,所有项目可用),或 .claude/skills/claude-code-runner/(项目级)。重启 AI 客户端后,用 /claude-code-runner 主动调用,或让 AI 根据上下文自动发现并使用。
Claude Code Runner 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Claude Code Runner 可免费安装使用。请查阅仓库了解许可证信息。
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 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Claude Code Runner
Identifies repetitive steps in your workflow and sets up Claude Code Runner to handle them automatically