Logo Refactoring Code

Refactoring Code

Tổ chức
JetBrains
refactoring-code

Use when semantic refactoring is needed in Rider-supported solutions and projects, including .NET/C#, F#, VB, C++, Unity, Unreal Engine, XAML, Razor, and other GameDev or mixed-language projects. Trigger when edits must update declarations and usages across IDE-resolved references — rename symbols, move types or namespaces, safe-delete unused code, extract interface/base class/method, change signatures, or reorganize namespaces. Do not use for file-only moves, config keys, strings, comments, prose-only edits, generated output, or logic changes with unchanged names/signatures.

Tổng quan

Nhà phát hànhJetBrains
Kho mãskills
Tên kỹ năngrefactoring-code
Sao
377
Bản fork
32
Tệp đi kèm
9
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 là Markdown thuần túy, không phải 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ộ.

  • 9 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được JetBrains công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Refactoring Code 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 thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/JetBrains/skills/tree/main/refactoring-code
  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/JetBrains/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/refactoring-code .claude/skills/refactoring-code
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 Refactoring Code 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ự tải Refactoring Code 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 Refactoring Code không bị giới hạn ở mô hình mà kỹ năng này được viết cho. 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 kỹ năng chưa dùng không tốn chi phí.

  • Đổ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.

Code Refactoring

Rider/ReSharper-driven semantic refactorings across solutions opened in Rider. Each tool resolves the target through the IDE's reference index and rewrites every affected site — language-aware usages such as nameof, XML-doc <see cref>, XAML x:Name, Razor, C++/Unreal references, and ordinary references that grep cannot resolve — instead of a grep + text replace.

Invoking a tool

Always call a refactoring tool through execute_tool — direct calls are not routed:

execute_tool(command="<tool> --arg value [--flag true]")

reference/tools.md lists every available tool; the linked reference/tools/<tool>.md gives the exact parameters, response shape, outcomes, and error kinds for the one tool you are about to call. Read only that one — do not pre-load the whole tree.

Shared rules

  1. Prefer the MCP tool. It resolves references semantically across the solution; a text edit cannot. On any error you cannot fix by adjusting the input, or when execute_tool is unavailable, fall back to a text-based edit.
  2. Trust the success signal. When a tool reports success, do not re-read the mutated files to verify. When a tool reports a count of touched/affected sites, a value of 1 for a type, method, property, field, or namespace is suspicious (declaration only, no callers) — surface it to the user.
  3. Do not retry blindly. Adjust the arguments (query, name, file path, namespace, member selection) between calls; a second identical call fails the same way.
  4. Argument hygiene. Parameter names are camelCase — hyphenated variants like --new-name are rejected. Pass real values or omit optional parameters entirely; never encode an omitted value with a placeholder such as "", "/", "__omit__", or a fake path. Treat file paths and identifiers as opaque: copy them from search_* / get_symbol_info output (solution-relative, / separators) rather than synthesizing them.
  5. Library / external symbols cannot be refactored — the change must be made upstream. Confirm with the user.

Preview before applying

When a tool offers an analysis-only mode — rename's --preview true (the older --dryRun is a deprecated alias) returns the blast radius in affects without mutating files — use it first for:

  • public / protected API changes;
  • targets with many call sites or cross-language references (XAML, Razor, C++/Unreal, <see cref>);
  • any change where the user signalled hesitation.

Audit affects, then re-issue without --preview to apply. Preview resolves the symbol and counts usages only — it does not run conflict analysis, so a clean preview can still come back with conflicts on apply. Which tools expose an analysis mode is documented per tool in the reference; a tool without one (e.g. a namespace move) applies directly and reports no blast-radius counts, so for a high-impact call narrate what you are about to change before issuing it.

Conflicts and ambiguity

Tools that rewrite or remove use sites (rename, safe-delete, the extract family) can refuse the operation and report conflicts; a symbol query can also match more than one candidate (ambiguous). Both come back in the tool's response — see its reference file for the exact fields. A non-empty conflicts list always means no files were touched.

