Logo Reduce

Reduce

Tổ chức
escoffier-labs
reduce

Dùng khi được yêu cầu đơn giản hóa, dọn dẹp hoặc tái cấu trúc mã cho dễ hiểu mà không thay đổi chức năng, hoặc khi người dùng nói “đơn giản hóa phần này”, “dọn phần này đi”, “làm cho dễ đọc”, “giảm độ phức tạp” hay “chỉnh lại cho gọn”. Chỉ áp dụng khi giữ nguyên hành vi; không dùng để kiểm tra lỗi hay bảo mật (hãy dùng bug-hunt hoặc security-sweep cho các việc đó).

Add to TypingMind

Tổng quan

Nhà phát hànhescoffier-labs
Kho mãbrigade
Tên kỹ năngreduce
Sao
82
Bản fork
9
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được escoffier-labs công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Reduce trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/escoffier-labs/brigade/tree/main/registry/skills/reduce
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/escoffier-labs/brigade.git /tmp/brigade
mkdir -p .claude/skills
cp -r /tmp/brigade/registry/skills/reduce .claude/skills/reduce
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Reduce trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Reduce ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Reduce với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

reduce

A reduction simmers a sauce to drive off the water and concentrate the flavor, and the dish tastes the same, only sharper. You do that to code: boil off the excess, concentrate the intent, and the behavior comes out identical. The cook who reduces too hard scorches the pan and changes the dish; the discipline is knowing when to pull it off the heat.

Core principle: same inputs, same outputs, same side effects, same errors, same public interface, same evaluation order. If the behavior moved, it was not a reduction, it was a rewrite. No behavior-preservation evidence, no applied simplification. Violating the letter of that is violating its spirit.

The behavior lock

Before you change a single line, establish the lock. This is the whole safety story; everything else is taste.

  1. Pin the scope. Default to the code that recently changed (see Scope). Know exactly which files and functions you are reducing before you start.
  2. Find the tests that cover it. Run them and confirm they exercise the code you are about to touch. If coverage is thin, write characterization tests first (taste) that capture the current behavior, edge cases included, only when that is safe and in scope. If you cannot lock the behavior with tests, drop to report mode.
  3. Baseline-verify green. Run the suite and read the output before touching anything. You are proving the starting point, not assuming it.
  4. Reduce in small steps, one category of simplification at a time (see What to reduce).
  5. Re-run the same verification after each meaningful change. Evidence in hand before any "behavior unchanged" claim (check). A reduction you did not re-run is a hypothesis.
  6. Cannot lock it? Switch to report mode or ask the user. Never apply a simplification you cannot prove safe.

Two modes

Apply is the default for recently changed code that has tests, or where characterization tests can be added safely. You make the edits, one category per commit, with the verification evidence.

Report is for broad scope, under-tested code, anything architectural or design-level, public-interface shifts, or when the user explicitly wants review before edits. You produce the simplification plan and stop. Auto-escalate from apply to report the moment the behavior lock cannot be established. When in doubt, report.

What to reduce

Highest value first. These are local, mechanical, structure-preserving moves.

  • Flatten control flow. Guard clauses and early returns over deep nesting; collapse arrow code.
  • Reveal intent through naming. A clear name retires a comment that only restated the code.
  • Remove dead weight. Unused locals, parameters, imports, and unreachable branches, once usage analysis confirms nothing references them.
  • Consolidate genuine duplication. Same logic with the same reason to change, in three or more real places. Extract the shared intent, not merely the matching text.
  • Replace clever with boring. Dense one-liners and trick expressions become plain, local, readable code.
  • Collapse needless intermediate state. Drop temp variables, redundant data-shape conversions, and pass-through wrappers that earn nothing.
  • Reuse what the repo already has. If a helper already exists, call it instead of inlining the logic a fourth time.

What NOT to reduce

