awesome-obsidian-skills / obsidian-claude-code
CLAUDE.md9 starsChanged 10 months agoCC0-1.0View on GitHub
We use Bun for package management but esbuild for bundling (Obsidian's standard approach). Then in Obsidian: Settings > Community Plugins > Reload Solution: Explicitly provide pathToClaudeCodeExecutable option: The plugin auto-detects Claude in common locations: - ~/.nvm/versions/node/*/bin/claude - /usr/local/bin/claude - /opt/homebrew/bin/claude
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Roasbeef/obsidian-claude-codeword for word, first seen Jan 13, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Roasbeef/obsidian-claude-code★ 217100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- skills/claudian/AGENTS.mdAGENTS.md
- skills/claudian/CLAUDE.mdCLAUDE.md
- excalidraw-diagramSkill
- mermaid-visualizerSkill
- obsidian-canvas-creatorSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
17 rules. About 0 are common, 12 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 118
Use simplified model names (not full IDs):
- Very specific: line 124
Use vault.adapter.exists() and vault.adapter.write() instead of vault.getAbstractFileByPath() for more reliable file operations.
- Very specific: line 148
Claude Max subscription: - Run claude setup-token to create CLAUDE_CODE_OAUTH_TOKEN
- Distinctive: line 169
Use complete sentences ending with periods for comments.
- Distinctive: line 170
Follow Obsidian plugin patterns (ItemView, PluginSettingTab, etc.)
- Very specific: line 208
Use Vitest for all tests (describe, it, expect).
- Very specific: line 210
Use factories in tests/helpers/factories.ts for test data.
- Distinctive: line 226
Use fast-check for invariant testing:
- Distinctive: line 254
Import ordering enforced (builtin → external → internal).
- Distinctive: line 255
No floating promises allowed.
- Distinctive: line 265
test: - Run tests with coverage.
- Distinctive: line 266
build: - Verify production build.
- Very specific: line 281
Run make check - All checks must pass.
- Distinctive: line 282
Add tests for new functionality.
- Distinctive: line 283
Ensure coverage doesn't decrease.
- Distinctive: line 284
Update CLAUDE.md if adding new features.
- Distinctive: line 288
No decrease in coverage.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
obsidian-claude-code
Project Overview
Obsidian plugin that embeds Claude AI as an assistant using the Claude Agent SDK. Features built-in tools, skill loading, and custom Obsidian-specific tools via SDK MCP server.
Development Commands
# Install dependencies (use bun, not npm)
bun install
# Development mode with watch
bun run dev
# Production build
bun run build
# Type check only
bun run typecheck
# Run all checks (typecheck + lint + test)
make check
# Quick dev check (typecheck + unit tests only)
make quickPackage Manager
Use bun for all package management operations:
bun install- Install dependenciesbun add <package>- Add dependencybun add -d <package>- Add dev dependencybun remove <package>- Remove dependency
We use Bun for package management but esbuild for bundling (Obsidian's standard approach).
Project Structure
src/
├── main.ts # Plugin entry point
├── types.ts # TypeScript types
├── interfaces/ # DI interfaces for testability
│ ├── IVaultAdapter.ts # File system abstraction
│ ├── IConversationStorage.ts # Persistence abstraction
│ └── ILogger.ts # Logging abstraction
├── utils/
│ └── Logger.ts # File-based debug logging
├── agent/
│ ├── AgentController.ts # Claude Agent SDK query() orchestration
│ ├── ConversationManager.ts # Session/history persistence
│ └── ObsidianMcpServer.ts # Custom Obsidian tools via SDK MCP
├── views/
│ ├── ChatView.ts # Main sidebar (ItemView)
│ ├── MessageList.ts # Message rendering
│ ├── MessageRenderer.ts # Individual message
│ ├── ToolCallDisplay.ts # Tool call UI
│ ├── ChatInput.ts # Input with autocomplete
│ ├── AutocompletePopup.ts # Command/file suggestions
│ └── ConversationHistoryModal.ts # History browser
└── settings/
└── SettingsTab.ts # Settings UI
tests/
├── unit/ # Pure function tests
├── integration/ # Tests with mocked Obsidian
├── property/ # Property-based tests (fast-check)
├── mocks/
│ ├── obsidian/ # Obsidian API mocks
│ └── claude-sdk/ # Claude SDK mocks
├── helpers/ # Test utilities
└── setup.ts # Global test setupTesting in Obsidian
Symlink plugin to vault for hot-reload testing:
ln -s /Users/roasbeef/codez/obsidian-claude-code \
/path/to/vault/.obsidian/plugins/obsidian-claude-codeThen in Obsidian: Settings > Community Plugins > Reload
Key Architecture Decisions
- Desktop-only - Requires Node.js for Claude Agent SDK
- Uses
@anthropic-ai/claude-agent-sdkwithquery()function - Built-in tools (Read, Write, Bash, Grep, etc.) from SDK presets
- Skills auto-load from
vault/.claude/skills/viasettingSources: ['project'] - Custom Obsidian tools via SDK MCP server (
ObsidianMcpServer.ts) - Supports Claude Max subscription via
CLAUDE_CODE_OAUTH_TOKENenv var - Conversations stored in
.obsidian-claude-code/in vault - Right sidebar ItemView (Cursor-style chat)
- Debug logs written to
~/.obsidian-claude-code/debug.log
Electron/Obsidian Environment Considerations
Claude CLI Path Resolution
The Agent SDK internally spawns the Claude Code CLI. In bundled Electron environments (like Obsidian), import.meta.url doesn't work, so the SDK can't auto-find the CLI.
Solution: Explicitly provide pathToClaudeCodeExecutable option:
query({
prompt: content,
options: {
pathToClaudeCodeExecutable: "/path/to/claude",
// ...
}
})The plugin auto-detects Claude in common locations:
~/.nvm/versions/node/*/bin/claude/usr/local/bin/claude/opt/homebrew/bin/claude
PATH for Node.js
The Claude CLI is a Node.js script (#!/usr/bin/env node). Obsidian's Electron doesn't have nvm's PATH. The plugin adds the Claude bin directory to env.PATH when calling query().
Model Selection
Use simplified model names (not full IDs):
"sonnet"- Claude Sonnet 4 (faster)"opus"- Claude Opus 4.5 (more capable)"haiku"- Claude Haiku (fastest)
Obsidian File API
Use vault.adapter.exists() and vault.adapter.write() instead of vault.getAbstractFileByPath() for more reliable file operations. Obsidian's internal caching can cause race conditions with vault.create().
Dependencies
obsidian- Obsidian API@anthropic-ai/claude-agent-sdk- Claude Agent SDKzod- Schema validation for SDK MCP tools
Obsidian-Specific Tools (SDK MCP Server)
The plugin exposes these Obsidian-specific tools to Claude:
mcp__obsidian__open_file- Open file in Obsidian viewmcp__obsidian__execute_command- Run Obsidian commandmcp__obsidian__show_notice- Display notificationmcp__obsidian__get_active_file- Get current file infomcp__obsidian__rebuild_vault_index- Trigger vault-search index rebuildmcp__obsidian__list_commands- Discover available commandsmcp__obsidian__create_note- Create new notesmcp__obsidian__reveal_in_explorer- Show in file explorermcp__obsidian__get_vault_stats- Vault statisticsmcp__obsidian__get_recent_files- Recently modified files
Authentication
The plugin supports three authentication methods:
- API Key in Settings - Enter key in plugin settings
- ANTHROPIC_API_KEY env var - Set in your shell environment
- Claude Max subscription - Run
claude setup-tokento createCLAUDE_CODE_OAUTH_TOKEN
For GUI apps like Obsidian to inherit env vars on macOS:
launchctl setenv CLAUDE_CODE_OAUTH_TOKEN "$(echo $CLAUDE_CODE_OAUTH_TOKEN)"Debugging
Debug logs are written to ~/.obsidian-claude-code/debug.log. Tail them during development:
tail -f ~/.obsidian-claude-code/debug.logKey log components:
[Plugin]- Plugin lifecycle[ChatView]- UI and message handling[ChatInput]- Input and key events[AgentController]- SDK query and tool execution[ConversationManager]- Persistence
Coding Conventions
- Use complete sentences ending with periods for comments.
- Follow Obsidian plugin patterns (ItemView, PluginSettingTab, etc.)
- CSS classes prefixed with
claude-code- - Log important events with the Logger utility
Testing
Running Tests
# Run all tests
make test
# Run tests with watch mode
make test-watch
# Run specific test suites
make test-unit # Unit tests only
make test-integration # Integration tests only
make test-property # Property-based tests only
# Run with coverage report
make coverage
make coverage-report # Opens HTML report in browserTest Structure
tests/
├── unit/ # Pure function tests (no Obsidian deps)
├── integration/ # Tests with mocked Obsidian APIs
├── property/ # Property-based tests with fast-check
├── mocks/
│ ├── obsidian/ # App, Vault, ItemView, Modal mocks
│ └── claude-sdk/ # SDK query() mock
├── fixtures/ # Test data (conversations, messages)
└── helpers/ # Test utilities, factoriesWriting Tests
- Use Vitest for all tests (
describe,it,expect). - Mock Obsidian APIs using mocks in
tests/mocks/obsidian/. - Use factories in
tests/helpers/factories.tsfor test data. - Property tests go in
.prop.test.tsfiles. - Target 85%+ coverage for all new code.
Mocking Obsidian
import { createMockApp, createMockVault } from "../mocks/obsidian";
const mockApp = createMockApp();
const mockVault = createMockVault();
// Configure mock behavior.
mockVault.getMarkdownFiles.mockReturnValue([...]);Property-Based Testing
Use fast-check for invariant testing:
import fc from "fast-check";
fc.assert(
fc.property(fc.string(), (input) => {
const result = myFunction(input);
expect(result).toBeDefined();
})
);Pure Functions to Test
Key pure functions suitable for unit testing:
classifyError()in AgentController.ts - Error type classification.generateId()- Unique ID generation.generateTitle()- Title truncation from content.
Linting
Running Linter
make lint # Check for issues
make lint-fix # Auto-fix issuesESLint Rules
- Strict TypeScript rules enabled (type-aware).
- Import ordering enforced (builtin → external → internal).
- No floating promises allowed.
- Strict boolean expressions required.
- Unused vars must be prefixed with
_.
CI/CD
GitHub Actions
CI runs on every push and PR to main/develop:
- typecheck - TypeScript type checking.
- lint - ESLint checks.
- test - Run tests with coverage.
- build - Verify production build.
Coverage Requirements
- Target: 85% line coverage.
- Coverage reports uploaded to Codecov.
- CI warns if coverage drops below threshold.
Running CI Locally
make ci # Run full CI pipeline locallyContributing
Before Opening a PR
- Run
make check- All checks must pass. - Add tests for new functionality.
- Ensure coverage doesn't decrease.
- Update CLAUDE.md if adding new features.
Code Review Expectations
- Tests for new code paths.
- No decrease in coverage.
- Follow existing patterns.
- Clear commit messages.
Dependency Injection
Interfaces for Testability
Located in src/interfaces/:
IVaultAdapter- Abstract file system operations.IConversationStorage- Abstract conversation persistence.ILogger- Abstract logging.
Usage Pattern
class MyClass {
constructor(
plugin: ClaudeCodePlugin,
deps?: {
vaultAdapter?: IVaultAdapter;
logger?: ILogger;
}
) {
this.vault = deps?.vaultAdapter ?? new ObsidianVaultAdapter(plugin.app.vault);
this.logger = deps?.logger ?? defaultLogger;
}
}This allows injecting mocks in tests without modifying production code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

