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

simplify-code

Skill này làm gì

Skill này giúp AI của bạn dọn dẹp code vừa được thay đổi, mà không tìm lỗi. Skill dành cho lập trình viên muốn code đang chạy được làm gọn và đơn giản hơn trước khi chia sẻ.

Khi nào nên dùng

  • ✓Khi bạn yêu cầu AI đơn giản hóa hoặc dọn dẹp các thay đổi code gần đây của bạn.
  • ✓Khi bạn muốn rà soát về khả năng tái sử dụng, tính đơn giản, hiệu năng hoặc mức độ thiết kế.
  • ✓Khi bạn muốn một lượt chạy thử để có báo cáo các ý tưởng dọn dẹp mà không thay đổi file nào.

Liên kết skill

https://github.com/NousResearch/hermes-agent/blob/main/skills/software-development/simplify-code/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/NousResearch/hermes-agent/blob/main/skills/software-development/simplify-code/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

“Đơn giản hóa các thay đổi gần đây của tôi và xóa mọi code trùng lặp, nhưng đừng thay đổi hành vi.”

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

Cách hoạt động

Skill chạy bốn người rà soát tập trung cùng lúc, mỗi người tìm một loại vấn đề. Sau đó nó kết hợp các phát hiện và áp dụng những sửa đổi đáng làm.

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 — Parallel Review & Cleanup

Review your recent code changes with four focused reviewers running in parallel, aggregate their findings, and apply the fixes worth applying.

This is a cleanup pass, not a bug hunt. You are improving the quality of code that already works — removing duplication, flattening needless complexity, cutting waste, and deepening band-aid fixes. Do not go hunting for correctness bugs here; that's what requesting-code-review is for.

Core principle: Four narrow reviewers beat one broad reviewer. Each one deeply searches the codebase for a single class of problem — reuse, quality, efficiency, altitude — without diluting its attention across all four. They run concurrently, so you pay the latency of one review, not four.

When to Use

Trigger this skill when the user says any of:

  • "simplify" / "simplify my changes" / "simplify these changes"
  • "review my code" / "review my recent changes" / "clean up my changes"
  • "/simplify" (if they're carrying the Claude Code habit over)

Optional modifiers the user may add — honor them:

  • Focus: "simplify focus on efficiency" → run only the efficiency reviewer (or weight the aggregation toward it). Recognized focuses: reuse, quality (also accepts simplification), efficiency, altitude.
  • Dry run: "simplify but don't change anything" / "just report" → run the four reviewers, present findings, apply NOTHING. Ask before applying.
  • Scope: "simplify the last commit" / "simplify staged" / "simplify src/foo.py" → narrow the diff source accordingly (see Phase 1).

Do NOT auto-run this after every edit or tack it onto the end of unrelated tasks. It costs four subagents' worth of tokens — invoke it only when the user explicitly asks.

The Process

Phase 1 — Identify the changes

Capture the diff to review. Pick the source by what the user asked for, in this default order:

# 1. Default: uncommitted working-tree changes (tracked files)
git diff

# 2. If that's empty, include staged changes
git diff HEAD

# 3. Scoped variants the user may request:
git diff --staged                 # "staged changes"
git diff HEAD~1                    # "the last commit"
git diff main...HEAD              # "this branch" / "my PR"
git diff -- src/foo.py            # specific file(s)

If git diff and git diff HEAD are both empty and there's no git repo or no changes, fall back to the files the user explicitly named or that were recently created/edited in this session. If you genuinely can't find any changed code, say so and stop — there's nothing to simplify.

Capture the full diff text. Note its size: if it's very large (say >2000 changed lines), warn the user that four subagents each carrying the full diff will be token-heavy, and offer to scope it down (per-directory, per-commit) before proceeding.

Phase 2 — Launch four reviewers in parallel

Use delegate_task batch mode — pass all four tasks in one tasks array so they run concurrently. Four is the right fan-out for this pattern; it's within the delegation.max_concurrent_children budget on any default install.

No delegation available? If you can't call delegate_task in this context (you're a leaf subagent, delegation is disabled, or the budget is exhausted), do NOT skip the review or drop angles. Work through all four reviewer angles yourself, sequentially, in this context — same search standards, same finding format. Then say clearly in your final summary that this was a single-pass inline review, not the parallel fan-out, so the user knows what actually ran.

Give every reviewer the complete diff (not fragments — cross-file issues hide in the gaps) plus the absolute repo path so they can search the wider codebase. Each reviewer gets terminal, file, and search toolsets (so they can git, read_file, and search_files/grep).

Tell each reviewer to:

  • Search the existing codebase for evidence (don't reason from the diff alone).
  • Apply Chesterton's Fence: before flagging anything for removal, run git blame on the line to understand why it exists. If you can't determine the original purpose, mark it confidence: low — don't guess.
  • Report findings as structured output with the concrete cost, confidence, and risk:
    file:line → problem → cost (what's duplicated/wasted/harder to maintain) → suggested fix | confidence: high/medium/low | risk: SAFE/CAREFUL/RISKY
    
    The cost field forces each fi
Câu hỏi thường gặp

Nó có tìm lỗi không?

Không. Skill cho biết nó là lượt dọn dẹp, còn việc tìm lỗi thuộc về skill review code.

Tôi có thể chọn chỉ một loại rà soát không?

Có. Skill cho phép bạn tập trung vào khả năng tái sử dụng, chất lượng, hiệu năng hoặc mức độ thiết kế.

Nó có thể chỉ báo cáo mà không thay đổi file không?

Có. Skill hỗ trợ chạy thử, chỉ báo cáo các phát hiện.

Chi tiết

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

Parallel 4-agent cleanup of recent code changes.

repo: NousResearch/hermes-agent

Độ phổ biến

Sao GitHub
260k
Vị trí xếp hạng
#623
Giấy phép
MIT
Cập nhật
2/11/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ự