rewrite
rewrite ไฟล์หรือหลายไฟล์ใหม่ทั้งหมดโดยไม่อ้างอิง context ก่อนหน้า
SKILL.mdrewrite/SKILL.md
GitHubGoal
Rewrite one or more files completely from scratch, without referencing prior context, and deliver complete content
Scope
Use when the user asks to rewrite a file or several files, wanting all content written fresh from an empty slate
Execute
1. Reset Context
Goal: Reset Context
Start with /reset-context to clear prior context
- Invoke
/reset-contextbefore every edit - Do not reference conclusions, analyses, or decisions from earlier conversations
- Treat the target files as new files that must be written from scratch
2. Identify Targets
Goal: Identify Targets
Clearly identify the files to rewrite
- Ask or determine target files from the user request
- Use
scan-codebaseto find related files - Check the dependencies and references of the target files
3. Read Targets Fresh
Goal: Read Targets Fresh
Read the target files and all references anew
- Read each target file in full
- Read imports, exports, and dependencies
- Read reverse dependencies
- Run
review-devin-global-harnessfor related workflows
4. Analyze Requirements
Goal: Analyze Requirements
Analyze all requirements anew
- Identify what each file does
- Identify public APIs, interfaces, and contracts
- Identify standards, conventions, and best practices to preserve
- Run
follow-best-practicefor related topics
5. Rewrite From Scratch
Goal: Rewrite From Scratch
Write each file completely from an empty slate
- Do not merge or append with the old content
- Do not reference prior context
- Use
writeto overwrite the original file with new content - If there are many files, use
use-scriptsfor automation - Run
update-referencesif file names or paths change
6. Validate
Goal: Validate
Check the results
- Run
/deep-validateto verify correctness - Run
run-verifyto execute lint, typecheck, and scan - Read the new files again to verify
Rules
1. Always Reset Context
- Always invoke
/reset-contextbefore every rewrite - Never reference conclusions or analysis from earlier conversations
- Never assume the original code is correct
2. Full Rewrite
- Files are written completely from scratch, never merged with old content
- Never copy-paste from the old content without review
- Never leave unused old sections behind
3. Evidence-Based
- Every decision must be based on the actual files read fresh
- Every assumption must have evidence
- Do not guess from context or memory
4. Preserve Contracts
- Preserve the public APIs and interfaces the user specified
- Preserve file paths and naming conventions
- If a contract must change, run
update-referencesto update all references
5. Complete Delivery
- All files must be complete, with no unnecessary TODO, MOCK, or STUB
- Verify that all references actually exist
- Run
run-verifybefore delivery
Expected Outcome
- Target files are fully rewritten from scratch
- No stale context influenced the decisions
- New content matches the current requirements
- Passes validation and run-verify
- All references updated correctly