iterative-file-refinement
Read a file once, then make multiple sequential edits to refine its contents.
Iterative File Refinement
This skill describes a common pattern for refining file contents through multiple focused edits.
When to Use
- You need to make several related changes to a single file
- Each edit builds on the previous one or addresses different aspects
- You want to review the full file context before making changes
Steps
- Read the target file - Start by reading the complete file to understand its current state and structure
- First edit - Make your first set of changes based on the initial context
- Second edit - Apply additional refinements, which may depend on or complement the first edit
- Third edit - Continue with further improvements or corrections
Tips
- Read the entire file once at the start to establish full context
- Keep each edit focused on a specific change or improvement
- Let the file content from the Read guide your understanding of what needs to be edited
- Each Edit can reference different sections; you've already seen the whole file
- This pattern is efficient because it reads the file once and makes all necessary changes through sequential edits
- If you need to make many more edits, consider whether you should read again to verify current state
Example Use Cases
- Refactoring code: Read → extract function → update imports → fix references → optimize
- Writing content: Read → fix grammar → improve clarity → enhance structure
- Configuration: Read → update values → fix formatting → add comments