技能 safe-refactor
📦

safe-refactor

v1.0 內容修訂 r1 安全 ⚙️ 外部命令

Refactor Code with Tests and Small Changes

Code cleanup can introduce behavior changes that are difficult to detect. This skill guides small refactoring steps with baseline tests, dependency checks, and repeated verification.

支援: Claude Codex Code(CC)
Maintain this Skill? Claim it 🥉 78 銅級

使用我的智慧代理安裝

將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。

智能體請求
Review the Skillstore skill "safe-refactor" from https://skillstore.io/skills/agentkitco-safe-refactor.md and its manifest at https://skillstore.io/api/skills/agentkitco-safe-refactor/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.

你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。

Agent 可讀資源

當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。

測試它

正在使用「safe-refactor」。 Extract duplicated validation from two functions without changing their behavior.

預期結果:

  • Boundary: preserve validation order, error messages, and return values.
  • Baseline: relevant tests passed before editing.
  • Change: extracted the shared validation logic in one reviewable step.
  • Verification: relevant tests and lint passed after extraction.
  • Left unchanged: an unrelated naming inconsistency.

正在使用「safe-refactor」。 Restructure a legacy parser that has no tests.

預期結果:

  • Characterization tests added for representative valid and invalid inputs.
  • Baseline behavior recorded, including existing error messages.
  • Restructuring completed in separate, verified steps.
  • Uncertainty: large input performance was not exercised.
  • Observed bug reported separately and left unchanged.

安全審計

安全
v2 • 2026/10/22 開啟版本化報告

All three static findings are false positives: Markdown command references are not Ruby execution, and the completion report is not system reconnaissance. No evidence found of prompt injection, data exfiltration, or malicious intent in SKILL.md.

1
已掃描檔案
38
分析行數
0
複核項目
0
已忽略的誤報

風險因素

⚙️ 外部命令 (2)
最近一次完成的靜態與語意稽核未偵測到已確認的安全發現。這並不能證明該 Skill 沒有副作用。
審計單位: codex 檢視審計紀錄 →
分享與引用此報告

分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。

開啟版本化報告
安全評估

複製報告連結

https://skillstore.io/skills/agentkitco-safe-refactor/audits/2?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_report

Markdown 徽章

[![Skillstore security assessment](https://skillstore.io/badges/skills/agentkitco-safe-refactor/security.svg)](https://skillstore.io/skills/agentkitco-safe-refactor?utm_source=security_passport_badge)

HTML 徽章

<a href="https://skillstore.io/skills/agentkitco-safe-refactor?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/agentkitco-safe-refactor/security.svg" alt="Skillstore security assessment" loading="lazy"></a>

嵌入卡片

<iframe src="https://skillstore.io/embed/skills/agentkitco-safe-refactor.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>
學術引用 (APA · BibTeX · CFF)

APA 引用

agentkitco. (2026). safe-refactor security audit report (audit version 2) [Author version 1.0]. Skillstore. https://skillstore.io/skills/agentkitco-safe-refactor/audits/2

BibTeX 引用

@techreport{agentkitco-agentkitco-safe-refactor-2026, author = {agentkitco}, title = {safe-refactor security audit report (audit version 2)}, institution = {Skillstore}, year = {2026}, number = {2}, url = {https://skillstore.io/skills/agentkitco-safe-refactor/audits/2}, note = {Author version 1.0} }

CITATION.cff

cff-version: 1.2.0 message: "If you use this Skill, cite its author and this versioned security audit report." title: "safe-refactor security audit report (audit version 2)" version: "1.0" type: report authors: - name: "agentkitco" date-released: "2026-10-22" url: "https://skillstore.io/skills/agentkitco-safe-refactor/audits/2" identifiers: - type: other value: "skillstore:agentkitco-safe-refactor:audit:2" description: "Skillstore immutable audit report identifier"

比較變體

2 個可安裝變體

每位作者的技能都保留為獨立的可安裝項目。推薦變體依 Skillstore 證據排序。

為何此變體排名第一

Skillstore 使用量較高

juliusbrussee-safe-refactor

Skillstore 評分 78
證據置信度 中
Skillstore 使用量 8
已更新

2026-09-09

agentkitco 目前

agentkitco-safe-refactor

Skillstore 評分 78
證據置信度 中
Skillstore 使用量 6
已更新

2026-10-22

Skillstore 評分

評分依據 證據置信度: 中
55
架構
85
可維護性
87
內容
65
社群
91
規範符合度

你可以打造什麼

Clean Up a Working Module

Extract duplicated logic while preserving outputs, error messages, logging, and edge cases through small, verified edits.

Protect Legacy Behavior

Add characterization tests before restructuring code that lacks coverage, and document behavior that remains unverified.

Review a Shared API Rename

Identify callers and dependents before renaming exported symbols, and request approval when compatibility requires a breaking change.

試試這些提示

Assess a Refactoring Task
Use safe-refactor to assess [module]. State the goal, behavior boundaries, existing tests, and baseline results before proposing any edits.
Extract Repeated Logic
Use safe-refactor to extract repeated logic in [file]. Preserve behavior, make one change per step, and run relevant tests after each step.
Characterize Untested Code
Use safe-refactor on [legacy module]. Add characterization tests for realistic inputs before restructuring. Preserve current errors and ordering, and report coverage gaps.
Plan a Shared Symbol Rename
Use safe-refactor to rename [exported symbol]. Check all callers and dependents, propose a deprecation path, and request approval before any API break.

最佳實務

  • Define behavior boundaries and record baseline failures before editing.
  • Add characterization tests before restructuring untested behavior.
  • Review each small diff and verify that rollback preserves pre-existing user edits.

避免

  • Mixing refactoring with bug fixes, features, or dependency upgrades.
  • Continuing through failing tests instead of undoing the last step and reducing its scope.
  • Changing public APIs without approval or a deprecation path.

常見問題

What does this skill provide?
It provides a structured workflow for behavior-preserving refactoring, including test baselines, dependency checks, incremental edits, and a final report.
What happens when the code has no tests?
The workflow calls for characterization tests that record current behavior before refactoring begins.
Does it guarantee identical behavior?
No. Verification depends on test coverage and available checks, and the final report must identify behavior that remains uncertain.
Can it fix bugs during a refactor?
It directs the assistant to report discovered bugs and handle fixes as separate changes.
When does it ask for user input?
It asks when tests cannot run, baseline failures are unexplained, a public API break is needed, or a real bug is found.
Does it require a specific programming language?
No specific language is required. The host assistant must use the existing project tests, type checker, or linter.

開發者詳細資訊

作者

agentkitco

授權

MIT

作者版本

v1.0

Skillstore 修訂

r1

版本提示

作者聲明的版本不符合 SemVer 規範。

引用

18efac79a818d7e997295839638fdd21906cfd1c

維護新鮮度

2026/10/22

使用量

5 次下載 · 0 次瀏覽

檔案結構

📄 SKILL.md

agentkitco 的更多技能

查看全部
查看全部