All skills
gapmiss avatar

/obsidian

@ff97cb0

Comprehensive guidelines for Obsidian.md plugin development including ESLint rules from eslint-plugin-obsidianmd v0.4.2, TypeScript best practices, memory management, API usage (requestUrl vs fetch), UI/UX standards, popout window compatibility, community.obsidian.md submission process, and Scorecard optimization. Use when working with Obsidian plugins, main.ts files, manifest.json, Plugin class, MarkdownView, TFile, vault operations, or any Obsidian API development.

Use this Skill: https://skilld.dev/gh/gapmiss/obsidian-plugin-skill/obsidian

This session only. Nothing lands on disk.

referencetype-safety.md

≈393 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Type Safety

Type safety is essential for reliable Obsidian plugins. Use proper type narrowing and avoid unsafe type casts.

Avoid Type Casting to TFile/TFolder

Rule: obsidianmd/no-tfile-tfolder-cast

❌ INCORRECT:

const file = abstractFile as TFile;
const folder = <TFolder>abstractFile;

✅ CORRECT:

if (abstractFile instanceof TFile) {
  // TypeScript now knows it's a TFile
  const file = abstractFile;
}

if (abstractFile instanceof TFolder) {
  const folder = abstractFile;
}

Rationale: Type casting bypasses type safety. Use instanceof for safe type narrowing.


Avoid TypeScript any

Rule: Type safety best practice

❌ INCORRECT:

function processData(data: any) {
  return data.value;
}

✅ CORRECT:

// Use specific types
function processData(data: FileData) {
  return data.value;
}

// Or use unknown for truly unknown data
function processData(data: unknown) {
  if (typeof data === 'object' && data !== null && 'value' in data) {
    return (data as { value: string }).value;
  }
}

Rationale: any bypasses type checking. Use specific types or unknown for type safety.


Prefer const and let over var

Rule: Official guidelines (TypeScript best practice)

❌ INCORRECT:

var count = 0;
var settings = {};

✅ CORRECT:

let count = 0;
const settings = {};

Rationale: Use const for values that won't be reassigned and let for values that will. Avoid var for better scoping and fewer bugs.

Source: SKILL.md on GitHub

No alerts5d5 checks · Risk SAFE
  • Gen Agent Trust Hub6d

    The skill is a comprehensive, high-quality documentation resource for Obsidian.md plugin development. It provides correct security guidance (such as XSS prevention), memory management practices, and accessibility standards. No malicious code, data exfiltration, or obfuscation was detected.

  • Socket5d

    No alerts

  • Snyk6d

    Risk: LOW · No issues

  • Runlayer7mo

    9 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ff97cb0. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week
metadata
{
  "version": "1.11.1"
}

README badge

README badge for gapmiss/obsidian-plugin-skill