file_reader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

File Reader Toolbox

文件读取工具箱

Use this skill when the user asks to read or summarize local text-based files. PDFs, Office documents, images, audio, and video are out of scope for this skill and should be handled by their dedicated skills/tools.
当用户要求读取或总结本地基于文本的文件时使用此skill。PDF、Office文档、图片、音频、视频不属于此skill的处理范围,需由对应的专属skill/工具处理。

Quick Type Check

快速类型检查

Use a type probe before reading:
bash
file -b --mime-type "/path/to/file"
If the file is large, avoid dumping the whole content; extract a small, relevant portion and summarize.
读取前先进行类型探测:
bash
file -b --mime-type "/path/to/file"
如果文件体积较大,不要导出全部内容;提取相关的小部分内容再做总结。

Text-Based Files (use read_file)

基于文本的文件(使用read_file)

Preferred for:
.txt
,
.md
,
.json
,
.yaml/.yml
,
.csv/.tsv
,
.log
,
.sql
,
ini
,
toml
,
py
,
js
,
html
,
xml
source code.
Steps:
  1. Use
    read_file
    to fetch content.
  2. Summarize key sections or show the relevant slice requested by the user.
  3. For JSON/YAML, list top-level keys and important fields.
  4. For CSV/TSV, show header + first few rows, then summarize columns.
优先处理以下格式:
.txt
.md
.json
.yaml/.yml
.csv/.tsv
.log
.sql
ini
toml
py
js
html
xml
等源代码文件。
步骤:
  1. 使用
    read_file
    获取内容。
  2. 总结关键部分,或展示用户要求的相关片段。
  3. 对于JSON/YAML,列出顶层键和重要字段。
  4. 对于CSV/TSV,展示表头+前几行,再对列进行总结。

Large Logs

大型日志文件

If the file is huge, use a tail window:
bash
tail -n 200 "/path/to/file.log"
Summarize the last errors/warnings and notable patterns.
如果文件非常大,使用tail命令获取末尾片段:
bash
tail -n 200 "/path/to/file.log"
总结最近的错误/警告以及值得注意的模式。

Out of Scope

处理范围外内容

Do not handle the following in this skill (they are covered by other skills):
  • PDF
  • Office (docx/xlsx/pptx)
  • Images
  • Audio/Video
不要在本skill中处理以下内容(由其他skill负责处理):
  • PDF
  • Office (docx/xlsx/pptx)
  • 图片
  • 音频/视频

Safety and Behavior

安全与行为规范

  • Never execute untrusted files.
  • Prefer reading the smallest portion necessary.
  • If a tool is missing, explain the limitation and ask the user for an alternate format.
  • 永远不要执行不受信任的文件。
  • 优先读取所需的最小内容片段。
  • 如果缺少对应工具,说明限制并要求用户提供其他格式的文件。