This is the discipline that separates a reduction from a scorched pan.

  • No new abstraction without three or more real call sites or a clear domain concept. Premature DRY is its own debt; functions diverge the moment requirements do.
  • DRY past readability. Two snippets that look alike but change for different reasons are not duplication. Leave them.
  • No dense one-liners or nested ternaries sold as "simpler". Fewer lines is not the goal; lower cognitive load is.
  • No vague generic utilities. A utils.process() that hides three unrelated jobs is worse than the code it replaced.
  • Never strip load-bearing redundancy. Validation, defensive null checks, logging, retries, error fallbacks, compatibility shims, and intentional comments look redundant and are not. Looks redundant does not mean is redundant; when unsure, leave it and note it.
  • No style churn outside the scope. Reformatting a wide area is how a semantic change hides in a diff nobody can read.

Tidy, do not redesign

reduce tidies: local, mechanical, behavior-preserving cleanup. It does not move module boundaries, reshape data models, or pick new abstractions. Those are design decisions; surface them in report mode and hand off, never auto-apply. Tidying first earns the trust that makes the larger refactor possible later.

Scope

Default: the code that recently changed, from git diff against the merge base or the working tree. That keeps the reduction relevant and prevents repo-wide churn.

Allow an explicit scope on request: a file, a directory, a symbol, or a commit or PR range. Whole-repo reduction only when the user asks for it, and report-first.

One category per commit

Dead code in one commit, duplication in the next, guard clauses in the next. Each commit names its effect, stays reviewable, and reverts alone. One sweep that bundles five kinds of change is an unreviewable rewrite wearing a cleanup label.

Boundaries

reduce applies changes; it is not an audit and it does not hunt for defects.

  • Borrows from taste for characterization tests, check for evidence before claims, and refire when a reduction surfaces a real bug: stop, do not "simplify" the bug away, switch to debugging.
  • Hands accepted report findings to expedite to drive to done.
  • Hands correctness issues to bug-hunt, security issues to security-sweep, and repo-wide quality to line-check. Finding a bug is not in scope here; routing it is.

Output shape

reduce has its own artifact, not the shared audit contract:

markdown
## reduce: <scope> (<date>)
Mode: apply | report

### Simplification plan
- [category] what will change and why it is behavior-preserving

### Change log   (apply mode)
- [category] what changed (<commit>)

### Verification evidence
Baseline: <command> -> <result>
After:    <command> -> <result>   (must match)

### Handed off
- correctness/security/design items routed to bug-hunt / security-sweep / line-check

In report mode, findings may also be written in the audit report format so expedite can consume them later.

Common mistakes

MistakeReality
"Cleaner" refactor that alters an edge caseIf you did not re-run the tests, you changed behavior and do not know it.
Abstracting from two superficially similar snippetsLooks-alike is not duplication. Wait for three real call sites and a shared reason to change.
Deleting a defensive check that "can never fail"That is the load-bearing redundancy. It fails the day you remove it.
Reformatting the whole file "while I was in there"A semantic change now hides in the noise. One category per commit, scope held.
Fewer lines reported as simplerCognitive load is the metric, not line count. Dense is not simple.
"Behavior unchanged" with nothing runA claim, not evidence. Lock, run, then claim.

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

Kỹ năng AI Reduce làm được gì?

Dùng khi được yêu cầu đơn giản hóa, dọn dẹp hoặc tái cấu trúc mã cho dễ hiểu mà không thay đổi chức năng, hoặc khi người dùng nói “đơn giản hóa phần này”, “dọn phần này đi”, “làm cho dễ đọc”, “giảm độ phức tạp” hay “chỉnh lại cho gọn”. Chỉ áp dụng khi giữ nguyên hành vi; không dùng để kiểm tra lỗi hay bảo mật (hãy dùng bug-hunt hoặc security-sweep cho các việc đó).

Vì sao nên dùng Reduce trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Reduce là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Reduce trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/escoffier-labs/brigade/tree/main/registry/skills/reduce. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Reduce?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Reduce với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Reduce với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Reduce có miễn phí không?

Có. Kỹ năng này được escoffier-labs phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