merge
merge ไฟล์หรือ folder เข้าด้วยกันและลบ source เดิม
SKILL.mdmerge/SKILL.md
GitHubGoal
merge ไฟล์หรือโฟลเดอร์ต้นทางเข้าด้วยกันเป็นไฟล์หรือโฟลเดอร์ปลายทางเดียว แล้วลบ source เดิม
Scope
ใช้เมื่อต้องรวมเนื้อหาจากหลายไฟล์หรือหลายโฟลเดอร์เข้าด้วยกัน และลบ source หลัง merge — หรือเมื่อต้องการ merge git branch/PR ตาม domain
git-branch→ merge feature branch เข้า target branch ด้วย--no-ffgithub-pr→ merge pull request ด้วย strategy ที่เหมาะสมall-branch-by-me-to-main→ merge ทุก branch ที่ user สร้างเข้าmainแล้วลบ branch
Execute
1. Identify Sources And Destination
Goal: รู้ว่าอะไรคือ source และ destination
- รับ
@filesเป็นรายการ source (ไฟล์หรือ folder) จาก argument หรือ context - รับ
destinationจาก prompt หรือ context - source อาจเป็นไฟล์หรือ folder หลายรายการ
- destination อาจเป็นไฟล์ใหม่ ไฟล์เดิม หรือ folder เป้าหมาย
- ถ้าไม่มี
@files→ ทำ/ask-meเพื่อขอรายการ source - ถ้าไม่ชัดเจน → ทำ
/ask-meก่อนดำเนินการ
2. Analyze Sources
Goal: เข้าใจเนื้อหาก่อน merge
- ทำ
/read-all-filesกับแต่ละ source ก่อน — อ่าน content ทั้งหมดเข้า context (concat ไฟล์ที่เกี่ยวข้อง, engine:/check-file-relation) แล้วค่อยทำ/deep-analyze— ห้ามวิเคราะห์จากชื่อไฟล์อย่างเดียว - ถ้า source เป็นโฟลเดอร์ →
/read-all-filesครอบคลุมทุกSKILL.mdหรือไฟล์หลักในโฟลเดอร์ - บันทึกโครงสร้าง ความสัมพันธ์ และสิ่งทีซ้ำซ้อน
3. Plan Merge
Goal: วางแผนการ merge อย่างปลอดภัย
- ทำ
/applymodevalidateเพื่อ validate ก่อน merge - ระบุ references ทีอ้างอิงถึง source
- วางแผนการ update references ไปยัง destination
- ถ้ามี references ซับซ้อน → ทำ
/update-referencesล่วงหน้า
4. Merge Content
Goal: รวม source เข้าด้วยกันอย่างถูกต้อง
- ถ้า source เป็นไฟล์ → อ่าน content ทั้งหมดแล้ว merge เข้า destination
- ถ้า source เป็นโฟลเดอร์ → รวบรวมไฟล์สำคัญ ลบ redundancy แล้ว merge เนื้อหา
- ใช้
git mvหรือgit rmถ้าอยู่ใน git repo - ตรวจสอบว่า merge ถูกต้องและไม่มี data loss
5. Delete Old Sources
Goal: ลบ source เดิมหลัง merge
- ลบไฟล์หรือโฟลเดอร์ source เดิมหลัง merge สำเร็จ
- ใช้
git rm -rสำหรับโฟลเดอร์ หรือgit rmสำหรับไฟล์ - ตรวจสอบว่าไม่มี references เก่าเหลือถ้า source ถูก reference
6. Update References
Goal: ไม่ให้มี broken references จาก source ทีถูกลบ
- ทำ
/update-referencesเพื่ออัปเดตทุก skills ทีอ้างอิงถึง source - ทำ
/edit-relativeเมื่อ merge กระทบ relative paths, imports, markdown links หรือ semantic references (skill names,relatedlists) ของไฟล์อื่น — ครอบคลุมทั้ง path-level และ symbol-level updates - ตรวจหา skills ที่เกี่ยวกับ file ops (
move-to,rename,all-this-patterns,edit-only,refactor,flatten-directory) และอัปเดต references ให้ชี้ไป destination - ใช้
grepตรวจซ้ำเพื่อหา reference เก่าทีหลงเหลือ
7. Validate
Goal: ตรวจสอบความถูกต้อง
- ทำ
/deep-validateเพื่อตรวจ merge - ตรวจหา broken references
- ตรวจ data loss
- ทำ
/report tableสรุป:No.,Source,Destination,Status,Notes - ถ้ามีหลาย step ค้าง → ทำ
/report-progress
Skills
Goal: dispatch ไป skill ปลายทาง ตาม domain เมื่อ merge เป็น git branch/PR workflow
| Domain | Skill |
|---|---|
github-pr |
/merge-github-pr — merge PR ด้วย strategy ที่เหมาะสม |
all-branch-by-me-to-main |
/merge-all-branch-by-me-to-main — merge ทุก branch ของ user เข้า main |
- ถ้า argument ตรง domain ในตาราง → อ่าน
/merge-<domain>แล้วทำตาม flow ในนั้น — ไม่ execute จากตารางนี้โดยตรง - ถ้าเป็น
@filesmerge → ทำตาม step 1-7 ด้านบน
Rules
- ตรวจสอบ merge ถูกต้องก่อนลบ source
- รองรับทั้งไฟล์และโฟลเดอร์เป็น source
- ใช้ git สำหรับ file operations ถ้าเป็นไปได้
- ถ้ามี references ชี้ไปยัง source → ทำ
/update-referencesก่อนลบ - ถ้าต้องตัดสินใจระหว่างหลายตัวเลือก → ทำ
/deep-validateแล้วเลือกสิ่งทีดีทีสุด - ทุก merge ต้องผ่าน
/applymodevalidateก่อน
Expected Outcome
- ไฟล์หรือโฟลเดอร์ถูก merge เข้าด้วยกัน
- source เดิมถูกลบ
- ไม่มี data loss
- ไม่มี broken references