obsidian-mcp-server: Skill for Claude Code

.agents/skills/refactoring/SKILL.md

Refactoring is a skill for Claude Code, Codex from Vasallo94/obsidian-mcp-server. It costs 33 tokens per session (1,836 once invoked), scanned A, original, MIT.

A guide to safely restructuring Python code while keeping its behavior unchanged. Refactoring means improving code structure, such as splitting long functions or removing duplication.

In plain words
What is it for?
Use it to find common code smells, break up oversized functions or modules, remove duplication, and improve readability and maintainability.
Why use it?
It reduces the risk of breaking working code by requiring tests and code-quality checks before and after each small change.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is Vasallo94/obsidian-mcp-server's own configuration. It tells Claude Code and Codex how to work on obsidian-mcp-server 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 obsidian-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Vasallo94/obsidian-mcp-server. 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/Vasallo94/obsidian-mcp-server/main/.agents/skills/refactoring/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Vasallo94/obsidian-mcp-server

Made for: Claude Code, Codex.

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 Refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/vasallo94/obsidian-mcp-server/refactoring.svg)](https://agentmods.dev/skills/vasallo94/obsidian-mcp-server/refactoring)
Your own site
<a href="https://agentmods.dev/skills/vasallo94/obsidian-mcp-server/refactoring"><img src="https://agentmods.dev/badge/skills/vasallo94/obsidian-mcp-server/refactoring.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,836 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00033 $0.01836
Opus 5 $0.00016 $0.00918
Sonnet 5 $0.00007 $0.00367
Haiku 4.5 $0.00003 $0.00184

Measured 6d ago against content hash f6672d51e220, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

Refactoring 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 6d 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.

.agents/skills/refactoring/SKILL.md · 325 lines

How it starts

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

Refactoring Skill

Cuándo usar esta skill

  • Cuando detectes código duplicado.
  • Cuando funciones sean demasiado largas (>50 líneas).
  • Cuando módulos tengan demasiadas responsabilidades.
  • Cuando quieras mejorar la legibilidad o mantenibilidad.

Regla de Oro

Nunca refactorizar sin tests. Ejecuta uv run pytest tests/ antes y después de cada refactoring para verificar que no rompiste nada.

Proceso de Refactoring Seguro

1. Verificar estado inicial

# Tests deben pasar
uv run pytest tests/ -v

# Sin errores de linting/tipos
uv run ruff check . && uv run pyright

2. Hacer cambio pequeño

Solo UN cambio a la vez. No mezclar refactorings.

3. Verificar después del cambio

uv run pytest tests/ -v
uv run ruff check . && uv run pyright

4. Commit si pasa

git add . && git commit -m "refactor(module): descripción breve"

Code Smells Comunes

1. Función Larga (>50 líneas)

Problema: Difícil de entender y testear.

Solución: Extract Method

# ❌ ANTES: Función monolítica
def process_vault(path: Path) -> str:
    # 100 líneas de código...
    pass

# ✅ DESPUÉS: Funciones pequeñas
def process_vault(path: Path) -> str:
    """Procesa el vault completo."""
    notes = _find_notes(path)
    filtered = _filter_forbidden(notes)
    formatted = _format_results(filtered)
    return formatted

def _find_notes(path: Path) -> List[Path]:
    """Busca notas en el vault."""
    return list(path.rglob("*.md"))

def _filter_forbidden(notes: List[Path]) -> List[Path]:
    """Filtra notas prohibidas."""
    return [n for n in notes if not is_forbidden(n)]

def _format_results(notes: List[Path]) -> str:
    """Formatea lista de notas."""
    return "\n".join(str(n) for n in notes)

2. Código Duplicado

Problema: Cambios requieren editar múltiples lugares.

Solución: Extract Function o clase base.

# ❌ ANTES: Duplicado en cada tool
def tool1():
    vault_path = get_vault_path()
    if not vault_path:
        return "❌ Error: La ruta del vault no está configurada."
    # lógica...

def tool2():
    vault_path = get_vault_path()
    if not vault_path:
        return "❌ Error: La ruta del vault no está configurada."
    # lógica...

# ✅ DESPUÉS: Helper reutilizable
def _get_vault_or_error() -> Tuple[Optional[Path], Optional[str]]:
    """Obtiene vault path o mensaje de error."""
    vault_path = get_vault_path()
    if not vault_path:
        return None, "❌ Error: La ruta del vault no está configurada."
    return vault_path, None

def tool1():
    vault_path, error = _get_vault_or_error()
    if error:
        return error
    # lógica...

Read the full file on GitHub · 325 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. 6d ago First seen · 325 lines · 33 tokens per session scan A f6672d51e220

Subscribe to this mod's changes

Refactoring is a skill published in the GitHub repository Vasallo94/obsidian-mcp-server (9 stars, last pushed 4d ago), licensed MIT. It adds 33 tokens to every session and 1,836 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-31.

Related

Other skills, from other repositories

model-context

MCP (Model Context Protocol) - Build AI-native servers with tools, resources, and prompts. TypeScript/Python SDKs for Claude Desktop integration.

bobmatnyc/claude-mpm-skills · 34 tokens

lock-project-stack

Detect a project's manifest (pyproject.toml / package.json / go.mod / Cargo.toml), pin its library set into wet-mcp's Cabinets projectcontext, then route subsequent docs queries to the locked versions automatically.

n24q02m/wet-mcp · 48 tokens

houdini-scripting

Bootstrap skill — controlled Python execution inside Houdini's hython interpreter. Use when no typed Houdini skill covers the task or you need session diagnostics. Not for routine scene edits — prefer houdini-scene or future domain skills.

dcc-mcp/dcc-mcp-houdini · 51 tokens

build-mcp-server

MCP (Model Context Protocol) - Build AI-native servers with tools, resources, and prompts. TypeScript/Python SDKs for Claude Desktop integration.

bobmatnyc/claude-mpm · 36 tokens

gkmex-api-integration

Use when building or troubleshooting an application that consumes Gkmex's public crane inventory through REST, the official JavaScript SDK, or the Python SDK.

gkmex75/gkmex-developer-resources · 37 tokens

click-to-mcp

Auto-wrap any Click or typer Python CLI as an MCP server with zero code changes. Use this skill whenever the user wants to expose a CLI tool to an AI agent via MCP, needs to convert a Click/typer app into an MCP server, wants to run an existing CLI through an LLM, or asks about bridging command-line tools and AI…

Coding-Dev-Tools/click-to-mcp · 104 tokens