From apple-notes-pack
Applies Node.js JXA client patterns for Apple Notes automation: list/create/search notes, batch operations with throttling. Triggers on 'apple notes patterns'. For macOS.
How this skill is triggered — by the user, by Claude, or both
Slash command
/apple-notes-pack:apple-notes-sdk-patternsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Production patterns for Apple Notes automation: JXA wrapper class, error handling, batch operations, and cross-account support.
Production patterns for Apple Notes automation: JXA wrapper class, error handling, batch operations, and cross-account support.
// src/notes-client.ts
import { execSync } from "child_process";
class AppleNotesClient {
private runJxa(script: string): string {
const escaped = script.replace(/'/g, "\\'");
return execSync(`osascript -l JavaScript -e '${escaped}'`, {
encoding: "utf8",
timeout: 30000,
}).trim();
}
listNotes(folder?: string, limit: number = 50): Array<{ id: string; title: string; modified: string }> {
const script = folder
? `const Notes = Application("Notes"); const f = Notes.defaultAccount.folders().find(f => f.name() === "${folder}"); (f ? f.notes() : []).slice(0, ${limit}).map(n => JSON.stringify({id: n.id(), title: n.name(), modified: n.modificationDate().toISOString()})).join("\\n")`
: `const Notes = Application("Notes"); Notes.defaultAccount.notes().slice(0, ${limit}).map(n => JSON.stringify({id: n.id(), title: n.name(), modified: n.modificationDate().toISOString()})).join("\\n")`;
return this.runJxa(script).split("\n").filter(Boolean).map(l => JSON.parse(l));
}
createNote(title: string, body: string, folder?: string): string {
const folderPart = folder
? `let f = account.folders().find(f => f.name() === "${folder}"); if (!f) { f = Notes.Folder({name: "${folder}"}); account.folders.push(f); }`
: "let f = account.folders[0];";
return this.runJxa(`
const Notes = Application("Notes");
const account = Notes.defaultAccount;
${folderPart}
const note = Notes.Note({name: ${JSON.stringify(title)}, body: ${JSON.stringify(body)}});
f.notes.push(note);
note.id();
`);
}
searchNotes(query: string): Array<{ title: string; folder: string }> {
const result = this.runJxa(`
const Notes = Application("Notes");
const q = "${query}".toLowerCase();
Notes.defaultAccount.notes().filter(n =>
n.name().toLowerCase().includes(q) || n.body().toLowerCase().includes(q)
).slice(0, 20).map(n => JSON.stringify({title: n.name(), folder: n.container().name()})).join("\\n");
`);
return result.split("\n").filter(Boolean).map(l => JSON.parse(l));
}
}
export { AppleNotesClient };
async function batchCreateNotes(
client: AppleNotesClient,
notes: Array<{ title: string; body: string; folder?: string }>,
delayMs: number = 500,
): Promise<string[]> {
const ids: string[] = [];
for (const note of notes) {
const id = client.createNote(note.title, note.body, note.folder);
ids.push(id);
await new Promise(r => setTimeout(r, delayMs));
}
return ids;
}
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin apple-notes-packAutomates Apple Notes on macOS: create, read, list, search, and delete using JXA and AppleScript via osascript. For learning scripting or testing note access.
Automates Apple Notes via JXA. Use when asked to "create notes programmatically", "automate Notes app", "JXA notes scripting", or "organize notes with automation". Covers accounts/folders/notes, HTML bodies, queries, moves, and Objective-C/UI fallbacks for Notes.app automation on macOS.
Manages Apple Notes on macOS: create, search, read, update, delete and organize notes and folders via natural language commands.