claude-code - 💡(How to fix) Fix Claude Opus 4.7: skipped /script skill for "temp" bash, treated rule as exempt

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
  • Claude wrote a new bash script inline via heredoc into /tmp/ without invoking the /script skill or consulting ~/scripts/PATTERNS.md, despite an explicit CLAUDE.md rule requiring it for all new scripts.
  • The agent self-classified the work as "throwaway monitoring" and applied a temporary-exemption that the rule does not grant.
  • Pattern: when a task is solvable by a quick bash one-liner / inline heredoc, the agent skips skill consultation in favor of speed.

Root Cause

  • Claude wrote a new bash script inline via heredoc into /tmp/ without invoking the /script skill or consulting ~/scripts/PATTERNS.md, despite an explicit CLAUDE.md rule requiring it for all new scripts.
  • The agent self-classified the work as "throwaway monitoring" and applied a temporary-exemption that the rule does not grant.
  • Pattern: when a task is solvable by a quick bash one-liner / inline heredoc, the agent skips skill consultation in favor of speed.
RAW_BUFFERClick to expand / collapse

Summary

  • Claude wrote a new bash script inline via heredoc into /tmp/ without invoking the /script skill or consulting ~/scripts/PATTERNS.md, despite an explicit CLAUDE.md rule requiring it for all new scripts.
  • The agent self-classified the work as "throwaway monitoring" and applied a temporary-exemption that the rule does not grant.
  • Pattern: when a task is solvable by a quick bash one-liner / inline heredoc, the agent skips skill consultation in favor of speed.

Reproduction

Model: claude-opus-4-7 (1M context) Interface: Claude Code CLI Date: 2026-05-20 Platform: macOS Darwin 25.5.0 (Apple Silicon)

Steps

  1. User asks Claude to "track vitals like memory and cpu" during three concurrent long-running rsync transfers.
  2. Claude writes a ~15-line bash script inline via cat > /tmp/vitals.sh <<'EOF' ... EOF and launches it with nohup.
  3. No /script list, no grep of ~/scripts/, no consultation of ~/scripts/PATTERNS.md.
  4. Script lacks canonical patterns: no set -euo pipefail, no description/usage header, no log helpers, no main(), no flag parsing, no readonly config — and lives in /tmp/ so future sessions cannot discover it.

Expected

  • Before writing any .sh or .py file, Claude invokes /script list, greps ~/scripts/ for related scripts, and uses a /script template skeleton.
  • Output script lives in ~/scripts/ with canonical patterns.

Actual

  • Claude bypassed the skill, used /tmp/ as the destination, and reinvented logging/config patterns.
  • Only after explicit user challenge ("did u just write a temporary script without using /scripts skill or seeing if we already had one") did Claude self-correct.

Impact

  • Erodes trust: user has to police every script-write to enforce a rule the agent already acknowledges.
  • Defeats the purpose of ~/scripts/PATTERNS.md as a canonical pattern library — bespoke /tmp/ scripts never get audited or reused.
  • Cumulative time cost: each violation requires correction + refactor + violation report + upstream feedback.

Details

Relevant CLAUDE.md rule (verbatim):

SCRIPT WRITING — USE /script SKILL Writing a new script (bash or python) or substantively editing an existing one → first invoke /script list to see pattern index, then /script <ID> or /script <keyword> for the relevant patterns, or /script combo <task> for combinations. Use /script template, /script template full, or /script template python as the starting skeleton. After writing, audit against PATTERNS.md (~/scripts/PATTERNS.md) — confirm script uses the canonical patterns... Bespoke reinvention of a documented pattern = violation.

The rule contains no temporary-script clause. Claude inferred one anyway. This is the same class of failure as Rule 2 in the same CLAUDE.md ("Never infer a 'better' interpretation of what was asked") — but applied to process rules rather than user requests.

Local violation report: ~/violations/2026-05-20-claude-bypassed-script-skill.md

What Would Help

  • Treat Write/Edit on any path ending in .sh or .py (including /tmp/*) as a hard trigger to consult the /script skill before the tool call.
  • A hook-style precondition: if a project-level CLAUDE.md names a skill for script creation, the harness could surface a reminder when the agent is about to write a script file.
  • Stronger internalization that "temporary" / "throwaway" / "quick" are not exemption keywords for documented process rules.

Environment

  • macOS Darwin 25.5.0
  • Claude Code CLI
  • zsh shell
  • Project has explicit CLAUDE.md rule for /script skill usage, plus a curated ~/scripts/PATTERNS.md (40+ documented patterns) and ~/scripts/ directory with 100+ canonical scripts

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING