claude-code - 💡(How to fix) Fix [BUG] Custom skill SKILL.md hard constraints ignored across consecutive slash-command invocations

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…

Error Message

Error Messages/Logs

No error messages — this is a silent behavioral compliance issue, not a crash.

Root Cause

Likely Root Cause Hypotheses

Fix Action

Fix / Workaround

When a custom skill's SKILL.md defines hard constraints (e.g. 禁止主管直接使用 Glob/Grep/Read 等工具 — "manager MUST NOT directly use Glob/Grep/Read; must dispatch via Task tool"), Claude (Opus 4.7) repeatedly violated these constraints across 5 consecutive invocations of the same slash command in a single session, only complying after the user explicitly quoted the rule back.

#User args (translated)ExpectedActual
1"Paste these tutorials into a new md, no agent needed"Edge case: user explicit override → OK to write directlyWrote directly. ✅ Acceptable
2"No, why did you write it like that?"Should re-enter manager mode; dispatch agent to investigateAsked clarifying question conversationally
3"Did you not look?"Should dispatch agentUsed Read tool directly
4"What did I write here? Where?"Should dispatch agentReplied conversationally with file path
5"Please follow the skills!!!"Should dispatch agentFinally dispatched (only after explicit user enforcement)

Every /fanout <args> invocation should:

  1. Re-read the SKILL.md constraints
  2. Treat the args as a task input (not a conversational turn)
  3. Strictly dispatch via Task tool — not use Read/Write/Edit/Bash directly

Code Example

---
   name: myskill
   description: Manager that dispatches parallel sub-agents
   argument-hint: task description
   ---
   
   **Hard rule**: You are the manager. You MUST dispatch all work via Task tool.
   **禁止 (PROHIBITED)** using Glob / Grep / Read / Write / Edit / Bash directly.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

When a custom skill's SKILL.md defines hard constraints (e.g. 禁止主管直接使用 Glob/Grep/Read 等工具 — "manager MUST NOT directly use Glob/Grep/Read; must dispatch via Task tool"), Claude (Opus 4.7) repeatedly violated these constraints across 5 consecutive invocations of the same slash command in a single session, only complying after the user explicitly quoted the rule back.

In a single session, the user invoked /fanout 5 times in a row. Model behavior degraded as follows:

#User args (translated)ExpectedActual
1"Paste these tutorials into a new md, no agent needed"Edge case: user explicit override → OK to write directlyWrote directly. ✅ Acceptable
2"No, why did you write it like that?"Should re-enter manager mode; dispatch agent to investigateAsked clarifying question conversationally
3"Did you not look?"Should dispatch agentUsed Read tool directly
4"What did I write here? Where?"Should dispatch agentReplied conversationally with file path
5"Please follow the skills!!!"Should dispatch agentFinally dispatched (only after explicit user enforcement)

What Should Happen?

Every /fanout <args> invocation should:

  1. Re-read the SKILL.md constraints
  2. Treat the args as a task input (not a conversational turn)
  3. Strictly dispatch via Task tool — not use Read/Write/Edit/Bash directly

Custom skills are users' primary mechanism to enforce workflow discipline (mandatory delegation, mandatory report folders, mandatory naming conventions). When the model silently degrades skill compliance under conversational pressure, users lose trust in skills as a control mechanism.

Error Messages/Logs

No error messages — this is a silent behavioral compliance issue, not a crash.

Steps to Reproduce

  1. Create custom skill file at ~/.claude/skills/myskill/SKILL.md with hard constraint such as:
    ---
    name: myskill
    description: Manager that dispatches parallel sub-agents
    argument-hint: task description
    ---
    
    **Hard rule**: You are the manager. You MUST dispatch all work via Task tool.
    **禁止 (PROHIBITED)** using Glob / Grep / Read / Write / Edit / Bash directly.
  2. Invoke /myskill <some concrete task> — model dispatches via Task correctly ✅
  3. After completion, invoke /myskill <short emotional reply like "no that's wrong"> — observe: model now replies conversationally using Read/Bash directly instead of dispatching 🐛
  4. Repeat with more short emotional args — each subsequent invocation also skips dispatch
  5. Only when user explicitly writes something like "please follow the skills!!!" in args does model re-comply

Likely Root Cause Hypotheses

  1. Args interpreted as conversational reply: Short emotional args like "你沒看?" / "Did you not look?" may bypass the skill task-routing logic and be treated as a normal conversational turn.
  2. Sticky exemption: If an earlier invocation received an explicit user override (e.g., "no agent needed"), that override may leak into subsequent invocations as an implicit ongoing exemption.
  3. Skill not re-anchored per invocation: The model may not be reloading SKILL.md as hard constraints on each slash-command call, instead relying on cached interpretation from the first call.
  4. Soft constraint treatment: 禁止 / MUST NOT / required phrasing in skills may not be weighted as hard constraints.

Suggested Fixes

  1. Make every slash-command invocation re-anchor on the skill's SKILL.md, treating it as a fresh prompt boundary.
  2. Treat skill constraints with 禁止 / MUST NOT / required phrasing as hard rather than soft constraints.
  3. Distinguish "args as task input" from "args as conversational reply" — when a slash command is invoked, args should always be treated as task input.

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.116 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

extent analysis

TL;DR

The issue can be resolved by ensuring that every slash-command invocation re-anchors on the skill's SKILL.md and treats the args as task input, rather than conversational reply.

Guidance

  • Verify that the SKILL.md file is being re-read on each invocation by checking the model's behavior when the file is modified between invocations.
  • Implement a distinction between "args as task input" and "args as conversational reply" to prevent the model from bypassing skill task-routing logic.
  • Consider adding logging or debugging statements to track how the model is interpreting the args and whether it is correctly dispatching via the Task tool.
  • Review the custom skills documentation to ensure that the skill file structure and YAML frontmatter are correctly implemented.

Example

---
name: myskill
description: Manager that dispatches parallel sub-agents
argument-hint: task description
---
 
**Hard rule**: You are the manager. You MUST dispatch all work via Task tool.
**禁止 (PROHIBITED)** using Glob / Grep / Read / Write / Edit / Bash directly.

This example shows the correct structure and formatting for the SKILL.md file, which may help resolve the issue.

Notes

The root cause of the issue is likely due to the model's interpretation of the args as conversational replies rather than task input. The suggested fixes aim to address this by re-anchoring on the skill's SKILL.md and treating the args as task input.

Recommendation

Apply the workaround of re-anchoring on the skill's SKILL.md and treating the args as task input, as this is the most likely solution to resolve the issue. This approach addresses the potential root cause and provides a clear path forward for resolving the issue.

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

claude-code - 💡(How to fix) Fix [BUG] Custom skill SKILL.md hard constraints ignored across consecutive slash-command invocations