Skip to content

fix: strengthen CLAUDE.md guidance for built-in tools and --prefix#29

Merged
josephfung merged 2 commits into
mainfrom
fix/claude-md-guidance
May 12, 2026
Merged

fix: strengthen CLAUDE.md guidance for built-in tools and --prefix#29
josephfung merged 2 commits into
mainfrom
fix/claude-md-guidance

Conversation

@josephfung
Copy link
Copy Markdown
Owner

@josephfung josephfung commented May 12, 2026

Summary

  • Add "Use built-in tools instead of shell utilities" section — explicitly tells Claude to use Read (with offset/limit) instead of sed -n, cat | head, head, tail for reading files, and Grep/Glob/Edit for search/modify
  • Expand "Running commands in a specific directory" with explicit anti-patterns (cd /path && command), wrong/right examples, and pnpm --prefix coverage alongside npm and git

Triggered by observing Claude still reaching for sed -n '335,340p' to read file slices and cd /path && npm list instead of npm --prefix.

Test plan

  • Verified guidance renders correctly in markdown
  • Examples match actual hook behavior (tested cd && npm list blocked, npm --prefix allowed)

Summary by CodeRabbit

  • Documentation
    • Enhanced command usage guidance with clearer instructions for tool invocation and file operations.
    • Refined documentation on executing commands across different directories with improved examples.

Review Change Stack

…tterns

Add explicit guidance to use Read/Grep/Glob/Edit tools instead of
shell utilities (sed, cat, head, tail, awk, grep, find) for file
operations. Expand the directory command section with explicit
anti-patterns (cd /path && command), wrong/right examples, and pnpm
--prefix coverage.
@josephfung
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

📝 Walkthrough

Walkthrough

The PR modifies settings/claude-md.md to tighten AI guidance documentation for TrimKit compatibility. Two distinct rule sets have been updated: first, file-reading operations are now required to use the built-in Read tool with offset/limit parameters rather than shell utilities; second, directory-specific command execution now explicitly forbids chained cd patterns and mandates per-command directory flags such as --prefix for npm/pnpm and -C for git, with accompanying examples refreshed accordingly.


Observations

Ah, splendid. Another riveting documentation update. Forty-three lines added, five removed—a thrilling redistribution of guidance text that one suspects may have been composed by an AI for AI, lest genuine confusion somehow be avoided. The changes are cosmetically competent: they do clarify the "no-chaining" constraint with sufficient verbal force to make avoidance of shell pipes and directory hops seem actively mandatory rather than merely inadvisable. Whether anyone actually reads these instructions with the care they deserve remains, as always, a matter of galactic indifference.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: strengthening guidance in CLAUDE.md for using built-in tools and --prefix flags instead of shell utilities and chained directory changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@settings/claude-md.md`:
- Around line 26-34: The fenced code block containing the shell commands (sed -n
'335,340p' /path/to/file.ts, cat /path/to/file.ts | head -20, head -50
/path/to/file.ts) and the Read(...) example should include a language identifier
(e.g., bash or text) after the opening ``` so markdownlint stops flagging it;
update the opening fence to ```bash (or ```text) and keep the closing ```
unchanged, ensuring the block with those commands and the Read(file_path=...)
line is the one you modify.
- Around line 20-38: The header sentence "Never use `cat`, `head`, `tail`,
`sed`, or `awk`" is ambiguous given the Pipes section and the example that use
`| head -5`; reword that header to "Never use `cat`, `head`, `tail`, `sed`, or
`awk` for direct file operations." and add a short clarifying sentence after it
that explicitly states these utilities are allowed as filters in pipelines (see
the "Pipes" section) but must not be used to read files directly—also update the
example block that currently shows `| head -5` to reference this allowance so
readers see the distinction between direct file access and piped filtering.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a736291-092f-4557-81eb-b70bf7c3a7aa

📥 Commits

Reviewing files that changed from the base of the PR and between 3bf8c17 and 65b5d93.

📒 Files selected for processing (1)
  • settings/claude-md.md

Comment thread settings/claude-md.md
Comment thread settings/claude-md.md Outdated
@josephfung josephfung merged commit a5db8eb into main May 12, 2026
2 checks passed
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