| name | code-editor |
| description | Efficient code editing workflow with parallel strategies. Invoke when user needs to edit multiple files, refactor code, or perform batch modifications. |
Code Editor Skill
This skill provides an efficient code editing workflow with parallel strategies for handling multiple file modifications.
When to Invoke
- User needs to edit multiple files simultaneously
- User requests code refactoring across multiple modules
- User wants to perform batch modifications
- User asks for efficient code editing workflow
Core Principles
1. Parallel Read Strategy
ALWAYS read multiple files in a single tool call batch:
✅ CORRECT: Send one message with multiple Read tool calls
❌ WRONG: Send multiple messages, each with one Read call
Example:
<function_calls>
<Read file_path="path/to/file1.ts" />
<Read file_path="path/to/file2.ts" />
<Read file_path="path/to/file3.ts" />
</function_calls>
2. Batch Edit Strategy
Group related edits and apply them efficiently:
- Use
SearchReplace for targeted modifications
- Apply multiple edits in a single response when files are independent
- For dependent edits, apply sequentially but minimize context switches
3. Edit-Then-Verify Workflow
After completing edits:
- Run Build:
npm run build
- Run Type Check:
npx tsc --noEmit
- Report Results: Summarize what was changed and verification status
Workflow Steps
Step 1: Analysis Phase
- Identify all files that need modification
- Understand the relationship between files (dependencies)
- Plan the order of modifications (independent first, dependent later)
Step 2: Read Phase
Read ALL relevant files in ONE batch:
Read file1.ts, file2.ts, file3.ts, file4.ts (parallel)
Step 3: Edit Phase
For independent files:
- Apply edits to all independent files in one response batch
For dependent files:
- Edit base files first
- Then edit files that depend on them
Step 4: Verification Phase
- Run build command
- Run type check
- Report any errors found
Best Practices
SearchReplace Usage
- Always include enough context in
old_str to uniquely identify the target
- Keep
old_str and new_str concise but complete
- Include surrounding lines for context when needed
Avoiding Common Mistakes
- Don't read files one by one - batch read instead
- Don't make assumptions - read the actual code first
- Don't skip verification - always run build/typecheck after edits
- Don't forget dependencies - check imports and related files
Handling Large Refactors
For large-scale refactoring:
- Create a todo list to track progress
- Group files by module/feature
- Edit one group at a time
- Verify after each group
- Move to next group only after verification passes
Error Recovery
If build/typecheck fails:
- Read the error messages carefully
- Identify the root cause
- Fix the specific issue
- Re-run verification
- Do not proceed until errors are resolved
Output Format
After completing edits, provide:
## Edit Summary
| File | Changes | Status |
|------|---------|--------|
| file1.ts | Description | ✅ |
| file2.ts | Description | ✅ |
## Verification
- Build: ✅ Passed
- TypeCheck: ✅ Passed (or list errors)
PowerShell Notes
When running commands in PowerShell:
- Use
; as command separator, NOT &&
- Use single quotes for commit messages with special characters
- Example:
npm run build; npm run test