Skip to content
Back to search

claude-code-clawdbot

"Run Claude Code (Anthropic) from this host via the `claude` CLI (Agent SDK) in headless mode (`-p`) for codebase analysis, refactors, test fixing, and structured output. Use when the user asks to use Claude Code, run `claude -p`, use Plan Mode, auto-approve tools with --allowedTools, generate JSON output, or integrate Claude Code into Clawdbot workflows/cron."

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/win4r/claude-code-clawdbot-skill with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/win4r/claude-code-clawdbot-skill'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/win4r--claude-code-clawdbot-skill/badge.svg)](/listings/win4r--claude-code-clawdbot-skill)

HTML

<a href="/listings/win4r--claude-code-clawdbot-skill"><img src="/api/listings/win4r--claude-code-clawdbot-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 297 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. ---
  2. name: claude-code-clawdbot
  3. description: "Run Claude Code (Anthropic) from this host via the `claude` CLI (Agent SDK) in headless mode (`-p`) for codebase analysis, refactors, test fixing, and structured output. Use when the user asks to use Claude Code, run `claude -p`, use Plan Mode, auto-approve tools with --allowedTools, generate JSON output, or integrate Claude Code into Clawdbot workflows/cron."
  4. ---
  5. # Claude Code (Clawdbot)
  6. Use the locally installed **Claude Code** CLI reliably.
  7. This skill supports two execution styles:
  8. - **Headless mode** (non-interactive): best for normal prompts and structured output.
  9. - **Interactive mode (tmux)**: required for **slash commands** like `/speckit.*` (Spec Kit), which can hang or be killed when run via headless `-p`.
  10. This skill is for **driving the Claude Code CLI**, not the Claude API directly.
  11. ## Quick checks
  12. Verify installation:
  13. ```bash
  14. claude --version
  15. ```
  16. Run a minimal headless prompt (prints a single response):
  17. ```bash
  18. ./scripts/claude_code_run.py -p "Return only the single word OK."
  19. ```
  20. ## Core workflow
  21. ### 1) Run a headless prompt in a repo
  22. ```bash
  23. cd /path/to/repo
  24. /home/ubuntu/clawd/skills/claude-code-clawdbot/scripts/claude_code_run.py \
  25. -p "Summarize this project and point me to the key modules." \
  26. --permission-mode plan
  27. ```
  28. ### 2) Allow tools (auto-approve)
  29. Claude Code supports tool allowlists via `--allowedTools`.
  30. Example: allow read/edit + bash:
  31. ```bash
  32. ./scripts/claude_code_run.py \
  33. -p "Run the test suite and fix any failures." \
  34. --allowedTools "Bash,Read,Edit"
  35. ```
  36. ### 3) Get structured output
  37. ```bash
  38. ./scripts/claude_code_run.py \
  39. -p "Summarize this repo in 5 bullets." \
  40. --output-format json
  41. ```
  42. ### 4) Add extra system instructions
  43. ```bash
  44. ./scripts/claude_code_run.py \
  45. -p "Review the staged diff for security issues." \
  46. --append-system-prompt "You are a security engineer. Be strict." \
  47. --allowedTools "Bash(git diff *),Bash(git status *),Read"
  48. ```
  49. ## Notes (important)
  50. - **After correcting Claude Code's mistakes**: Always instruct Claude Code to run:
  51. > "Update your CLAUDE.md so you don't make that mistake again."
  52. This ensures Claude Code records lessons learned and avoids repeating the same errors.
  53. - Claude Code sometimes expects a TTY.
  54. - **Headless**: this wrapper uses `script(1)` to force a pseudo-terminal.
  55. - **Slash commands** (e.g. `/speckit.*`) are best run in **interactive** mode; this wrapper can start an interactive Claude Code session in **tmux**.
  56. - Use `--permission-mode plan` when you want read-only planning.
  57. - Keep `--allowedTools` narrow (principle of least privilege), especially in automation.
  58. ## High‑leverage Claude Code tips (from the official docs)
  59. ### 1) Always give Claude a way to verify (tests/build/screenshots)
  60. Claude performs dramatically better when it can verify its work.
  61. Make verification explicit in the prompt, e.g.:
  62. - “Fix the bug **and run tests**. Done when `npm test` passes.”
  63. - “Implement UI change, **take a screenshot** and compare to this reference.”
  64. ### 2) Explore → Plan → Implement (use Plan Mode)
  65. For multi-step work, start in plan mode to do safe, read-only analysis:
  66. ```bash
  67. ./scripts/claude_code_run.py -p "Analyze and propose a plan" --permission-mode plan
  68. ```
  69. Then switch to execution (`acceptEdits`) once the plan is approved.
  70. ### 3) Manage context aggressively: /clear and /compact
  71. Long, mixed-topic sessions degrade quality.
  72. - Use `/clear` between unrelated tasks.
  73. - Use `/compact Focus on <X>` when nearing limits to preserve the right details.
  74. ### 4) Rewind aggressively: /rewind (checkpoints)
  75. Claude checkpoints before changes.
  76. If an approach is wrong, use `/rewind` (or Esc Esc) to restore:
  77. - conversation only
  78. - code only
  79. - both
  80. This enables “try something risky → rewind if wrong” loops.
  81. ### 5) Prefer CLAUDE.md for durable rules; keep it short
  82. Best practice is a concise CLAUDE.md (global or per-project) for:
  83. - build/test commands Claude should use
  84. - repo etiquette / style rules that differ from defaults
  85. - non-obvious environment quirks
  86. Overlong CLAUDE.md files get ignored.
  87. ### 6) Permissions: deny > ask > allow (and scope matters)
  88. In `.claude/settings.json` / `~/.claude/settings.json`, rules match in order:
  89. **deny first**, then ask, then allow.
  90. Use deny rules to block secrets (e.g. `.env`, `secrets/**`).
  91. ### 7) Bash env vars don’t persist; use CLAUDE_ENV_FILE for persistence
  92. Each Bash tool call runs in a fresh shell; `export FOO=bar` won’t persist.
  93. If you need persistent env setup, set (before starting Claude Code):
  94. ```bash
  95. export CLAUDE_ENV_FILE=/path/to/env-setup.sh
  96. ```
  97. Claude will source it before each Bash command.
  98. ### 8) Hooks beat “please remember” instructions
  99. Use hooks to enforce deterministic actions (format-on-edit, block writes to sensitive dirs, etc.)
  100. when you need guarantees.
  101. ### 9) Use subagents for heavy investigation / independent review
  102. Subagents can read many files without polluting the main context.
  103. Use them for broad codebase research or post-implementation review.
  104. ### 10) Treat Claude as a Unix utility (headless, pipes, structured output)
  105. Examples:
  106. ```bash
  107. cat build-error.txt | claude -p "Explain root cause"
  108. claude -p "List endpoints" --output-format json
  109. ```
  110. This is ideal for CI and automation.
  111. ## Interactive mode (tmux)
  112. If your prompt contains lines starting with `/` (slash commands), the wrapper defaults to **auto → interactive**.
  113. Example:
  114. ```bash
  115. ./scripts/claude_code_run.py \
  116. --mode auto \
  117. --permission-mode acceptEdits \
  118. --allowedTools "Bash,Read,Edit,Write" \
  119. -p $'/speckit.constitution ...\n/speckit.specify ...\n/speckit.plan ...\n/speckit.tasks\n/speckit.implement'
  120. ```
  121. It will print tmux attach/capture commands so you can monitor progress.
  122. ## Spec Kit end-to-end workflow (tips that prevent hangs)
  123. When you want Claude Code to drive **Spec Kit** end-to-end via `/speckit.*`, do **not** use headless `-p` for the whole flow.
  124. Use **interactive tmux mode** because:
  125. - Spec Kit runs multiple steps (Bash + file writes + git) and may pause for confirmations.
  126. - Headless runs can appear idle and be killed (SIGKILL) by supervisors.
  127. ### Prerequisites (important)
  128. 1) **Initialize Spec Kit** (once per repo)
  129. ```bash
  130. specify init . --ai claude
  131. ```
  132. 2) Ensure the folder is a real git repo (Spec Kit uses git branches/scripts):
  133. ```bash
  134. git init
  135. git add -A
  136. git commit -m "chore: init"
  137. ```
  138. 3) Recommended: set an `origin` remote (can be a local bare repo) so `git fetch --all --prune` won’t behave oddly:
  139. ```bash
  140. git init --bare ../origin.git
  141. git remote add origin ../origin.git
  142. git push -u origin main || git push -u origin master
  143. ```
  144. 4) Give Claude Code enough tool permissions for the workflow:
  145. - Spec creation/tasks/implement need file writes, so include **Write**.
  146. - Implementation often needs Bash.
  147. Recommended:
  148. ```bash
  149. --permission-mode acceptEdits --allowedTools "Bash,Read,Edit,Write"
  150. ```
  151. ### Run the full Spec Kit pipeline
  152. ```bash
  153. ./scripts/claude_code_run.py \
  154. --mode interactive \
  155. --tmux-session cc-speckit \
  156. --permission-mode acceptEdits \
  157. --allowedTools "Bash,Read,Edit,Write" \
  158. -p $'/speckit.constitution Create project principles for quality, accessibility, and security.\n/speckit.specify <your feature description>\n/speckit.plan I am building with <your stack/constraints>\n/speckit.tasks\n/speckit.implement'
  159. ```
  160. ### Monitoring / interacting
  161. The wrapper prints commands like:
  162. - `tmux ... attach -t <session>` to watch in real time
  163. - `tmux ... capture-pane ...` to snapshot output
  164. If Claude Code asks a question mid-run (e.g., “Proceed?”), attach and answer.
  165. ## Operational gotchas (learned in practice)
  166. ### 1) Vite + ngrok: "Blocked request. This host (...) is not allowed"
  167. If you expose a Vite dev server through ngrok, Vite will block unknown Host headers unless configured.
  168. - **Vite 7** expects `server.allowedHosts` to be `true` or `string[]`.
  169. - ✅ Allow all hosts (quick):
  170. ```ts
  171. server: { host: true, allowedHosts: true }
  172. ```
  173. - ✅ Allow just your ngrok host (safer):
  174. ```ts
  175. server: { host: true, allowedHosts: ['xxxx.ngrok-free.app'] }
  176. ```
  177. - ❌ Do **not** set `allowedHosts: 'all'` (won't work in Vite 7).
  178. After changing `vite.config.*`, restart the dev server.
  179. ### 2) Don’t accidentally let your *shell* eat your prompt
  180. When you drive tmux via a shell command (e.g. `tmux send-keys ...`), avoid unescaped **backticks** and shell substitutions in the text you pass.
  181. They can be interpreted by your shell before the text even reaches Claude Code.
  182. Practical rule:
  183. - Prefer sending prompts from a file, or ensure the wrapper/script quotes prompt text safely.
  184. ### 3) Long-running dev servers should run in a persistent session
  185. In automation environments, backgrounded `vite` / `ngrok` processes can get SIGKILL.
  186. Prefer running them in a managed background session (Clawdbot exec background) or tmux, and explicitly stop them when done.
  187. ## OpenSpec workflow (opsx)
  188. OpenSpec is another spec-driven workflow (like Spec Kit) powered by slash commands (e.g. `/opsx:*`).
  189. In practice it has the same reliability constraints:
  190. - Prefer **interactive tmux mode** for `/opsx:*` commands (avoid headless `-p` for the whole flow).
  191. ### Setup (per machine)
  192. Install CLI:
  193. ```bash
  194. npm install -g @fission-ai/openspec@latest
  195. ```
  196. ### Setup (per project)
  197. Initialize OpenSpec **with tool selection** (required):
  198. ```bash
  199. openspec init --tools claude
  200. ```
  201. Tip: disable telemetry if desired:
  202. ```bash
  203. export OPENSPEC_TELEMETRY=0
  204. ```
  205. ### Recommended end-to-end command sequence
  206. Inside Claude Code (interactive):
  207. 1) `/opsx:onboard`
  208. 2) `/opsx:new <change-name>`
  209. 3) `/opsx:ff` (fast-forward: generates proposal/design/specs/tasks)
  210. 4) `/opsx:apply` (implements tasks)
  211. 5) `/opsx:archive` (optional: archive finished change)
  212. If the UI prompts you for project type/stack, answer explicitly (e.g. “Web app (HTML/JS) with localStorage”).
  213. ## Bundled script
  214. - `scripts/claude_code_run.py`: wrapper that runs the local `claude` binary with a pseudo-terminal and forwards flags.
