Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/u9401066/med-paper-assistant/code-refactornpx skills add u9401066/med-paper-assistant --skill code-refactorgit clone --depth 1 https://github.com/u9401066/med-paper-assistantWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/u9401066/med-paper-assistant/code-refactor)<a href="https://agentmods.dev/skills/u9401066/med-paper-assistant/code-refactor"><img src="https://agentmods.dev/badge/skills/u9401066/med-paper-assistant/code-refactor.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00036 | $0.00718 |
| Opus 5 | $0.00018 | $0.00359 |
| Sonnet 5 | $0.00007 | $0.00144 |
| Haiku 4.5 | $0.00004 | $0.00072 |
Grade A, and why
code-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
程式碼重構技能
主動偵測並執行程式碼重構,維持 DDD 架構和程式碼品質。
觸發:「重構」「refactor」「太長了」「模組化」「拆分」,或偵測到超過閾值時主動觸發。
閾值設定
| 類型 | 警告 | 強制重構 |
|---|---|---|
| 檔案 | > 200 行 | > 400 行 |
| 類別 | > 150 行 | > 300 行 |
| 函數 | > 30 行 | > 50 行 |
| 目錄檔案數 | > 10 | > 15 |
| 圈複雜度 | > 10 | > 15 |
| 巢狀深度 | > 3 層 | > 4 層 |
| 參數數量 | > 4 | > 6 |
| 依賴數量 | > 5 | > 8 |
重構模式庫
| # | 模式 | 觸發條件 |
|---|---|---|
| 1 | Extract Method | 函數過長、重複邏輯 |
| 2 | Extract Class | 類別職責過多、>150 行 |
| 3 | Replace Conditional with Polymorphism | 大量 if-elif-else |
| 4 | Introduce Parameter Object | 參數 >4 個 |
| 5 | Split Module | 目錄 >10 檔案 → 按子領域拆分 |
DDD 架構守護
依賴方向:Presentation → Application → Domain ← Infrastructure
禁止:Domain 依賴 Infrastructure、Presentation 直接存取 Domain、Entity 包含持久化邏輯。
重構流程
- 偵測:報告檔案/函數/複雜度超標情況
- 分析:識別重複邏輯、隱藏 Value Object、職責分離點
- 規劃:列出重構步驟(新檔案、遷移、測試)
- 執行:逐步重構,每步確認測試通過
- 驗證:全部測試通過、覆蓋率、複雜度、DDD 合規
與其他 Skills 整合
| Skill | 整合 |
|---|---|
| code-reviewer | 審查時觸發重構建議 |
| test-generator | 重構前先生成測試 |
| ddd-architect | 確保重構符合 DDD |
| memory-updater | 記錄重構決策 |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 67 lines · 36 tokens per session scan A 4f6a2343949d
code-refactor is a skill published in the GitHub repository u9401066/med-paper-assistant (11 stars, last pushed 17d ago), licensed Apache-2.0. It adds 36 tokens to every session and 718 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
citation-manager
Format and manage citations — APA, MLA, Chicago, IEEE, and Vancouver styles with BibTeX export.
e2e-testing
E2E test authoring for Backseat Driver. Use when: writing, modifying, or debugging e2e tests under e2e-test-ws/, adding new MCP test scenarios, investigating test failures, understanding test infrastructure, or working with files matching test.cljs in the e2e workspace.
author
Scaffold a conforming AI-layer artifact — a rule, skill, hook, agent, or output style — that already passes the format checks, then verify it. Use when adding any new AI-layer artifact — a shared one under .agents/ or a Claude-only one under .claude/ — so it matches the existing shape instead of drifting.
close
The "wrap" verb of the loop — end the session by writing the journal entry, updating touched project READMEs, committing, and pushing. Auto-invoked as the tail of /spec and /implement (the producer verbs) on clean completion, so "wrap" is not a verb the user types; also runnable directly. Dispatches /implement-audit…
debate
Adversarial debate — spawn competing AI agents to argue a question, then synthesize the strongest conclusion. Use when the user says "debate this", "I'm torn between X and Y", "red-team this plan", or "council on this".
implement-audit
Adversarial review of freshly-built code — find what was missed, what's inconsistent, what breaks. The single code reviewer for the loop, and it runs exactly once per session. Auto-fired by /implement; standalone-callable after any substantial ad-hoc change. Emits the implement-audit: commit trailer the git hook…