replace
แทนที่เนื้อหาในไฟล์หรือโค้ดด้วย regex หรือ AST-based patterns
SKILL.mdreplace/SKILL.md
GitHubGoal
Replace content in files or code correctly and safely
Scope
Use replace to replace content in files or code, choosing the method by the nature of the task:
Plain text / regex replacement: for general content such as docs, config
AST-based replacement: for code that needs high precision
See also: /use-astgrep
Execute
1. Identify Content To Replace
Goal: Identify the content to be replaced
- SEARCH for the content x to be replaced
- MARK the location to be replaced
- PREPARE the content y that will replace it
- If it is a code replacement → run the
/use-astgrepprogrammatic workflow to find patterns with AST
2. Execute Replacement
Goal: Perform the content replacement
- If it is plain text or regex → use
editorwriteto replace - If it is complex code or needs precision → use the
/use-astgrepprogrammatic workflow for AST-based rewrite - REPLACE x with y in the specified file or code
- VERIFY that the replacement is correct
- CHECK that there are no side effects from the replacement
3. Update References
Goal: Update references after replace
- If the replacement changes an identifier, path, or skill name → run
/update-references - Run
/review-devin-global-harnessor/deep-validateto check
Rules
- Use the
/use-astgrepprogrammatic workflow when replacing in source code to avoid false positives - Use the
/use-astgrepprogrammatic workflow when batch replacing multiple files or integrating with scripts - Follow the project conventions and global rules (replace)
- Use the allowed tools only when needed
Expected Outcome
- The content to be replaced is replaced correctly
- No broken references
- No unwanted side effects