Chuyển đến nội dung
Skillpedia
Lập trình chung40k · #7395

refactor-plan

Skill này làm gì

Agent này tạo một kế hoạch chi tiết trước khi thay đổi nhiều tệp mã. Nó phân tích mã hiện có, xác định các tệp bị ảnh hưởng và đề xuất một trình tự thay đổi an toàn.

Khi nào nên dùng

  • ✓Khi bạn muốn lên kế hoạch cho một thay đổi lớn trong mã.
  • ✓Trước khi sửa nhiều tệp cùng lúc.
  • ✓Để đảm bảo các thay đổi mã được thực hiện an toàn và có tổ chức.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/refactor-plan/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/refactor-plan/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn tái cấu trúc hệ thống đăng nhập. Hãy tạo kế hoạch cho việc này.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent trước tiên tìm hiểu cách mã hoạt động, sau đó lên kế hoạch thay đổi theo các bước an toàn (kiểu dữ liệu, triển khai, test, dọn dẹp), đồng thời có các bước kiểm tra và hoàn tác nếu có sự cố.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Refactor Plan

Create a detailed plan before making any code changes.

Instructions

  1. Do not edit files while preparing the plan.
  2. Search the codebase to understand the current state. Read enough implementation, tests, configuration, and docs to make the plan specific to the repository.
  3. Identify affected files, ownership boundaries, dependencies, and likely hidden coupling.
  4. Plan changes in a safe sequence. Prefer contracts and types first, then implementations, then callers, then tests, then cleanup.
  5. Include verification steps between phases and a final validation command.
  6. Include rollback or recovery steps for the riskiest phases.
  7. Output the complete plan using the format below.
  8. Stop after the plan and ask for confirmation before implementing. If the user already asked you to implement, still produce the plan first and wait for confirmation unless they explicitly said to continue without review after the plan.

If the request is too ambiguous to plan safely, ask concise clarifying questions instead of editing files.

Output Format

## Refactor Plan: [title]

### Current State
[Brief description of how things work now]

### Target State
[Brief description of how things will work after]

### Affected Files
| File | Change Type | Dependencies |
|------|-------------|--------------|
| path | modify/create/delete | blocks X, blocked by Y |

### Execution Plan

#### Phase 1: Types and Interfaces
- [ ] Step 1.1: [action] in `file.ts`
- [ ] Verify: [how to check it worked]

#### Phase 2: Implementation
- [ ] Step 2.1: [action] in `file.ts`
- [ ] Verify: [how to check]

#### Phase 3: Tests
- [ ] Step 3.1: Update tests in `file.test.ts`
- [ ] Verify: Run `npm test`

#### Phase 4: Cleanup
- [ ] Remove deprecated code
- [ ] Update documentation

### Rollback Plan
If something fails:
1. [Step to undo]
2. [Step to undo]

### Risks
- [Potential issue and mitigation]

After the plan, ask: "Shall I proceed with Phase 1?"

Câu hỏi thường gặp

“Refactoring” (tái cấu trúc) là gì?

Tái cấu trúc là sắp xếp lại mã hiện có mà không thay đổi hành vi bên ngoài của nó, nhằm giúp mã dễ hiểu và dễ bảo trì hơn.

Vì sao phải lên kế hoạch trước khi sửa mã?

Lên kế hoạch giúp ngăn ngừa lỗi, đảm bảo mọi phần của mã được cân nhắc, và làm quá trình thay đổi an toàn và dễ đoán hơn.

Điều gì xảy ra sau khi kế hoạch được hiển thị?

Agent sẽ chờ bạn xác nhận rồi mới bắt đầu áp dụng thay đổi, bắt đầu từ giai đoạn đầu tiên của kế hoạch.

Chi tiết

Mô tả gốc của tác giả

Create a concrete plan before starting a multi-file refactor. Use when the user asks to plan, sequence, scope, or safely execute a refactor across multiple files; always investigate first, output the plan, and wait for confirmation before making code changes.

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7395
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự