Skip to content

Track .claude/rules/ and leave the rest of .claude/ ignored - #101

Merged
detain merged 1 commit into
masterfrom
docs-track-claude-rules
Aug 7, 2026
Merged

Track .claude/rules/ and leave the rest of .claude/ ignored#101
detain merged 1 commit into
masterfrom
docs-track-claude-rules

Conversation

@detain

@detain detain commented Aug 7, 2026

Copy link
Copy Markdown
Owner

S192 left "track .claude/ in phlix-docs" as an open decision. This settles it.

Tracks .claude/rules/ only, and leaves the rest of .claude/ ignored.

⚠ Premise correction — my stated reason was wrong

I justified this as "the rule was invisible, so the error shipped". That is not what happened. README.md:57-61 already documented the slug rule, and CI did go red. What actually failed is that a red advisory check does not block a merge.

So tracking .claude/rules/ alone will not prevent recurrence — branch protection would. This is still worth doing (the rule belongs in version control, next to the docs it governs), but it should not be recorded as the fix for the S259 incident.

The .gitignore landmine, reproduced before fixing

With .claude/ plus a naive !.claude/rules/*.md, git status printed nothing and check-ignore still blamed the directory line — a directory exclusion is never descended into, so its own negations cannot fire.

Fixed with .claude/* + !.claude/rules/. Proven both directions: git status shows exactly the one intended file, check-ignore exits 1 for it, and the four excluded files remain attributed to .gitignore:13.

What was deliberately excluded

  • settings.json — hardcodes a machine-local nvm path and registers 4 always-on hooks.
  • The 3 caliber skills.

No secrets: the only matches were ${{ secrets.X }} placeholders inside an excluded file.

Gates

npm test 0 (84) · npm run docs:build 0 · 158 pages, 3474 links, 0 dead.

🤖 Generated with Claude Code

S192 left "track `.claude/` here" as an open decision; this settles it in
favour, but narrowly.

## The ignore rule

`.gitignore` had a bare `.claude/`. A directory exclusion makes git skip the
directory outright, so it never evaluates a `!` negation inside it — adding
`!.claude/rules/*.md` under `.claude/` tracks nothing at all. Reproduced
before writing the fix: with that pair in place, `git status
--untracked-files=all .claude/` printed nothing and `git check-ignore -v`
still attributed the ignore to the `.claude/` line.

The working form excludes the directory's *contents* and re-includes the one
subdirectory, so git descends into it:

    .claude/*
    !.claude/rules/

Verified after the change — `git status --untracked-files=all .claude/`
lists exactly `?? .claude/rules/docs-authoring.md`, `git check-ignore` exits
1 (not ignored) for that path, and the four excluded files are still
attributed to `.gitignore:13`.

## What is tracked, and what is not

Tracked: `.claude/rules/docs-authoring.md` — repo knowledge (sidebar
registration, section landing-page keys, the anchor-slug rules, the
OpenAPI-sibling convention).

Deliberately left ignored:

- `.claude/settings.json` — hardcodes a machine-local interpreter path
  (`/home/my/.nvm/.../bin/caliber`) and registers four hooks that would then
  fire on every tool use in every clone. Local state.
- `.claude/skills/{find-skills,save-learning,setup-caliber}/SKILL.md` —
  generic caliber tooling, not repo knowledge. All three drive `caliber`,
  whose state (`.caliber/`, `CALIBER_LEARNINGS.md`) is deliberately ignored
  here, and `save-learning` instructs `git add CALIBER_LEARNINGS.md`, which
  this repo ignores. Tracking them would propagate that inconsistency.
- `.claude/hooks/` — empty; git cannot track an empty directory.

Scanned `.claude/` for credentials before staging. The only hits were
`${{ secrets.ANTHROPIC_API_KEY }}`-style placeholder *references* inside the
setup-caliber skill doc, which is excluded anyway. No secret material.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@detain
detain merged commit 40fd890 into master Aug 7, 2026
3 checks passed
@detain
detain deleted the docs-track-claude-rules branch August 7, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant