mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
docs: 更新智能工具选择策略文档,明确外部目录引用的两步要求和示例
This commit is contained in:
@@ -67,7 +67,7 @@ The agent handles all phases internally.
|
|||||||
|
|
||||||
## Context Assembly
|
## Context Assembly
|
||||||
|
|
||||||
**Always included**: `@CLAUDE.md @**/*CLAUDE.md` (project guidelines)
|
**Always included**: `@CLAUDE.md @**/*CLAUDE.md` (project guidelines, space-separated)
|
||||||
|
|
||||||
**Optional**:
|
**Optional**:
|
||||||
- User-explicit files from inquiry keywords
|
- User-explicit files from inquiry keywords
|
||||||
@@ -79,10 +79,12 @@ For targeted analysis, use `rg` or MCP tools to discover relevant files first, t
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd . && gemini -p "
|
cd . && gemini -p "
|
||||||
INQUIRY: [user question]
|
PURPOSE: Answer user inquiry about codebase
|
||||||
CONTEXT: @CLAUDE.md,**/*CLAUDE.md [inferred files or @**/* for all files]
|
TASK: [user question]
|
||||||
MODE: analysis
|
MODE: analysis
|
||||||
RESPONSE: Direct answer, explanation, insights (NO code modification)
|
CONTEXT: @CLAUDE.md @**/*CLAUDE.md [inferred files or @**/* for all files]
|
||||||
|
EXPECTED: Direct answer, explanation, insights (NO code modification)
|
||||||
|
RULES: Focus on clarity and accuracy
|
||||||
"
|
"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -223,11 +223,13 @@ RULES: [template reference and constraints]
|
|||||||
- `@src/**/*` = Files within src subdirectory (if exists under current directory)
|
- `@src/**/*` = Files within src subdirectory (if exists under current directory)
|
||||||
- **CANNOT reference parent or sibling directories via @ alone**
|
- **CANNOT reference parent or sibling directories via @ alone**
|
||||||
|
|
||||||
**To reference files outside current directory**:
|
**To reference files outside current directory (TWO-STEP REQUIREMENT)**:
|
||||||
- **MUST use `--include-directories`** to explicitly add external directories
|
- **Step 1**: Add `--include-directories` parameter to make external directories ACCESSIBLE
|
||||||
- Example: `cd src/auth && gemini -p "..." --include-directories ../shared,../config`
|
- **Step 2**: Explicitly reference external files in CONTEXT field with @ patterns
|
||||||
- After adding, @ patterns can then match files in included directories
|
- **⚠️ BOTH steps are MANDATORY** - missing either step will fail
|
||||||
- Without `--include-directories`, parent/sibling files are INVISIBLE to @ patterns
|
- Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-directories ../shared`
|
||||||
|
- **Rule**: If CONTEXT contains `@../dir/**/*`, command MUST include `--include-directories ../dir`
|
||||||
|
- Without `--include-directories`, @ patterns CANNOT access parent/sibling directories at all
|
||||||
|
|
||||||
#### Multi-Directory Support (Gemini & Qwen)
|
#### Multi-Directory Support (Gemini & Qwen)
|
||||||
|
|
||||||
@@ -254,7 +256,7 @@ cd src/auth && gemini -p "
|
|||||||
PURPOSE: Analyze authentication with shared utilities context
|
PURPOSE: Analyze authentication with shared utilities context
|
||||||
TASK: Review auth implementation and its dependencies
|
TASK: Review auth implementation and its dependencies
|
||||||
MODE: analysis
|
MODE: analysis
|
||||||
CONTEXT: @**/* (includes current dir + shared + types directories)
|
CONTEXT: @**/* @../shared/**/* @../types/**/*
|
||||||
EXPECTED: Complete analysis with cross-directory dependencies
|
EXPECTED: Complete analysis with cross-directory dependencies
|
||||||
RULES: Focus on integration patterns
|
RULES: Focus on integration patterns
|
||||||
" --include-directories ../shared,../types
|
" --include-directories ../shared,../types
|
||||||
@@ -262,11 +264,13 @@ RULES: Focus on integration patterns
|
|||||||
|
|
||||||
**Best Practices**:
|
**Best Practices**:
|
||||||
- **Recommended Pattern**: Use `cd` to navigate to primary focus directory, then use `--include-directories` for additional context
|
- **Recommended Pattern**: Use `cd` to navigate to primary focus directory, then use `--include-directories` for additional context
|
||||||
- Example: `cd src/auth && gemini -p "..." --include-directories ../shared,../types`
|
- Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-directories ../shared,../types`
|
||||||
|
- **⚠️ CRITICAL**: CONTEXT must explicitly list external files (e.g., `@../shared/**/*`), AND command must include `--include-directories ../shared`
|
||||||
- Benefits: More precise file references (relative to current directory), clearer intent, better context control
|
- Benefits: More precise file references (relative to current directory), clearer intent, better context control
|
||||||
|
- **Enforcement Rule**: When CONTEXT references external directories, ALWAYS add corresponding `--include-directories`
|
||||||
- Use when `cd` alone limits necessary context visibility
|
- Use when `cd` alone limits necessary context visibility
|
||||||
- Keep directory count ≤ 5 for optimal performance
|
- Keep directory count ≤ 5 for optimal performance
|
||||||
- Combine with specific file patterns in CONTEXT for precision
|
- **Pattern matching rule**: `@../dir/**/*` in CONTEXT → `--include-directories ../dir` in command (MANDATORY)
|
||||||
- Prefer `cd + --include-directories` over multiple `cd` commands for cross-directory analysis
|
- Prefer `cd + --include-directories` over multiple `cd` commands for cross-directory analysis
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user