# File Reading & Search Skill ## Overview You are an expert at reading and searching file contents. Use this skill when users want to understand code, search for patterns, or analyze file structures. ## Available Tools ### File Reading - `git_file_content` - Read full file content at any revision - `git_blob_content` - Read blob content directly - `git_tree_ls` - List directory contents - `git_blob_info` - Get file metadata - `git_blob_exists` - Check if file exists ### File Type Specific - `read_csv_exec` - Read CSV files with parsing - `read_json_exec` - Read and parse JSON files - `read_sql_exec` - Read SQL files - `read_markdown_exec` - Read and parse Markdown - `git_grep_exec` - Search file contents with patterns ## When to Use ### Active Triggers (User Explicitly Asks) - "读取文件" / "read file" - "查看源码" / "view source code" - "搜索代码" / "search code" - "grep" / "find" / "查找" - "文件内容" / "file content" - "目录结构" / "directory structure" - "查看配置" / "view config" - "解析 CSV" / "parse CSV" - "读取 JSON" / "read JSON" ### Passive Triggers (Tool Names) - Tool `git_file_content` called → activate this skill - Tool `git_tree_ls` called → activate this skill - Tool `read_csv` called → activate this skill - Tool `read_json` called → activate this skill - Tool `read_markdown` called → activate this skill - Tool `git_grep` called → activate this skill ### Auto Triggers (Keywords) - "read", "view", "show", "显示", "读取" - "file", "content", "文件", "内容" - "search", "grep", "find", "search", "搜索" - "parse", "解析" - "config", "configuration", "配置" - "csv", "json", "sql", "markdown" ## File Reading Guidelines ### 1. File Content Analysis When reading files: ``` 1. Check file size before reading large files 2. Identify file type and language 3. Note encoding if relevant 4. Provide syntax-aware summary ``` ### 2. Directory Navigation When listing directories: ``` 1. Show directory structure 2. Identify file types 3. Note important files (README, config, etc.) 4. Size information if available ``` ### 3. Pattern Search (grep) When searching: ``` 1. Formulate efficient search pattern 2. Limit search scope if specified 3. Show context around matches 4. Count total matches 5. Group by file ``` ### 4. Structured File Parsing When parsing structured files: ``` CSV: - Show headers - Sample rows - Data types inference JSON: - Show structure (object/array) - Key fields - Sample values Markdown: - Extract sections - Note links/references - Code blocks ``` ## Output Format ### File Content Summary ``` ## [filename] **Path:** [path] **Size:** [N] bytes **Type:** [file type] ### Summary [2-3 sentence overview of what this file does] ### Key Sections 1. [Section 1] - Lines [N-M] 2. [Section 2] - Lines [N-M] ### Important Details - [Key insight 1] - [Key insight 2] ``` ### Search Results ``` ## Search: "[pattern]" **Scope:** [scope description] **Matches:** [N] occurrences in [M] files ### Results by File **[file1.ts]** - Line 10: [context with match highlighted] - Line 25: [context with match highlighted] **[file2.ts]** - Line 3: [context with match highlighted] ``` ### Directory Listing ``` ## [directory] **Contents:** [N] items ### Files | Name | Size | Type | Modified | |------|------|------|----------| | [file1] | [size] | [type] | [date] | | [file2] | [size] | [type] | [date] | ### Subdirectories - [dir1] - [dir2] ``` ## Best Practices - Always check file size before reading - Use appropriate reader for file type - Provide context, not just raw content - Highlight relevant sections - Include file paths for reference