README.md · README · 72 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # [🚀观看我的哔哩哔哩视频](https://space.bilibili.com/3493277319825652)
  2. # claude-code-clawdbot-skill
  3. A **Clawdbot skill** to run **Claude Code** (Anthropic) on the host via the `claude` CLI (Agent SDK).
  4. This repo provides:
  5. - `SKILL.md`: how Clawdbot should use this skill
  6. - `scripts/claude_code_run.py`: a small wrapper that runs `claude -p ...` through a pseudo-terminal to avoid non-TTY hangs
  7. ## Why a wrapper?
  8. Claude Code can behave differently when there is no TTY. In automation (e.g., cron / headless runners), `claude -p` may hang.
  9. This wrapper uses `script -q -c ... /dev/null` to allocate a pseudo-terminal.
  10. ## Requirements
  11. - Claude Code installed on the same host
  12. - `claude` binary available (default expected: `/home/ubuntu/.local/bin/claude`)
  13. Check:
  14. ```bash
  15. claude --version
  16. ```
  17. ## Usage
  18. Basic headless prompt:
  19. ```bash
  20. ./scripts/claude_code_run.py -p "Return only the single word OK." --permission-mode plan
  21. ```
  22. Allow tools (least privilege recommended):
  23. ```bash
  24. ./scripts/claude_code_run.py \
  25. -p "Run tests and fix failures" \
  26. --allowedTools "Bash,Read,Edit"
  27. ```
  28. Structured output:
  29. ```bash
  30. ./scripts/claude_code_run.py -p "Summarize this repo" --output-format json
  31. ```
  32. ---
  33. # 中文说明
  34. 这是一个让 **Clawdbot** 在服务器上通过 **Claude Code CLI(claude)** 运行任务的 skill。
  35. 仓库包含:
  36. - `SKILL.md`:给 Clawdbot 用的 skill 说明
  37. - `scripts/claude_code_run.py`:对 `claude -p` 的封装(分配伪终端),用于避免在无 TTY 环境下卡住
  38. ## 使用方法
  39. 基础测试:
  40. ```bash
  41. ./scripts/claude_code_run.py -p "Return only the single word OK." --permission-mode plan
  42. ```
  43. 允许工具(建议最小权限):
  44. ```bash
  45. ./scripts/claude_code_run.py \
  46. -p "运行测试并修复失败" \
  47. --allowedTools "Bash,Read,Edit"
  48. ```
  49. 结构化输出:
  50. ```bash
  51. ./scripts/claude_code_run.py -p "总结这个仓库" --output-format json
  52. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.