simplify-code
Skill này làm gì
Công cụ này xem xét các đoạn code vừa được thay đổi. Nó tìm cách đơn giản hóa code, làm code dễ hiểu hơn và đảm bảo code vẫn hoạt động đúng, chỉ áp dụng những thay đổi an toàn.
Khi nào nên dùng
- ✓Khi bạn muốn đơn giản hóa code vừa được thay đổi.
- ✓Khi bạn muốn đảm bảo các thay đổi code rõ ràng và an toàn.
- ✓Khi bạn muốn xem lại hoặc dọn dẹp một đoạn code cụ thể.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/simplify-code/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xem xét đoạn code này và đơn giản hóa nó nếu có thể.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ dùng các “trí tuệ nhân tạo” nhỏ hơn để phân tích code từ nhiều góc độ: tái sử dụng, chất lượng, hiệu quả và độ rõ ràng. Sau đó, nó gợi ý hoặc áp dụng chỉ những thay đổi an toàn nhất, không làm thay đổi chức năng ban đầu.
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.
Simplify Code
Review changed code for reuse, quality, efficiency, and clarity issues. Use Codex sub-agents to review in parallel, then optionally apply only high-confidence, behavior-preserving fixes.
When to Use
- When the user asks to simplify, clean up, refactor, or review changed code.
- When you want high-confidence, behavior-preserving improvements on a scoped diff.
Modes
Choose the mode from the user's request:
review-only: user asks to review, audit, or check the changessafe-fixes: user asks to simplify, clean up, or refactor the changesfix-and-validate: same assafe-fixes, but also run the smallest relevant validation after edits
If the user does not specify, default to:
review-onlyfor "review", "audit", or "check"safe-fixesfor "simplify", "clean up", or "refactor"
Step 1: Determine the Scope and Diff Command
Prefer this scope order:
- Files or paths explicitly named by the user
- Current git changes
- Files edited earlier in the current Codex turn
- Most recently modified tracked files, only if the user asked for a review but there is no diff
If there is no clear scope, stop and say so briefly.
When using git changes, determine the smallest correct diff command based on the repo state:
- unstaged work:
git diff - staged work:
git diff --cached - branch or commit comparison explicitly requested by the user: use that exact diff target
- mixed staged and unstaged work: review both
Do not assume git diff HEAD is the right default when a smaller diff is available.
Before reviewing standards or applying fixes, read the repo's local instruction files and relevant project docs for the touched area. Prefer the closest applicable guidance, such as:
AGENTS.md- repo workflow docs
- architecture or style docs for the touched module
Use those instructions to distinguish real issues from intentional local patterns.
Step 2: Launch Four Review Sub-Agents in Parallel
Use Codex sub-agents when the scope is large enough for parallel review to help. For a tiny diff or one very small file, it is acceptable to review locally instead.
When spawning sub-agents:
- give each sub-agent the same scope
- tell each sub-agent to inspect only its assigned review role
- ask for concise, structured findings only
- ask each sub-agent to report file, line or symbol, problem, recommended fix, and confidence
Use four review roles.
Sub-Agent 1: Code Reuse Review
Review the changes for reuse opportunities:
- Search for existing helpers, utilities, or shared abstractions that already solve the same problem.
- Flag duplicated functions or near-duplicate logic introduced in the change.
- Flag inline logic that should call an existing helper instead of re-implementing it.
Recommended sub-agent role: explorer for broad codebase lookup, or reviewer if a stronger review pass is more useful than wide search.
Sub-Agent 2: Code Quality Review
Review the same changes for code quality issues:
- Redundant state, cached values, or derived values stored unnecessarily
- Parameter sprawl caused by threading new arguments through existing call chains
- Copy-paste with slight variation that should become a shared abstraction
- Leaky abstractions or ownership violations across module boundaries
- Stringly-typed values where existing typed contracts, enums, or constants already exist
Recommended sub-agent role: reviewer
Sub-Agent 3: Efficiency Review
Review the same changes for efficiency issues:
- Repeated work, duplicate reads, duplicate API calls, or unnecessary recomputation
- Sequential work that could safely run concurrently
- New work added to startup, render, request, or other hot paths without clear need
- Pre-checks for existence when the operation itself can be attempted directly and errors handled
- Memory growth, missing cleanup, or listener/subscription leaks
- Overly broad reads or scans when the code only needs a subset
Recommended sub-agent role: reviewer
Sub-Agent 4: Clarity and Standards Review
Review the same changes for clarity, local standards, and balance:
- Violations of local project conventions or module patterns
- Unnecessary complexity, deep nesting, weak names, or redundant comments
- Overly compact or clever code that reduces readability
- Over-simplification that collapses separate concerns into one unclear unit
- Dead code, dead abstractions, or indirection without value
…
Câu hỏi thường gặp
“Diff” là gì?
“Diff” là một phép so sánh cho thấy sự khác biệt giữa hai phiên bản của một tệp hoặc nhóm tệp. Nó giống như xem chính xác những thay đổi đã được thực hiện.
“Áp dụng thay đổi an toàn” nghĩa là gì?
Nghĩa là công cụ chỉ thực hiện thay đổi code có khả năng cao không làm hỏng gì hoặc thay đổi hành vi mong đợi của chương trình. Nó tránh các sửa đổi rủi ro.
Vì sao công cụ dùng “sub-agent”?
Dùng sub-agent cho phép việc xem xét code được thực hiện song song bởi các chuyên gia khác nhau, nhanh hơn và kỹ lưỡng hơn, vì bao quát nhiều khía cạnh của code cùng lúc.
Chi tiết
Mô tả gốc của tác giả
Review a diff for clarity and safe simplifications, then optionally apply low-risk fixes.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5784
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.