med-paper-assistant: Skill for Claude Code

.claude/skills/code-refactor/SKILL.md

code-refactor is a skill for Claude Code from u9401066/med-paper-assistant. It costs 36 tokens per session (718 once invoked), scanned A, original, Apache-2.0.

A code-refactoring workflow finds code that is too large, complex, deeply nested, or tightly connected, then plans and carries out structural improvements. It follows domain-driven design (DDD), an approach that organizes software around the business areas it represents.

In plain words
What is it for?
Use it to split long functions, oversized classes, crowded modules, repeated logic, and complicated conditionals. It can also plan tests and verify that tests pass after each refactoring step.
Why use it?
It helps prevent code from becoming difficult to understand and change as the project grows. It also checks that the project’s architectural layers keep the intended dependency direction.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is u9401066/med-paper-assistant's own configuration. It tells Claude Code how to work on med-paper-assistant itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything med-paper-assistant configures →

Reuse

Borrowing it

Nothing to install: this file belongs to u9401066/med-paper-assistant. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/u9401066/med-paper-assistant/master/.claude/skills/code-refactor/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/u9401066/med-paper-assistant

Made for: Claude Code.

Wrote 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.

agentmods badge for code-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/u9401066/med-paper-assistant/code-refactor/github.svg)](https://agentmods.dev/skills/u9401066/med-paper-assistant/code-refactor)
Your own site
<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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-refactor

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.00718
Opus 5.5 $0.00014 $0.00287
Sonnet 5.5 $0.00007 $0.00144
Haiku 4.5 $0.00004 $0.00072

Measured 1mo ago against content hash 4f6a2343949d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 1mo 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.

.claude/skills/code-refactor/SKILL.md · 67 lines

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 包含持久化邏輯。


重構流程

  1. 偵測:報告檔案/函數/複雜度超標情況
  2. 分析:識別重複邏輯、隱藏 Value Object、職責分離點
  3. 規劃:列出重構步驟(新檔案、遷移、測試)
  4. 執行:逐步重構,每步確認測試通過
  5. 驗證:全部測試通過、覆蓋率、複雜度、DDD 合規

與其他 Skills 整合

Skill 整合
code-reviewer 審查時觸發重構建議
test-generator 重構前先生成測試
ddd-architect 確保重構符合 DDD
memory-updater 記錄重構決策
Changes

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.

  1. 1mo ago First seen · 67 lines · 36 tokens per session scan A 4f6a2343949d

Subscribe to this mod's changes

code-refactor is a skill published in the GitHub repository u9401066/med-paper-assistant (12 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 36 tokens to every session and 718 once invoked, about $0.0001 per session on Opus 5.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.

Related

Other skills, from other repositories

systemic-issue-triage

Trigger: new issue, bug report, triage, backlog, issue flood, community report, root cause, dead-end, blocked user. Attack issues by root class, never one-by-one; fixes must shrink the system, not grow it.

Gentleman-Programming/gentle-ai · 57 tokens

issue-root-resolution

Trigger: root audit, atacar la raíz, issue roots, backlog roots, mechanism map, deletion-driven fix, resolver issues de raíz, close outdated issues. Audit and resolve issue clusters by verified root cause.

Gentleman-Programming/gentle-ai · 45 tokens

rdd-defect-workflow

Trigger: RDD, receipt-driven development, review authority, receipt/lineage, correction/recovery, delivery gate/kill switch, bounded review defects. Guide work.

Gentleman-Programming/gentle-ai · 41 tokens

nightly-audit-engineer-getting-started

A first-conversation guide for setting up a code-audit assistant. A code audit is a focused review of source code for defects or risky behavior, with the needed repository, scope, concerns, permissions, and schedule clarified first.

makecindy/cindy · 46 tokens

nightly-audit-engineer-ops

A workflow for reviewing code for reproducible quality problems and recording the evidence behind each finding. It follows data through inputs, permissions, storage, asynchronous work, and recovery, then suggests the smallest authorized fix.

makecindy/cindy · 43 tokens

nightly-audit-engineer-evidence

A small local checker that creates stable identifiers for code-audit findings and marks duplicates within the current batch or among previously seen findings. It processes supplied JSON with Python and does not infer whether a problem was fixed.

makecindy/cindy · 37 tokens