academic-figures-mcp: Skill for Claude Code

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

code-refactor is a skill for Claude Code from u9401066/academic-figures-mcp. It costs 50 tokens per session (2,401 once invoked), scanned A, a copy of code-refactor, Apache-2.0.

A code-maintenance workflow that finds overly large or complex code and applies small refactorings while following domain-driven design, an approach that organizes code around the business domain.

In plain words
What is it for?
Use it to break up long files, classes, or functions, reduce deep nesting and too many dependencies, and separate repeated or unrelated logic into modules.
Why use it?
It helps prevent code from becoming difficult to understand and change. It uses size and complexity thresholds to identify likely problem areas and suggests patterns such as splitting long functions.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is u9401066/academic-figures-mcp's own configuration. It tells Claude Code how to work on academic-figures-mcp 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 academic-figures-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to u9401066/academic-figures-mcp. 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/academic-figures-mcp/main/.claude/skills/code-refactor/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/u9401066/academic-figures-mcp

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/academic-figures-mcp/code-refactor/github.svg)](https://agentmods.dev/skills/u9401066/academic-figures-mcp/code-refactor)
Your own site
<a href="https://agentmods.dev/skills/u9401066/academic-figures-mcp/code-refactor"><img src="https://agentmods.dev/badge/skills/u9401066/academic-figures-mcp/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/academic-figures-mcp/code-refactor"><img src="https://agentmods.dev/badge/skills/u9401066/academic-figures-mcp/code-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,401 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 100% copy Near-identical to another mod 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.00050 $0.02401
Opus 5.5 $0.00020 $0.00960
Sonnet 5.5 $0.00010 $0.00480
Haiku 4.5 $0.00005 $0.00240

Measured 1mo ago against content hash fe7f24f62fbc, 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.

Origin

This is a copy

100% identical to code-refactor — 10 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

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

How it starts

The opening of the file, as written. The whole thing — 352 lines — stays where its author put it; the contents beside it link to each section on GitHub.

程式碼重構技能

描述

主動偵測並執行程式碼重構,維持 DDD 架構和程式碼品質。

觸發條件

  • 「重構這段程式碼」、「refactor」
  • 「這個檔案太長了」
  • 「模組化」、「拆分」
  • 主動觸發:偵測到程式碼超過閾值時

核心原則

📜 依據憲法第 7.3 條「主動重構原則」

重構不是改天換地,而是持續的小步快跑
每次提交都應該比上次更乾淨

閾值設定

📏 長度閾值

類型 警告 強制重構
檔案 > 200 行 > 400 行
類別 > 150 行 > 300 行
函數 > 30 行 > 50 行
目錄檔案數 > 10 個 > 15 個

🔄 複雜度閾值

指標 警告 強制重構
圈複雜度 > 10 > 15
巢狀深度 > 3 層 > 4 層
參數數量 > 4 個 > 6 個
依賴數量 > 5 個 > 8 個

重構模式庫

1️⃣ Extract Method(提取方法)

觸發條件:函數過長、重複邏輯

# Before
def process_order(order):
    # 驗證訂單 (10 行)
    if not order.items:
        raise ValueError("Empty order")
    if order.total < 0:
        raise ValueError("Invalid total")
    # ... 更多驗證

    # 計算價格 (15 行)
    subtotal = sum(item.price * item.qty for item in order.items)
    tax = subtotal * 0.05
    total = subtotal + tax
    # ... 更多計算

    # 儲存訂單 (10 行)
    # ...

# After
def process_order(order):
    self._validate_order(order)
    total = self._calculate_total(order)
    self._save_order(order, total)

def _validate_order(self, order):
    """驗證訂單有效性"""
    if not order.items:
        raise ValueError("Empty order")
    # ...

def _calculate_total(self, order) -> Decimal:
    """計算訂單總金額(含稅)"""
    subtotal = sum(item.price * item.qty for item in order.items)
    return subtotal * Decimal("1.05")

2️⃣ Extract Class(提取類別)

觸發條件:類別職責過多、超過 150 行

# Before: User 類別包含太多職責
class User:
    def __init__(self, name, email, ...):
        self.name = name
        self.email = email
        self.address_line1 = ...
        self.address_line2 = ...
        self.city = ...
        self.postal_code = ...

    def validate_email(self): ...
    def format_address(self): ...
    def calculate_shipping(self): ...

# After: 提取 Address 值物件
@dataclass(frozen=True)
class Address:
    """地址值物件"""
    line1: str
    line2: str | None
    city: str
    postal_code: str

    def format(self) -> str:
        return f"{self.line1}\n{self.city} {self.postal_code}"

class User:
    def __init__(self, name: str, email: Email, address: Address):
        self.name = name
        self.email = email
        self.address = address

Read the full file on GitHub · 352 lines

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 · 352 lines · 50 tokens per session scan A fe7f24f62fbc

Subscribe to this mod's changes

code-refactor is a skill published in the GitHub repository u9401066/academic-figures-mcp (1 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 50 tokens to every session and 2,401 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to code-refactor, differing in 10 lines, and is treated as a copy.

Related

Other skills, from other repositories

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

deck-retro

Run a fully local agent-deck retrospective over the user's own transcripts, Recall index and logs. Use when a user wants to find recurring failures or take their own finding from investigation through synthetic reproduction, a user-filed issue, a test-first fix and contributor PR handoff. Also use for weekly usage…

asheshgoplani/agent-deck · 86 tokens

incident-response-incident-response

Coordinate production incident triage, mitigation, investigation, recovery, and follow-up. Use when responding to outages or other incidents that require structured operational coordination.

rmyndharis/antigravity-skills · 36 tokens

cwv-optimizer

Diagnose and fix Core Web Vitals issues on AEM Edge Delivery Services pages. Goes deeper than generic CWV advice by understanding EDS-specific performance patterns including the 100KB LCP budget, E-L-D loading phases, block rendering behavior, and third-party script impact. Produces specific fixes for LCP, CLS, and…

adobe/skills · 112 tokens