Files
Claude-Code-Workflow/.claude/workflows/context-search-strategy.md
catlog22 8073549234 docs: Optimize skill-memory.md structure and add Skill() to context search strategy
## skill-memory.md Optimization
- Restructured file from 553 to 534 lines (-19 lines, -3.4%)
- Eliminated duplicate content in 3 areas:
  * Auto-Continue mechanism (3 occurrences → 1)
  * Execution flow descriptions (2 occurrences → 1)
  * Phase 4 never-skip notes (2 occurrences → 1)
- Merged "TodoWrite Pattern" and "Auto-Continue Execution Flow" into unified "Implementation Details" section
- Improved hierarchy: Overview → Execution → Implementation Details → Parameters → Examples
- Added Example 5 demonstrating Skip Path usage
- All content preserved, no information loss

## context-search-strategy.md Enhancement
- Added Skill() as highest priority tool in Core Search Tools (1 line)
- Emphasized: "FASTEST way to get project context - use FIRST if SKILL exists (higher priority than CLI analysis)"
- Added to Tool Selection Matrix: "FASTEST context loading - use FIRST if SKILL exists"
- Added Quick Command Reference with intelligent auto-trigger emphasis
- Total addition: 3 lines as requested

## Benefits
- Clearer file structure with eliminated redundancy
- Skill() now prominently featured as first-priority context tool
- Intelligent auto-trigger mechanism emphasized
- Consistent messaging across documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:28:27 +08:00

2.7 KiB

name, description, type
name description type
context-search-strategy Strategic guidelines for context search commands search-guideline

Context Search Strategy

Execution Environment

CRITICAL: All commands execute in Bash environment (Git Bash on Windows)

Forbidden: Windows commands (findstr, dir, where) - Use Bash (grep, find, cat)

Core Search Tools

Skill(): FASTEST way to get project context - use FIRST if SKILL package exists (higher priority than CLI analysis) codebase-retrieval: Semantic file discovery via Gemini CLI with all files analysis rg (ripgrep): Fast content search with regex support find: File/directory location by name patterns grep: Built-in pattern matching (fallback when rg unavailable) get_modules_by_depth.sh: Program architecture analysis (MANDATORY before planning)

📋 Tool Selection Matrix

Need Tool Use Case
Project understanding Skill() FASTEST context loading - use FIRST if SKILL exists
Semantic discovery codebase-retrieval Find files relevant to task/feature context
Pattern matching rg Search code content with regex
File name lookup find Locate files by name patterns
Architecture get_modules_by_depth.sh Understand program structure

🔧 Quick Command Reference

# SKILL Package (FIRST PRIORITY - fastest way to get project context)
Skill(command: "skill_name")  # Intelligent auto-trigger by task context - use FIRST if SKILL exists

# Semantic File Discovery (codebase-retrieval)
cd [directory] && gemini -p "
PURPOSE: Discover files relevant to task/feature
TASK: List all files related to [task/feature description]
MODE: analysis
CONTEXT: @**/*
EXPECTED: Relevant file paths with relevance explanation
RULES: Focus on direct relevance to task requirements
"

# Program Architecture (MANDATORY before planning)
~/.claude/scripts/get_modules_by_depth.sh

# Content Search (rg preferred)
rg "pattern" --type js -n        # Search JS files with line numbers
rg -i "case-insensitive"         # Ignore case
rg -C 3 "context"                # Show 3 lines before/after

# File Search
find . -name "*.ts" -type f      # Find TypeScript files
find . -path "*/node_modules" -prune -o -name "*.js" -print

# Workflow Examples
rg "IMPL-\d+" .workflow/ --type json                    # Find task IDs
find .workflow/ -name "*.json" -path "*/.task/*"        # Locate task files
rg "status.*pending" .workflow/.task/                   # Find pending tasks

Performance Tips

  • rg > grep for content search
  • Use --type filters to limit file types
  • Exclude dirs: --glob '!node_modules'
  • Use -F for literal strings (no regex)