feat: 增加文件模式参考和复杂模式发现的示例,增强 CLI 命令的文档

This commit is contained in:
catlog22
2025-10-05 10:26:08 +08:00
parent 7d9adf5a55
commit a9d6de228e
7 changed files with 291 additions and 34 deletions

View File

@@ -100,6 +100,39 @@ RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Focus on session managemen
- **Targeted Solutions**: Minimal, specific fixes
- **Impact Assessment**: Side effect evaluation
## File Pattern Reference
### Common Patterns
- All files: `@{**/*}`
- Source files: `@{src/**/*}`
- TypeScript: `@{*.ts,*.tsx}`
- JavaScript: `@{*.js,*.jsx}`
- Python: `@{*.py}`
- With docs: `@{CLAUDE.md,**/*CLAUDE.md}`
- Tests: `@{**/*.test.*,**/*.spec.*}`
### Complex Pattern Discovery
For bug investigation, use semantic discovery to find relevant code:
```bash
# Step 1: Find bug-related files
rg "error_keyword|exception_pattern" --files-with-matches
mcp__code-index__search_code_advanced(pattern="throw|catch|error", file_pattern="*.ts")
# Step 2: Trace error propagation path
# Identify: origin → propagation → handler
# Step 3: Execute bug analysis with focused context
cd src && ~/.claude/scripts/gemini-wrapper --all-files -p "
PURPOSE: Debug null pointer error in authentication
TASK: Identify root cause and provide fix
MODE: analysis
CONTEXT: @{CLAUDE.md,auth/service.ts,middleware/auth.ts}
EXPECTED: Root cause, execution trace, minimal fix
RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Bug: null pointer in token validation
"
```
## Session Output
**Location**: `.workflow/WFS-[topic]/.chat/bug-index-[timestamp].md`