Skill/command definitions auto-read file paths found in markdown code blocks

Resolved 💬 2 comments Opened Feb 28, 2026 by tomlinford Closed Mar 28, 2026

Description

When a slash command (.claude/commands/*.md) contains a literal file path inside a markdown code block, Claude Code appears to auto-read that file if it exists on disk and inject the contents as a <system-reminder> before the skill is invoked.

Reproduction

  1. Create a command file .claude/commands/example.md that contains a code block referencing a real file path:

```markdown
`bash
git show abc123 > /tmp/sev-fix-diff.patch
`
```

  1. Create that file on disk: echo "hello" > /tmp/sev-fix-diff.patch
  1. Invoke /example
  1. Observe that the contents of /tmp/sev-fix-diff.patch are injected as a <system-reminder> with a Read tool result before the command body is processed.

Expected behavior

File paths inside markdown code blocks in command/skill definitions are instructional text (showing the user/agent what to do). They should not trigger automatic file reads. Only the includes: frontmatter field should control which files are auto-loaded into context.

Observed behavior

The file contents are injected as:

<system-reminder>
Called the Read tool with the following input: {"file_path":"/tmp/sev-fix-diff.patch"}
Result of calling the Read tool: "..."
</system-reminder>

This wastes context window tokens and is confusing — it appears before the skill body, making it look like something triggered the read when nothing in the project's hooks or skill metadata did.

Workaround

Use template placeholders with angle brackets (e.g., /tmp/sev-fix-<slug>.patch) so the path doesn't match a real file on disk.

Environment

  • Claude Code CLI
  • macOS (Darwin 24.6.0)
  • Command defined in .claude/commands/sev-review.md

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