Skip to content

Commit 3d0d1ec

Browse files
refactor: reorganize tool usage strategy and add shell tools rubric
- Move Tool Usage Strategy section to end of document for better organization - Add comprehensive shell tools rubric with specific CLI recommendations - Include ast-grep configuration for code structure searches with language support - Document supported languages organized by domain (System, Server Side, Web, Mobile, etc.) - Add guidance to install CLI tools if not available - Prioritize ast-grep over ripgrep for code structure searches
1 parent edb1efe commit 3d0d1ec

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

claude-code/CLAUDE.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -917,18 +917,6 @@ When health reaches 🟡, proactively:
917917
4. Save all session state for seamless resume
918918
</session_state_management_guide>
919919

920-
# Tool Usage Strategy
921-
922-
<tool_selection_hierarchy>
923-
1. **MCP Tools First**: Check if there are MCP (Model Context Protocol) tools available that can serve the purpose
924-
2. **CLI Fallback**: If no MCP tool exists, use equivalent CLI option
925-
- Fetch latest man/help page or run with --help to understand usage
926-
- Examples: Use `psql` instead of postgres tool, `git` instead of git tool, `gh` instead of github tool
927-
3. **API Direct**: For web services without CLI, use curl to call APIs directly
928-
- Examples: Use Jira API, GitHub API, etc.
929-
</tool_selection_hierarchy>
930-
931-
932920
# Available Commands
933921

934922
@{{HOME_TOOL_DIR}}/commands/brainstorm.md
@@ -960,4 +948,39 @@ When health reaches 🟡, proactively:
960948
# Templates
961949

962950
@{{HOME_TOOL_DIR}}/templates/codereview-checklist-template.md
963-
@{{HOME_TOOL_DIR}}/templates/handover-template.md
951+
@{{HOME_TOOL_DIR}}/templates/handover-template.md
952+
953+
# Tool Usage Strategy
954+
955+
<tool_selection_hierarchy>
956+
1. **MCP Tools First**: Check if there are MCP (Model Context Protocol) tools available that can serve the purpose
957+
2. **CLI Fallback**: If no MCP tool exists, use equivalent CLI option
958+
- Fetch latest man/help page or run with --help to understand usage
959+
- Examples: Use `psql` instead of postgres tool, `git` instead of git tool, `gh` instead of github tool
960+
3. **API Direct**: For web services without CLI, use curl to call APIs directly
961+
- Examples: Use Jira API, GitHub API, etc.
962+
963+
# When you need to call tools from the shell, **use this rubric**:
964+
965+
- Find Files: `fd`
966+
- Find Text: `rg` (ripgrep)
967+
- Find Code Structure (TS/TSX): `ast-grep`
968+
- **Default to TypeScript:**
969+
- `.ts``ast-grep --lang ts -p '<pattern>'`
970+
- `.tsx` (React) → `ast-grep --lang tsx -p '<pattern>'`
971+
- For other languages, set `--lang` appropriately (e.g., `--lang rust`).
972+
- **Supported Languages by Domain:**
973+
- System Programming: C, Cpp, Rust
974+
- Server Side Programming: Go, Java, Python, C-sharp
975+
- Web Development: JS(X), TS(X), HTML, CSS
976+
- Mobile App Development: Kotlin, Swift
977+
- Configuration: Json, YAML
978+
- Scripting, Protocols, etc.: Lua, Thrift
979+
- Select among matches: pipe to `fzf`
980+
- JSON: `jq`
981+
- YAML/XML: `yq`
982+
983+
If ast-grep is available avoid tools `rg` or `grep` unless a plain‑text search is explicitly requested.
984+
985+
**If a CLI tool is not available, install it and use it.**
986+
</tool_selection_hierarchy>

0 commit comments

Comments
 (0)