克劳德·代码特工
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 需要 · Anthropic
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第 1 步 — 检查哪个后端可用
始终首先运行此检查:使用`execute()`执行此检查。然后按照下面的匹配路径进行操作。
## When to use
Use this skill when the research task requires:
- Writing and running non-trivial code that needs iteration to get right
- Analysing a codebase (clone a repo, understand its structure, answer questions about it)
- Generating a working implementation of something described in a paper or spec
- Running experiments where the code needs to adapt based on intermediate results
- Any coding task where a single `generate_code` + `execute` cycle would not be enough
Do NOT use for trivial one-shot scripts — `code_execution` alone is faster and sufficient.
## How to execute
### Step 1 — Check which backend is available
Always run this check first:
```python
import os, subprocess
has_anthropic_key = bool(os.environ.get("ANTHROPIC_API_KEY"))
claude_available = False
if has_anthropic_key:
r = subprocess.run(["claude", "--version"], capture_output=True, text=True)
claude_available = r.returncode == 0
print("backend:", "claude_code" if claude_available else "gemini_fallback")
```
Execute this with `execute()`. Then follow the matching path below.
---
### Path A — Claude Code (when `claude_available` is True)
`claude -p` runs non-interactively and exits when done.
```python
import subprocess
task = """
<describe the coding task in full detail>
Output the result as plain text or JSON.
"""
result = subprocess.run(
["claude", "-p", task],
capture_output=True,
text=True,
timeout=300,
)
print("exit:", result.returncode)
print(result.stdout)
if result.stderr:
print("stderr:", result.stderr[:2000])
```
If the output is incomplete, make a follow-up call with the prior output as context:
```python
result2 = subprocess.run(
["claude", "-p", f"Previous output:\n{result.stdout}\n\nContinue: <remaining task>"],
capture_output=True, text=True, timeout=300,
)
print(result2.stdout)
```
---
### Path B — Gemini fallback (when `claude_available` is False)
Use `generate_code` to produce the implementation, then `execute` to run it. Iterate up to 3 times.
**Iteration pattern:**
1. Call `generate_code("full task description")` — returns working Python
2. Call `execute(code)` — run it, read stdout/stderr
3. If it fails or output is wrong: call `generate_code("fix this: <error> in this code: <code>")` and execute again
4. After 3 iterations, accept the best result and record what remains incomplete
For codebase analysis without Claude Code:
```python
import subprocess, tempfile
with tempfile.TemporaryDirectory() as tmpdir:
subprocess.run(["git", "clone", "--depth=1", repo_url, tmpdir], check=True, timeout=120)
# Then use generate_code + execute to analyse the cloned repo
```
---
## Output contract
Include in `proof`:
- `backend_used`: `"claude_code"` or `"gemini_fallback"`
- `task_given`: the coding task description
- `output`: the final result (stdout or generated artefact)
- `iterations`: number of attempts made
- `exit_code` (Claude Code path): 0 = success
- `error_output` (if any): stderr or exception text
List produced files in `artefacts`.
## Quality bar
- Always run the Step 1 backend check — do not assume which is available
- Claude Code path: capture both stdout and stderr; stderr shows tool use logs
- Gemini fallback path: do not exceed 3 iterations — accept partial results and note gaps in proof
- Never pass secrets or credentials in the task string
- Set timeout ≥ 120s on all subprocess calls
## Pairs with
- `web_browse` — fetch specs or docs first, then pass them to the coding agent
- `dataset_inspection` — inspect a dataset's schema, then delegate cleaning/analysis here
- `code_execution` — this skill IS the advanced form of code_execution; use plain code_execution for simple one-shot scripts
---
> Source: [ai-agents-for-humans/slow-ai](https://github.com/ai-agents-for-humans/slow-ai) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->
章节与文件索引
按说明文件中的顺序排列。
何时使用
第 1 步 — 检查哪个后端可用
路径 A — Claude 代码(当 claudeavailable 为 True 时)
路径 B — Gemini 后备(当 claudeavailable 为 False 时)
产出合约
文件/命令 -> generate_code · execute · code_execution · execute() · claude_available · claude -p · generate_code("full task description") · execute(code)
内容校验值 -> 94b9eef1aba5
当前原文的自动摘译,尚未人工审校。
何时使用
当研究任务需要时,请使用此技能: 编写和运行需要迭代才能正确的重要代码 分析代码库(克隆存储库,了解其结构,回答有关它的问题) 生成论文或规范中描述的内容的工作实现 运行代码需要根据中间结果进行调整的实验
路径 A — Claude 代码(当 claudeavailable 为 True 时)
claude -p以非交互方式运行并在完成后退出。如果输出不完整,则使用先前的输出作为上下文进行后续调用:路径 B — Gemini 后备(当 claudeavailable 为 False 时)
使用
generate_code生成实现,然后使用execute运行它。迭代最多 3 次。迭代模式: 调用generate_code("full task description")— 返回工作 Python 调用execute(code)— 运行它,读取 stdout/stderr 如果失败或输出错误:调用generate_code("fix this: <error> in this code: <code>")并再次执行产出合约
包含在
proof:backend_used:"claude_code"或"gemini_fallback"task_given:编码任务描述output:最终结果(标准输出或生成的工件)iterations:尝试次数