update-text-file
Update Text File
Input Parameters
| Parameter | Required | Description | Example |
|---|---|---|---|
file_path |
Yes | Path to the text file to update | ~/Downloads/poem.txt |
update_type |
No | Type of update: 'add' (append content), 'expand' (add to existing), 'replace' (full rewrite), or 'edit' (modify specific sections) | expand |
new_content |
Yes | The new or additional content to write to the file | With wisdom guiding every choice... |
Procedure
- Locate the target file using
findcommand with common text file extensions (.txt, .md, .doc, etc.) or search by filename pattern - Display current file contents using
catto understand what needs to be updated - Ask user for clarification on desired changes if not explicitly provided (use
ask_user) - Write updated content to the file using
cat > {{FILE_PATH}} << 'EOF'syntax, preserving the original file location - Verify the update by displaying the new file contents with
cat {{FILE_PATH}} - Confirm successful update to the user with a summary of changes made
Output
Updated text file saved to original location with confirmation message showing what was changed. File contents displayed to user for verification.
Reference Commands
find {{DIRECTORY}} -maxdepth 2 -type f \( -name "*.txt" -o -name "*.md" \)
cat {{FILE_PATH}}
cat > {{FILE_PATH}} << 'EOF'
{{NEW_CONTENT}}
EOF
Example
update the poem in my Downloads folder
edit the notes file and add more details
revise the document with new content
modify the text file to include additional paragraphs
update the markdown file in my home directory
Notes
- Always display the original file contents before making changes to understand context
- Use heredoc syntax (cat > file << 'EOF') to safely write multi-line content
- Preserve the original file location and path
- Verify changes by displaying updated contents after writing
- Ask for clarification if update intent is ambiguous
More from dalehurley/phpbot
desktop-control
Control the mouse, keyboard, and read screen content via accessibility. Use this skill when the user asks to click somewhere on screen, type text into an app, move the mouse, press keyboard shortcuts, read what's on screen, get the accessibility tree of the current window, automate desktop interactions, or control the computer.
39summarize-unread-emails
Retrieve and summarize all unread emails from your inbox, organized by category, sender, and date. Use this skill when the user asks to summarize unread emails, get an overview of unread messages, organize inbox emails, or review pending email communications. Provides a structured summary with categorization and timeline analysis.
20homebrew
Install, manage, and search for software packages on macOS using Homebrew. Use this skill when the user asks to install software, apps, CLI tools, developer utilities, programming languages, databases, or any package on a Mac. Supports formulae (CLI tools) and casks (GUI apps). Can also search, update, upgrade, uninstall, and diagnose Homebrew issues.
11open-application
Open or launch applications on your computer by name. Use this skill when the user asks to open, launch, or start an application like Mail, Finder, Safari, Chrome, or any other installed macOS application. Works with both built-in and third-party applications.
10csv-tools
Parse, query, filter, sort, transform, and summarize CSV and JSON data files. Use this skill when the user asks to view a CSV, filter data, get statistics from a data file, convert CSV to JSON or vice versa, sort data, or analyze tabular data.
9get-weather-forecast
Retrieve current weather conditions and multi-day forecasts for any location using the wttr.in API. Use this skill when the user asks for weather information, weather forecast, current conditions, temperature, or weather updates for a specific city or location. Provides detailed weather data including temperature, wind, precipitation, and visibility.
8