claude-code - 💡(How to fix) Fix Feature request: SKILL.md paths field should respect .gitignore [1 participants]

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…
GitHub stats
anthropics/claude-code#46733Fetched 2026-04-12 13:34:29
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2
RAW_BUFFERClick to expand / collapse

Problem

The paths frontmatter field in SKILL.md uses glob matching to auto-activate a skill when Claude operates on matching files. However, it does not respect .gitignore — a paths: "**" pattern will also match untracked/ignored files (e.g., log/, .DS_Store, build artifacts).

This makes it impossible to write a skill that triggers on "any repo-tracked file change" without also triggering on gitignored files.

Expected behavior

paths glob matching should exclude files matched by .gitignore (and optionally .git/info/exclude), consistent with how tools like rg, fd, and git ls-files behave by default.

Use case

A repository workflow skill (plan-issue-mr-workflow) needs to auto-activate whenever any repo-tracked file is modified, but NOT when operating on gitignored files like logs, build outputs, or local config. Currently the only options are:

  1. paths: "**" — too broad, matches ignored files
  2. Explicitly listing every tracked directory — brittle, requires updating paths whenever the repo structure changes
  3. Omitting paths entirely — loses the deterministic auto-trigger benefit

Proposed solution

When resolving paths globs, filter results through the repository's .gitignore rules (similar to git ls-files --cached --others --exclude-standard). This could be:

  • Default behavior (recommended — matches developer expectations)
  • Opt-in via a flag like paths-respect-gitignore: true

extent analysis

TL;DR

Modify the paths frontmatter field to respect .gitignore rules, either by default or via an opt-in flag like paths-respect-gitignore: true, to exclude ignored files from glob matching.

Guidance

  • To achieve the desired behavior, consider implementing a filter that applies .gitignore rules to the results of paths glob matching, similar to how git ls-files --cached --others --exclude-standard works.
  • When resolving paths globs, use a library or function that can parse and apply .gitignore rules to filter out ignored files.
  • Evaluate the trade-offs between making this behavior the default versus requiring an opt-in flag, considering developer expectations and potential backwards compatibility issues.
  • Test the proposed solution with various .gitignore configurations and paths glob patterns to ensure correct behavior.

Example

# Example SKILL.md frontmatter
paths:
  - "**"
paths-respect-gitignore: true

This example assumes the introduction of a paths-respect-gitignore flag to opt-in to the desired behavior.

Notes

The proposed solution may require updates to the underlying implementation of paths glob matching, and careful consideration should be given to backwards compatibility and potential performance impacts.

Recommendation

Apply workaround by introducing a paths-respect-gitignore flag, allowing developers to opt-in to the desired behavior while maintaining backwards compatibility.

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…

FAQ

Expected behavior

paths glob matching should exclude files matched by .gitignore (and optionally .git/info/exclude), consistent with how tools like rg, fd, and git ls-files behave by default.

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 Feature request: SKILL.md paths field should respect .gitignore [1 participants]