file-operations
This skill provides fundamental file system operations for AI agents, enabling them to interact with files and directories in a controlled manner.
Capabilities
This skill enables the following operations:
Read Operations
- •Read file contents: Retrieve the full contents of a text file
- •Read file lines: Get specific lines or line ranges from a file
- •List directory contents: Enumerate files and subdirectories
- •Check file existence: Verify if a file or directory exists
- •Get file metadata: Retrieve size, permissions, modification time
Write Operations
- •Create files: Create new files with specified content
- •Append to files: Add content to existing files without overwriting
- •Update files: Replace existing file contents
- •Create directories: Make new directories with proper permissions
- •Copy files: Duplicate files to new locations
- •Move files: Relocate files to different paths
- •Delete files: Remove files (with safety checks)
Safety Features
- •Path validation to prevent directory traversal attacks
- •Confirmation required for destructive operations
- •Automatic backup before overwriting files
- •Size limits to prevent resource exhaustion
- •Permission checks before operations
Limitations
- •Cannot access files outside the designated workspace
- •Maximum file size: 10MB for read operations
- •Binary files are read as base64-encoded strings
- •No support for symbolic links or special files
- •Cannot modify system files or protected directories
Usage Examples
Example 1: Reading a Configuration File
User Request: "Read the config.json file and show me its contents"
Agent Actions:
- •Validate the file path
config.json - •Check if file exists
- •Read file contents
- •Parse JSON and present to user
Example 2: Creating a New File
User Request: "Create a new README.md file with a project description"
Agent Actions:
- •Prepare content based on user description
- •Validate filename
README.md - •Check if file already exists (warn if it does)
- •Write content to new file
- •Confirm creation to user
Example 3: Organizing Files
User Request: "Move all .log files to the logs directory"
Agent Actions:
- •List all files in current directory
- •Filter for .log extension
- •Check if logs directory exists (create if needed)
- •For each .log file:
- •Move to logs directory
- •Track results
- •Report summary of operations
Error Handling
The skill should handle these error scenarios:
- •File not found: Provide clear message with suggested similar filenames
- •Permission denied: Explain the issue and suggest alternative approaches
- •Disk full: Warn about space issues before attempting writes
- •Invalid paths: Sanitize and validate all path inputs
- •Encoding errors: Detect and handle different file encodings
Security Considerations
When implementing this skill:
- •Validate all paths to prevent directory traversal
- •Implement size limits to prevent DoS attacks
- •Require confirmation for destructive operations
- •Log all operations for audit trail
- •Use least privilege when accessing files
- •Sanitize file names to prevent injection attacks
Integration Notes
This skill should be combined with:
- •Text Processing Skill: For analyzing file contents
- •Search Skill: For finding files by content or metadata
- •Backup Skill: For creating backups before modifications
- •Validation Skill: For checking file formats and content
Version History
- •1.0.0 (2026-01-16): Initial version with core file operations