Each conflict entry is {kind, file, context}: kind mirrors ReSharper's ConflictType (snake_case); context is the engine's localized description; file is the first occurrence's path, or null for a textual-only conflict or a clash with a compiled-only symbol.

KindMeaningAction
same_name_conflictNew name collides with an existing member in the same scope.Pick a different name and retry.
default_element_conflictGeneric element-level conflict without a more specific category.Read context; if it names a colliding member, treat like same_name_conflict, else escalate.
cannot_update_usage_conflictA call site can't be rewritten safely — downstream code would break.Escalate to user; do not auto-retry.
cannot_remove, cannot_delete_safely, cannot_inline_usage_conflict, will_be_removedEngine refuses to remove/delete/inline/rewrite a use site.Escalate to user; do not auto-retry.
not_accessibleThe symbol becomes invisible from one or more use sites after the change.Escalate to user — a visibility regression.
will_be_made_publicAccess widens as a side-effect (e.g. promoted from private).Narrate the trade-off to the user before retrying.
hierarchy_conflictOverride/implementation hierarchy clashes with the result.Escalate to user; cross-type effect.
text_only, default_conflict, invalidGeneric textual conflict the engine couldn't categorise structurally.Read context; decide from the message.

Escalate to the user (instead of auto-deciding) when there are more than 5 conflicts, or any entry is cannot_update_usage_conflict, cannot_remove, cannot_delete_safely, cannot_inline_usage_conflict, will_be_removed, not_accessible, or hierarchy_conflict. For a rename, also escalate when affects.callSites == 0 for a public/protected symbol — it usually means the query resolved to the wrong target.

For ambiguous matches, each candidate carries name, kind, fqn, file, and line. Re-issue with a more specific query — a fully qualified path like Namespace.Type.Method, or Type._field for a private member (bare short-name lookup prioritises type-level entries and misses private fields/methods). The candidate list is capped at 5; if you see 5, the query is too broad — narrow it rather than expecting the full set.

Known limitations

These hold across the toolset and are not reported in tool output:

  • String and comment occurrences of an old name or namespace are not updated. Fix them with a regular edit pass afterward.
  • XML-doc <see cref> references: a method rename rewrites <see cref="Type.Method(int, int)"/> to <see cref="NewName"/>, dropping the containing type and parameter list. Surface to the user after method renames and offer a separate edit pass.
  • Moving a type does not move its file — only the namespace declaration and references change. If the user also wants the file relocated to match, do that as a separate file operation.

Tool reference

reference/tools.md is the auto-generated index of every tool in the Rider refactoring toolset, each entry linking to its full parameter and response contract. It is regenerated from the live MCP descriptors, so it — not this file — is the source of truth for tool names, signatures, and response shapes. This skill carries only the workflow and judgment the contracts don't.

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

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

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

Use when semantic refactoring is needed in Rider-supported solutions and projects, including .NET/C#, F#, VB, C++, Unity, Unreal Engine, XAML, Razor, and other GameDev or mixed-language projects. Trigger when edits must update declarations and usages across IDE-resolved references — rename symbols, move types or namespaces, safe-delete unused code, extract interface/base class/method, change signatures, or reorganize namespaces. Do not use for file-only moves, config keys, strings, comments, prose-only edits, generated output, or logic changes with unchanged names/signatures.

Vì sao nên dùng Refactoring Code 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. Refactoring Code 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 Refactoring Code trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/JetBrains/skills/tree/main/refactoring-code. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà 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 Refactoring Code?

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.

Bạn có thể dùng Refactoring Code 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 Refactoring Code 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 Refactoring Code có miễn phí không?

Kỹ năng này được JetBrains phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. 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 cho mô hình các công cụ mới để gọi — mã đượ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à tiêu chí của đầu ra tốt. 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 👇