anthropics / anthropics/skills

skill-creator: description-optimization (run_loop) is broken on Windows - claude not found + select() on pipes

Aberta
#1,221 0 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
176k
Forks
20.8k
Merge médio
7h 21min
PRs com merge (30d)
5

Descrição

## Summary
The skill-creator's description-optimization tooling (`scripts/run_loop.py` →
`scripts/run_eval.py` + `scripts/improve_description.py`) cannot run on Windows.
Every `claude -p` subprocess fails with `FileNotFoundError: [WinError 2]`, and
the streaming reader uses `select.select()` on a subprocess pipe, which is
POSIX-only. On Windows all queries error out and the loop crashes when it
reaches the "Improving description" step.

## Environment
- Windows 11, Python 3.14
- Claude Code CLI 2.1.158 (installed via npm; resolves to `claude.cmd`)
- skills repo at commit `da20c92`

## Reproduction
```
python -m scripts.run_loop \
--eval-set \
--skill-path \
--model --max-iterations 1 --verbose
```
Result: `Warning: query failed: [WinError 2] Das System kann die angegebene Datei nicht finden`
repeated for every query, then a traceback ending in
`FileNotFoundError: [WinError 2]` from `improve_description.py`.

## Root causes & fixes

**1. `subprocess` can't launch the CLI by bare name `"claude"` on Windows.**
On Windows the CLI is `claude.cmd`; `CreateProcess` cannot execute a `.cmd`
directly and bare `"claude"` isn't resolved. Fix: resolve via
`shutil.which("claude")` and, on `os.name == "nt"`, route through the command
interpreter (`%COMSPEC% /c ...`). Applies to both `run_eval.py` (line ~71) and
`improve_description.py` (line ~26).

**2. `select.select()` on a pipe is POSIX-only (`run_eval.py` line ~108).**
On Windows `select` only works with sockets, so the streaming read loop can
never read the subprocess stdout. Fix: drop `select`; iterate
`for raw_line in process.stdout:` (portable) and enforce the timeout with a
`threading.Timer` watchdog that kills the process. Early-trigger detection logic
is unchanged.

## Patch
A unified diff against `da20c92` is attached (`skill-creator-windows-fixes.patch`),
touching only `scripts/run_eval.py` and `scripts/improve_description.py`. After
applying, `run_loop` launches `claude -p` successfully and streams events on
Windows.

## Note (separate, lower priority)
With the subprocess fixed, the trigger-detection harness still reported
`recall=0%` on Windows: the temp slash-command written to
`/.claude/commands/` did not surface as an invocable Skill under
`claude -p` in this environment, so the model never emitted a `Skill`/`Read`
tool call for it. Worth confirming whether project-scoped commands are exposed
to `claude -p` headless runs on Windows, as the description-optimization signal
depends on it. (Filed separately from the two subprocess bugs above, which are
clear-cut.)

[skill-creator-windows-fixes.patch](https://github.com/user-attachments/files/28425743/skill-creator-windows-fixes.patch)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.