Skip to content

Commit 43d647e

Browse files
catlog22claude
andcommitted
docs: 强调--include-directories参数减少无关文件干扰的优势
在多个关键位置强化cd + --include-directories模式的核心价值: - Quick Decision Matrix添加多目录分析场景示例 - Core Principles新增"最小化上下文噪音"原则 - 更新Purpose说明减少无关文件噪音的核心目的 - Benefits部分突出最小化无关文件干扰优势 - 示例中添加注释展示实际效果和文件范围控制 通过精确的目录导航和依赖引入,减少token使用并提高分析精度 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 76aa20c commit 43d647e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.claude/workflows/intelligent-tools-strategy.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type: strategic-guideline
4444
|----------|------|-----------------|
4545
| **Exploring/Understanding** | Gemini → Qwen | `cd [dir] && gemini -p "PURPOSE:... CONTEXT: @**/*"` |
4646
| **Architecture/Analysis** | Gemini → Qwen | `cd [dir] && gemini -p "PURPOSE:... CONTEXT: @**/*"` |
47+
| **Multi-directory Analysis** | Gemini → Qwen | `cd [main-dir] && gemini -p "CONTEXT: @**/* @../dep/**/*" --include-directories ../dep` (reduces noise) |
4748
| **Building/Fixing** | Codex | `codex -C [dir] --full-auto exec "PURPOSE:... MODE: auto"` |
4849
| **Not sure?** | Multiple | Use tools in parallel |
4950
| **Small task?** | Still use tools | Tools are faster than manual work |
@@ -53,6 +54,7 @@ type: strategic-guideline
5354
- **When in doubt, use both** - Parallel usage provides comprehensive coverage
5455
- **Default to tools** - Use specialized tools for most coding tasks, no matter how small
5556
- **Lower barriers** - Engage tools immediately when encountering any complexity
57+
- **Minimize context noise** - Use `cd` + `--include-directories` to focus on relevant files, exclude unrelated directories
5658
- **⚠️ Write operation protection** - For local codebase write/modify operations, require EXPLICIT user confirmation unless user provides clear instructions containing MODE=write or MODE=auto
5759

5860
---
@@ -262,7 +264,7 @@ RULES: [template reference and constraints]
262264

263265
#### Multi-Directory Support (Gemini & Qwen)
264266

265-
**Purpose**: For large projects requiring fine-grained access across multiple directories
267+
**Purpose**: Reduce irrelevant file noise by focusing analysis on specific directories while maintaining necessary cross-directory context
266268

267269
**Use Case**: When `cd` limits scope but you need to reference files from parent/sibling folders
268270

@@ -281,6 +283,7 @@ gemini -p "prompt" --include-directories /path/to/project1,/path/to/project2
281283
gemini -p "prompt" --include-directories /path/to/project1 --include-directories /path/to/project2
282284

283285
# Combined with cd for focused analysis with extended context (RECOMMENDED)
286+
# This pattern minimizes irrelevant files by focusing on src/auth while only including necessary dependencies
284287
cd src/auth && gemini -p "
285288
PURPOSE: Analyze authentication with shared utilities context
286289
TASK: Review auth implementation and its dependencies
@@ -289,13 +292,14 @@ CONTEXT: @**/* @../shared/**/* @../types/**/*
289292
EXPECTED: Complete analysis with cross-directory dependencies
290293
RULES: Focus on integration patterns
291294
" --include-directories ../shared,../types
295+
# Result: Only src/auth/**, ../shared/**, ../types/** are analyzed, other project files excluded
292296
```
293297

294298
**Best Practices**:
295299
- **Recommended Pattern**: Use `cd` to navigate to primary focus directory, then use `--include-directories` for additional context
296300
- Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-directories ../shared,../types`
297301
- **⚠️ CRITICAL**: CONTEXT must explicitly list external files (e.g., `@../shared/**/*`), AND command must include `--include-directories ../shared`
298-
- Benefits: More precise file references (relative to current directory), clearer intent, better context control
302+
- Benefits: **Minimizes irrelevant file interference** (only includes specified directories), more precise file references (relative to current directory), clearer intent, better context control
299303
- **Enforcement Rule**: When CONTEXT references external directories, ALWAYS add corresponding `--include-directories`
300304
- Use when `cd` alone limits necessary context visibility
301305
- Keep directory count ≤ 5 for optimal performance
@@ -334,6 +338,7 @@ mcp__code-index__search_code_advanced(pattern="interface.*Props", file_pattern="
334338
CONTEXT: @src/components/Auth.tsx @src/types/auth.d.ts @src/hooks/useAuth.ts
335339

336340
# Step 3: Execute CLI with precise file references
341+
# cd to src/ reduces scope; specific files further minimize context to only relevant files
337342
cd src && gemini -p "
338343
PURPOSE: Analyze authentication components
339344
TASK: Review auth component patterns and props interfaces
@@ -342,6 +347,7 @@ CONTEXT: @components/Auth.tsx @types/auth.d.ts @hooks/useAuth.ts
342347
EXPECTED: Pattern analysis and improvement suggestions
343348
RULES: Focus on type safety and component composition
344349
"
350+
# Result: Only 3 specific files analyzed instead of entire src/ tree
345351
```
346352

347353
---
@@ -497,6 +503,7 @@ bash(codex -C directory --full-auto exec "task") # Complex implementation: 90-1
497503
- Working in subdirectory but need parent/sibling context
498504
- Cross-directory dependency analysis required
499505
- Multiple related modules need simultaneous access
506+
- **Key benefit**: Excludes unrelated directories, reducing token usage and improving analysis precision
500507

501508
---
502509

0 commit comments

Comments
 (0)