# Context Health Check

> <%*

- Skill: `ses770227/context-health-check` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ses770227/context-health-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ses770227/context-health-check/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ses770227 (https://skillmd.com/u/ses770227)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/ses770227/context-health-check

---

<%*
// Configuration
const python = "/Users/samuelxiang/Library/Mobile Documents/iCloud~md~obsidian/Documents/SamHigh/Scripts/AgentSkills/.venv/bin/python";
const script = "/Users/samuelxiang/Library/Mobile Documents/iCloud~md~obsidian/Documents/SamHigh/Scripts/AgentSkills/obsidian_bridge.py";

// Get file content
const content = tp.file.content;
if (!content) {
    new Notice("File is empty!");
    return;
}

// Escape content for shell (double quotes and backslashes)
// 1. Escape backslashes first
// 2. Escape double quotes
const safeContent = content.split("\\").join("\\\\").split('"').join('\"');

// Construct command
// python path and script path need quotes because of spaces in "Mobile Documents"
const cmd = `"${python}" "${script}" analyze_context "${safeContent}"`;

try {
    // Check if user function exists
    if (!tp.user.run_cmd) {
        throw new Error("User function 'run_cmd' not found. Please check Templater settings.");
    }
    
    new Notice("Analyzing context...");
    const result = await tp.user.run_cmd(cmd);
    tR += "\n" + result;
} catch (e) {
    tR += `\n> [!error] Template Error\n> ${e.message}`;
}
%>
