gitdataai/libs/agent/skills/templates/file-reader.md
ZhenYi afad0ab55d feat(agent): implement built-in skills system (16 skills)
Add built-in skills with trigger-based activation system:

Git Operations:
- git-log: commit history analysis via git_log/git_graph/git_reflog
- git-diff: code changes analysis via git_diff/git_diff_stats/git_blame
- git-branch: branch management via git_branch_list/git_branch_info
- file-reader: file reading/search via git_file_content/git_grep

Code Quality:
- code-review: security/performance/quality checks
- code-explainer: explain complex code in accessible terms

Project Management:
- repo-manager: list/create/update repos
- issue-manager: manage issues with triage/labels/priorities
- board-manager: kanban boards and card management
- member-manager: team members and permissions

Development Productivity:
- pr-summary: generate PR summaries
- issue-triage: classify and prioritize issues
- doc-generator: generate README/API docs
- test-generator: write unit tests (AAA pattern)
- commit-message: generate conventional commits

Utilities:
- http-requester: HTTP requests and API testing

Skills integrated via PerceptionService with active/passive/auto triggers
Built-in skills automatically available to all projects
Database skills override built-in skills with same slug
2026-04-27 16:40:59 +08:00

3.6 KiB

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