SuperAPI AI Directory

file_operations

General & other

View repository

Updated 11-01 07:27

About this skill

File Operations

A set of tools for reading, writing, and inspecting files within the workspace.

Tools

  • read_file — Read file contents by path.
  • write_file — Write or overwrite a file.
  • list_directory — List directory contents.
  • file_exists — Check whether a file or directory exists.

Examples

Read a file:

read_file(path="src/main.py")

Write a file:

write_file(path="output/report.md", content="# 报告\n\n内容...")

List directory contents:

list_directory(path="src/")

Check existence before reading:

file_exists(path="config.yaml")

Tips

  • Always use relative paths, based on the workspace root directory.
  • Check before reading: For files whose existence is uncertain, first use file_exists to check.
  • Do not read binary files(images, PDFs, etc.), as they cannot be presented as text.
  • Always confirm the path when writing, to avoid accidentally overwriting important files.