claude-code - 💡(How to fix) Fix CLAUDE_CONFIG_DIR semantics inconsistent: settings.json under .claude/ but skills at root [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#55065Fetched 2026-05-01 05:47:08
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Code Example

export CLAUDE_CONFIG_DIR=/tmp/cc-test
rm -rf "$CLAUDE_CONFIG_DIR"
mkdir -p "$CLAUDE_CONFIG_DIR/.claude/skills/foo" "$CLAUDE_CONFIG_DIR/skills/bar"

cat > "$CLAUDE_CONFIG_DIR/.claude/skills/foo/SKILL.md" <<'SKILL'
---
name: foo
description: Test skill placed under CLAUDE_CONFIG_DIR/.claude/skills/ (parent-of-.claude semantics).
---

# foo

When invoked, respond `foo invoked` and stop.
SKILL

cat > "$CLAUDE_CONFIG_DIR/skills/bar/SKILL.md" <<'SKILL'
---
name: bar
description: Test skill placed under CLAUDE_CONFIG_DIR/skills/ (config-dir-as-.claude semantics).
---

# bar

When invoked, respond `bar invoked` and stop.
SKILL

claude --setting-sources user --debug-file /tmp/cc.log -p "/foo"
# → Unknown command: /foo  (skill not registered)

claude --setting-sources user -p "/bar"
# → bar invoked         (skill registered and invocable)

grep "Loading skills" /tmp/cc.log
# → Loading skills from: managed=..., user=/tmp/cc-test/skills, project=[...]
RAW_BUFFERClick to expand / collapse

When CLAUDE_CONFIG_DIR is set, Claude Code resolves config paths inconsistently across files:

FilePath scannedImplies CLAUDE_CONFIG_DIR is...
settings.json${CLAUDE_CONFIG_DIR}/.claude/settings.jsonparent of .claude/ (like ~)
User skills${CLAUDE_CONFIG_DIR}/skills/the .claude/ dir itself (like ~/.claude)

Repro (Claude Code v2.1.122):

export CLAUDE_CONFIG_DIR=/tmp/cc-test
rm -rf "$CLAUDE_CONFIG_DIR"
mkdir -p "$CLAUDE_CONFIG_DIR/.claude/skills/foo" "$CLAUDE_CONFIG_DIR/skills/bar"

cat > "$CLAUDE_CONFIG_DIR/.claude/skills/foo/SKILL.md" <<'SKILL'
---
name: foo
description: Test skill placed under CLAUDE_CONFIG_DIR/.claude/skills/ (parent-of-.claude semantics).
---

# foo

When invoked, respond `foo invoked` and stop.
SKILL

cat > "$CLAUDE_CONFIG_DIR/skills/bar/SKILL.md" <<'SKILL'
---
name: bar
description: Test skill placed under CLAUDE_CONFIG_DIR/skills/ (config-dir-as-.claude semantics).
---

# bar

When invoked, respond `bar invoked` and stop.
SKILL

claude --setting-sources user --debug-file /tmp/cc.log -p "/foo"
# → Unknown command: /foo  (skill not registered)

claude --setting-sources user -p "/bar"
# → bar invoked         (skill registered and invocable)

grep "Loading skills" /tmp/cc.log
# → Loading skills from: managed=..., user=/tmp/cc-test/skills, project=[...]

The debug log confirms user-level skills are scanned at ${CLAUDE_CONFIG_DIR}/skills/ while settings.json resolves under ${CLAUDE_CONFIG_DIR}/.claude/.

Expected: consistent semantics — either both under .claude/ (treating CLAUDE_CONFIG_DIR as a parent) or both at the root (treating it as the .claude dir itself).

Impact: containerized/sandboxed Claude Code installs that anchor CLAUDE_CONFIG_DIR to a custom path lose user-level skill discovery without the inconsistency being documented anywhere. The official docs don't describe CLAUDE_CONFIG_DIR's layout in detail. Related: #3833.

Suggested fix: unify the path semantics, or document the layout explicitly so consumers can pick a CLAUDE_CONFIG_DIR value that works for both.

extent analysis

TL;DR

Unify the path semantics for CLAUDE_CONFIG_DIR to ensure consistent resolution of config paths across files.

Guidance

  • Verify the current behavior by checking the debug log for skill loading paths, as shown in the repro steps.
  • Consider setting CLAUDE_CONFIG_DIR to a path that allows for consistent semantics, such as a directory containing a .claude subdirectory.
  • To mitigate the issue, ensure that user-level skills are placed in a location that matches the expected semantics, either under .claude/skills/ or directly under CLAUDE_CONFIG_DIR/skills/.
  • Review the official documentation and related issues (e.g., #3833) for any updates on CLAUDE_CONFIG_DIR layout and semantics.

Example

No code snippet is provided, as the issue is related to configuration and path semantics rather than code implementation.

Notes

The suggested fix requires clarification on the intended semantics of CLAUDE_CONFIG_DIR. Until then, consumers may need to experiment with different directory structures to achieve consistent behavior.

Recommendation

Apply a workaround by setting CLAUDE_CONFIG_DIR to a path that allows for consistent semantics, such as a directory containing a .claude subdirectory, until the path semantics are unified or explicitly documented.

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