file-operations

Reads, writes, searches, and edits workspace files using dedicated file tools.

3|Updated Jun 29, 2026
One-click install
npx skills add https://github.com/ruskicoder/system-prompts --skill file-operations-ruskicoder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: file-operations
Source: https://github.com/ruskicoder/system-prompts/tree/main/prompt-orchestrator/.opencode/skills/file-operations
Command: npx skills add https://github.com/ruskicoder/system-prompts --skill file-operations-ruskicoder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI agents often waste tokens and introduce errors when handling files through shell commands or imprecise edits. This Skill enforces disciplined file operations—batch reads, exact SEARCH/REPLACE edits, and tool-based discovery—so file changes are accurate and efficient. ## Core Features & Use Cases - READ-BEFORE-WRITE enforcement: Always read files before editing, with batch reads via readMultipleFiles to minimize roundtrips. - Atomic SEARCH/REPLACE edits: Requires exact character-for-character matching with 2-5 lines of surrounding context to guarantee unique, safe edits. - Tool-based discovery: Uses grep, glob, and listDirectory instead of shell commands like find or cat for locating files and content. - Use Case: When refactoring a function across a codebase, use grep to locate all usages, batch-read the affected files, then apply precise context-anchored edits and verify with lint checks. ## Quick Start Ask the agent to find all files containing a specific function name, read them in batch, and rename the function using exact search-and-replace edits.

Frequently Asked Questions about file-operations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I edit files safely with an AI coding agent?▼

Use SEARCH/REPLACE edits where the oldString matches the file exactly, character for character, including whitespace. Include 2-5 lines of surrounding context so the match is unique, and break large edits into smaller focused blocks.

How to search for files and content in a codebase with AI tools?▼

Use glob or fileSearch when you know part of the filename, and grep or grepSearch for content patterns with regex. Avoid shell commands like find, grep, or cat—dedicated tools are faster and capped at 50 results.

Why does my search-and-replace edit fail to apply?▼

Edits fail when the oldString does not match the file exactly, including indentation and line breaks. Re-read the file first, copy the exact text with surrounding context, and retry with a unique match.

Should I read files one at a time or in batch?▼

Batch related files in a single readMultipleFiles call to minimize roundtrips and token overhead. For files over 500 lines, read in chunks with offset and limit, preferring large meaningful sections over many small reads.

What are the limitations of partial writes for large files?▼

The keep-existing-code marker pattern only works when the tooling explicitly supports it, as with Lovable. Otherwise, use write for full rewrites or append for additions, and split files over 50 lines into write plus follow-up appends.