[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F6GZK2PT4Y596M13RBE3MY":3,"skill-same:01M6F6GZK2PT4Y596M13RBE3MY":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6F6GZK2PT4Y596M13RBE3MY","evernote-sdk-patterns",null,"Advanced Evernote SDK patterns and best practices.\nUse when implementing complex note operations, batch processing,\nsearch queries, or optimizing SDK usage.\nTrigger with phrases like \"evernote sdk patterns\", \"evernote best practices\",\n\"evernote advanced\", \"evernote batch operations\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fevernote-pack\u002Fskills\u002Fevernote-sdk-patterns\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"sdk","evernote","evernote sdk patterns","patterns","when","implementing","usage","advanced","with","note","processing","trigger","io","queries","use","operations","edit","write","read","grep","batch","search","best practices","2026-11-10 10:12:30",false,"---\nname: evernote-sdk-patterns\ndescription: |\n  Advanced Evernote SDK patterns and best practices.\n  Use when implementing complex note operations, batch processing,\n  search queries, or optimizing SDK usage.\n  Trigger with phrases like \"evernote sdk patterns\", \"evernote best practices\",\n  \"evernote advanced\", \"evernote batch operations\".\nallowed-tools: Read, Write, Edit, Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# Evernote SDK Patterns\n\n## Overview\n\nProduction-ready patterns for working with the Evernote SDK, including search, filtering, batch operations, and resource handling.\n\n## Prerequisites\n\n- Completed `evernote-install-auth` and `evernote-hello-world`\n- Understanding of Evernote data model (Notes, Notebooks, Tags, Resources)\n- Familiarity with Promises\u002Fasync patterns\n\n## Core Patterns\n\n### Pattern 1: Search with NoteFilter\n\n```javascript\nconst Evernote = require('evernote');\n\nasync function searchNotes(noteStore, searchQuery, maxResults = 100) {\n  \u002F\u002F Create filter with search grammar\n  const filter = new Evernote.NoteStore.NoteFilter({\n    words: searchQuery,\n    ascending: false,\n    order: Evernote.Types.NoteSortOrder.UPDATED\n  });\n\n  \u002F\u002F Specify which metadata to return\n  const spec = new Evernote.NoteStore.NotesMetadataResultSpec({\n    includeTitle: true,\n    includeContentLength: true,\n    includeCreated: true,\n    includeUpdated: true,\n    includeTagGuids: true,\n    includeNotebookGuid: true\n  });\n\n  \u002F\u002F Find notes (offset, maxNotes)\n  const result = await noteStore.findNotesMetadata(filter, 0, maxResults, spec);\n\n  console.log(`Found ${result.totalNotes} notes (returned ${result.notes.length})`);\n  return result;\n}\n\n\u002F\u002F Usage examples:\n\u002F\u002F searchNotes(noteStore, 'tag:important notebook:Work');\n\u002F\u002F searchNotes(noteStore, 'intitle:meeting created:day-7');\n\u002F\u002F searchNotes(noteStore, 'todo:false'); \u002F\u002F Unchecked todos\n```\n\n### Pattern 2: Search Grammar Queries\n\n```javascript\n\u002F\u002F Build complex search queries\nfunction buildSearchQuery(options = {}) {\n  const parts = [];\n\n  if (options.notebook) {\n    parts.push(`notebook:\"${options.notebook}\"`);\n  }\n\n  if (options.tags && options.tags.length) {\n    options.tags.forEach(tag => parts.push(`tag:\"${tag}\"`));\n  }\n\n  if (options.excludeTags && options.excludeTags.length) {\n    options.excludeTags.forEach(tag => parts.push(`-tag:\"${tag}\"`));\n  }\n\n  if (options.createdAfter) {\n    parts.push(`created:${formatDateForSearch(options.createdAfter)}`);\n  }\n\n  if (options.updatedAfter) {\n    parts.push(`updated:${formatDateForSearch(options.updatedAfter)}`);\n  }\n\n  if (options.inTitle) {\n    parts.push(`intitle:\"${options.inTitle}\"`);\n  }\n\n  if (options.hasAttachments) {\n    parts.push('resource:*');\n  }\n\n  if (options.hasTodos !== undefined) {\n    parts.push(`todo:${options.hasTodos}`);\n  }\n\n  if (options.text) {\n    parts.push(options.text);\n  }\n\n  \u002F\u002F Use 'any:' for OR logic, default is AND\n  if (options.matchAny) {\n    return 'any: ' + parts.join(' ');\n  }\n\n  return parts.join(' ');\n}\n\nfunction formatDateForSearch(date) {\n  \u002F\u002F Format: YYYYMMDD\n  return date.toISOString().slice(0, 10).replace(\u002F-\u002Fg, '');\n}\n\n\u002F\u002F Example: Find notes tagged \"urgent\" in \"Work\" notebook from last week\nconst query = buildSearchQuery({\n  notebook: 'Work',\n  tags: ['urgent'],\n  createdAfter: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)\n});\n\u002F\u002F Result: 'notebook:\"Work\" tag:\"urgent\" created:20240115'\n```\n\n### Pattern 3: Paginated Note Retrieval\n\n```javascript\nasync function* getAllNotesMetadata(noteStore, filter, spec, pageSize = 100) {\n  let offset = 0;\n  let hasMore = true;\n\n  while (hasMore) {\n    const result = await noteStore.findNotesMetadata(filter, offset, pageSize, spec);\n\n    for (const note of result.notes) {\n      yield note;\n    }\n\n    offset += result.notes.length;\n    hasMore = offset \u003C result.totalNotes;\n\n    console.log(`Progress: ${offset}\u002F${result.totalNotes}`);\n  }\n}\n\n\u002F\u002F Usage with async iteration\nasync function processAllNotes(noteStore) {\n  const filter = new Evernote.NoteStore.NoteFilter({ words: 'tag:process' });\n  const spec = new Evernote.NoteStore.NotesMetadataResultSpec({\n    includeTitle: true,\n    includeUpdated: true\n  });\n\n  for await (const note of getAllNotesMetadata(noteStore, filter, spec)) {\n    console.log(`Processing: ${note.title}`);\n    \u002F\u002F Process each note\n  }\n}\n```\n\n### Pattern 4: Efficient Note Content Retrieval\n\n```javascript\nasync function getNoteWithOptions(noteStore, noteGuid, options = {}) {\n  const {\n    withContent = true,\n    withResources = false,\n    withRecognition = false,\n    withAlternateData = false\n  } = options;\n\n  return noteStore.getNote(\n    noteGuid,\n    withContent,\n    withResources,        \u002F\u002F Include binary resource data\n    withRecognition,      \u002F\u002F Include OCR data\n    withAlternateData     \u002F\u002F Include alternate representations\n  );\n}\n\n\u002F\u002F Only get content (most common)\nconst note = await getNoteWithOptions(noteStore, guid);\n\n\u002F\u002F Get note with all attachments\nconst noteWithFiles = await getNoteWithOptions(noteStore, guid, {\n  withResources: true\n});\n```\n\n### Pattern 5: Creating Notes with Attachments\n\n```javascript\nconst crypto = require('crypto');\nconst fs = require('fs');\nconst path = require('path');\n\nasync function createNoteWithAttachment(noteStore, title, content, filePath) {\n  const Evernote = require('evernote');\n\n  \u002F\u002F Read file and compute hash\n  const fileBuffer = fs.readFileSync(filePath);\n  const hash = crypto.createHash('md5').update(fileBuffer).digest('hex');\n  const mimeType = getMimeType(filePath);\n\n  \u002F\u002F Create resource (attachment)\n  const resource = new Evernote.Types.Resource();\n  resource.data = new Evernote.Types.Data();\n  resource.data.body = fileBuffer;\n  resource.data.size = fileBuffer.length;\n  resource.data.bodyHash = Buffer.from(hash, 'hex');\n  resource.mime = mimeType;\n\n  \u002F\u002F Set file attributes\n  resource.attributes = new Evernote.Types.ResourceAttributes();\n  resource.attributes.fileName = path.basename(filePath);\n\n  \u002F\u002F Create ENML with embedded resource\n  const enml = `\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE en-note SYSTEM \"http:\u002F\u002Fxml.evernote.com\u002Fpub\u002Fenml2.dtd\">\n\u003Cen-note>\n  ${content}\n  \u003Cen-media type=\"${mimeType}\" hash=\"${hash}\"\u002F>\n\u003C\u002Fen-note>`;\n\n  \u002F\u002F Create note\n  const note = new Evernote.Types.Note();\n  note.title = title;\n  note.content = enml;\n  note.resources = [resource];\n\n  return noteStore.createNote(note);\n}\n\nfunction getMimeType(filePath) {\n  const ext = path.extname(filePath).toLowerCase();\n  const mimeTypes = {\n    '.png': 'image\u002Fpng',\n    '.jpg': 'image\u002Fjpeg',\n    '.jpeg': 'image\u002Fjpeg',\n    '.gif': 'image\u002Fgif',\n    '.pdf': 'application\u002Fpdf',\n    '.txt': 'text\u002Fplain',\n    '.doc': 'application\u002Fmsword',\n    '.docx': 'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document'\n  };\n  return mimeTypes[ext] || 'application\u002Foctet-stream';\n}\n```\n\n### Pattern 6: Working with Tags\n\n```javascript\nasync function getOrCreateTag(noteStore, tagName) {\n  \u002F\u002F Try to find existing tag\n  const tags = await noteStore.listTags();\n  const existing = tags.find(t =>\n    t.name.toLowerCase() === tagName.toLowerCase()\n  );\n\n  if (existing) {\n    return existing;\n  }\n\n  \u002F\u002F Create new tag\n  const tag = new Evernote.Types.Tag();\n  tag.name = tagName;\n  return noteStore.createTag(tag);\n}\n\nasync function addTagsToNote(noteStore, noteGuid, tagNames) {\n  \u002F\u002F Get current note\n  const note = await noteStore.getNote(noteGuid, false, false, false, false);\n\n  \u002F\u002F Resolve tag names to GUIDs\n  const tagGuids = await Promise.all(\n    tagNames.map(async name => {\n      const tag = await getOrCreateTag(noteStore, name);\n      return tag.guid;\n    })\n  );\n\n  \u002F\u002F Merge with existing tags\n  const existingTags = note.tagGuids || [];\n  const allTags = [...new Set([...existingTags, ...tagGuids])];\n\n  \u002F\u002F Update note\n  note.tagGuids = allTags;\n  return noteStore.updateNote(note);\n}\n```\n\n### Pattern 7: Notebook Operations\n\n```javascript\nasync function getOrCreateNotebook(noteStore, notebookName, stack = null) {\n  const notebooks = await noteStore.listNotebooks();\n  const existing = notebooks.find(n =>\n    n.name.toLowerCase() === notebookName.toLowerCase()\n  );\n\n  if (existing) {\n    return existing;\n  }\n\n  const notebook = new Evernote.Types.Notebook();\n  notebook.name = notebookName;\n  if (stack) {\n    notebook.stack = stack;\n  }\n\n  return noteStore.createNotebook(notebook);\n}\n\nasync function moveNoteToNotebook(noteStore, noteGuid, notebookName) {\n  const notebook = await getOrCreateNotebook(noteStore, notebookName);\n  const note = await noteStore.getNote(noteGuid, false, false, false, false);\n\n  note.notebookGuid = notebook.guid;\n  return noteStore.updateNote(note);\n}\n```\n\n### Pattern 8: Error Handling Wrapper\n\n```javascript\nclass EvernoteError extends Error {\n  constructor(originalError) {\n    super(originalError.message || 'Evernote API error');\n    this.name = 'EvernoteError';\n    this.code = originalError.errorCode;\n    this.parameter = originalError.parameter;\n    this.rateLimitDuration = originalError.rateLimitDuration;\n    this.original = originalError;\n  }\n\n  get isRateLimit() {\n    return this.code === Evernote.Errors.EDAMErrorCode.RATE_LIMIT_REACHED;\n  }\n\n  get isNotFound() {\n    return this.code === Evernote.Errors.EDAMErrorCode.UNKNOWN;\n  }\n\n  get isInvalidData() {\n    return this.code === Evernote.Errors.EDAMErrorCode.BAD_DATA_FORMAT;\n  }\n}\n\nasync function withErrorHandling(operation) {\n  try {\n    return await operation();\n  } catch (error) {\n    if (error.errorCode !== undefined) {\n      throw new EvernoteError(error);\n    }\n    throw error;\n  }\n}\n\n\u002F\u002F Usage\ntry {\n  const note = await withErrorHandling(() =>\n    noteStore.getNote(guid, true, false, false, false)\n  );\n} catch (error) {\n  if (error instanceof EvernoteError && error.isRateLimit) {\n    console.log(`Rate limited. Retry in ${error.rateLimitDuration}s`);\n  }\n}\n```\n\n### Pattern 9: Batch Operations with Rate Limit Handling\n\n```javascript\nasync function batchProcess(items, operation, options = {}) {\n  const {\n    concurrency = 1,  \u002F\u002F Keep at 1 to avoid rate limits\n    delayMs = 100,\n    onProgress = () => {}\n  } = options;\n\n  const results = [];\n  let processed = 0;\n\n  for (const item of items) {\n    try {\n      const result = await operation(item);\n      results.push({ success: true, item, result });\n    } catch (error) {\n      if (error.rateLimitDuration) {\n        \u002F\u002F Wait for rate limit to clear\n        console.log(`Rate limited, waiting ${error.rateLimitDuration}s...`);\n        await sleep(error.rateLimitDuration * 1000);\n        \u002F\u002F Retry\n        const result = await operation(item);\n        results.push({ success: true, item, result });\n      } else {\n        results.push({ success: false, item, error });\n      }\n    }\n\n    processed++;\n    onProgress(processed, items.length);\n\n    \u002F\u002F Add delay between operations\n    if (processed \u003C items.length) {\n      await sleep(delayMs);\n    }\n  }\n\n  return results;\n}\n\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\n\n\u002F\u002F Usage\nconst notes = await searchNotes(noteStore, 'tag:archive');\nconst results = await batchProcess(\n  notes.notes,\n  note => noteStore.deleteNote(note.guid),\n  {\n    delayMs: 200,\n    onProgress: (done, total) => console.log(`${done}\u002F${total}`)\n  }\n);\n```\n\n## Output\n\n- Reusable SDK patterns for common operations\n- Efficient search with NoteFilter\n- Pagination for large result sets\n- Attachment handling with proper MIME types\n- Tag and notebook management utilities\n- Production error handling\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `RATE_LIMIT_REACHED` | Too many API calls | Use rateLimitDuration, add delays |\n| `BAD_DATA_FORMAT` | Invalid ENML | Validate before sending |\n| `DATA_CONFLICT` | Concurrent modification | Refetch and retry |\n| `QUOTA_REACHED` | Account storage full | Check user's remaining quota |\n\n## Resources\n\n- [API Reference](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Freference\u002F)\n- [Search Grammar](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Farticles\u002Fsearch_grammar.php)\n- [Core Concepts](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Farticles\u002Fcore_concepts.php)\n\n## Next Steps\n\nSee `evernote-core-workflow-a` for note creation and management workflows.\n","# Evernote SDK Patterns\n\n## Overview\n\nProduction-ready patterns for working with the Evernote SDK, including search, filtering, batch operations, and resource handling.\n\n## Prerequisites\n\n- Completed `evernote-install-auth` and `evernote-hello-world`\n- Understanding of Evernote data model (Notes, Notebooks, Tags, Resources)\n- Familiarity with Promises\u002Fasync patterns\n\n## Core Patterns\n\n### Pattern 1: Search with NoteFilter\n\n```javascript\nconst Evernote = require('evernote');\n\nasync function searchNotes(noteStore, searchQuery, maxResults = 100) {\n  \u002F\u002F Create filter with search grammar\n  const filter = new Evernote.NoteStore.NoteFilter({\n    words: searchQuery,\n    ascending: false,\n    order: Evernote.Types.NoteSortOrder.UPDATED\n  });\n\n  \u002F\u002F Specify which metadata to return\n  const spec = new Evernote.NoteStore.NotesMetadataResultSpec({\n    includeTitle: true,\n    includeContentLength: true,\n    includeCreated: true,\n    includeUpdated: true,\n    includeTagGuids: true,\n    includeNotebookGuid: true\n  });\n\n  \u002F\u002F Find notes (offset, maxNotes)\n  const result = await noteStore.findNotesMetadata(filter, 0, maxResults, spec);\n\n  console.log(`Found ${result.totalNotes} notes (returned ${result.notes.length})`);\n  return result;\n}\n\n\u002F\u002F Usage examples:\n\u002F\u002F searchNotes(noteStore, 'tag:important notebook:Work');\n\u002F\u002F searchNotes(noteStore, 'intitle:meeting created:day-7');\n\u002F\u002F searchNotes(noteStore, 'todo:false'); \u002F\u002F Unchecked todos\n```\n\n### Pattern 2: Search Grammar Queries\n\n```javascript\n\u002F\u002F Build complex search queries\nfunction buildSearchQuery(options = {}) {\n  const parts = [];\n\n  if (options.notebook) {\n    parts.push(`notebook:\"${options.notebook}\"`);\n  }\n\n  if (options.tags && options.tags.length) {\n    options.tags.forEach(tag => parts.push(`tag:\"${tag}\"`));\n  }\n\n  if (options.excludeTags && options.excludeTags.length) {\n    options.excludeTags.forEach(tag => parts.push(`-tag:\"${tag}\"`));\n  }\n\n  if (options.createdAfter) {\n    parts.push(`created:${formatDateForSearch(options.createdAfter)}`);\n  }\n\n  if (options.updatedAfter) {\n    parts.push(`updated:${formatDateForSearch(options.updatedAfter)}`);\n  }\n\n  if (options.inTitle) {\n    parts.push(`intitle:\"${options.inTitle}\"`);\n  }\n\n  if (options.hasAttachments) {\n    parts.push('resource:*');\n  }\n\n  if (options.hasTodos !== undefined) {\n    parts.push(`todo:${options.hasTodos}`);\n  }\n\n  if (options.text) {\n    parts.push(options.text);\n  }\n\n  \u002F\u002F Use 'any:' for OR logic, default is AND\n  if (options.matchAny) {\n    return 'any: ' + parts.join(' ');\n  }\n\n  return parts.join(' ');\n}\n\nfunction formatDateForSearch(date) {\n  \u002F\u002F Format: YYYYMMDD\n  return date.toISOString().slice(0, 10).replace(\u002F-\u002Fg, '');\n}\n\n\u002F\u002F Example: Find notes tagged \"urgent\" in \"Work\" notebook from last week\nconst query = buildSearchQuery({\n  notebook: 'Work',\n  tags: ['urgent'],\n  createdAfter: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)\n});\n\u002F\u002F Result: 'notebook:\"Work\" tag:\"urgent\" created:20240115'\n```\n\n### Pattern 3: Paginated Note Retrieval\n\n```javascript\nasync function* getAllNotesMetadata(noteStore, filter, spec, pageSize = 100) {\n  let offset = 0;\n  let hasMore = true;\n\n  while (hasMore) {\n    const result = await noteStore.findNotesMetadata(filter, offset, pageSize, spec);\n\n    for (const note of result.notes) {\n      yield note;\n    }\n\n    offset += result.notes.length;\n    hasMore = offset \u003C result.totalNotes;\n\n    console.log(`Progress: ${offset}\u002F${result.totalNotes}`);\n  }\n}\n\n\u002F\u002F Usage with async iteration\nasync function processAllNotes(noteStore) {\n  const filter = new Evernote.NoteStore.NoteFilter({ words: 'tag:process' });\n  const spec = new Evernote.NoteStore.NotesMetadataResultSpec({\n    includeTitle: true,\n    includeUpdated: true\n  });\n\n  for await (const note of getAllNotesMetadata(noteStore, filter, spec)) {\n    console.log(`Processing: ${note.title}`);\n    \u002F\u002F Process each note\n  }\n}\n```\n\n### Pattern 4: Efficient Note Content Retrieval\n\n```javascript\nasync function getNoteWithOptions(noteStore, noteGuid, options = {}) {\n  const {\n    withContent = true,\n    withResources = false,\n    withRecognition = false,\n    withAlternateData = false\n  } = options;\n\n  return noteStore.getNote(\n    noteGuid,\n    withContent,\n    withResources,        \u002F\u002F Include binary resource data\n    withRecognition,      \u002F\u002F Include OCR data\n    withAlternateData     \u002F\u002F Include alternate representations\n  );\n}\n\n\u002F\u002F Only get content (most common)\nconst note = await getNoteWithOptions(noteStore, guid);\n\n\u002F\u002F Get note with all attachments\nconst noteWithFiles = await getNoteWithOptions(noteStore, guid, {\n  withResources: true\n});\n```\n\n### Pattern 5: Creating Notes with Attachments\n\n```javascript\nconst crypto = require('crypto');\nconst fs = require('fs');\nconst path = require('path');\n\nasync function createNoteWithAttachment(noteStore, title, content, filePath) {\n  const Evernote = require('evernote');\n\n  \u002F\u002F Read file and compute hash\n  const fileBuffer = fs.readFileSync(filePath);\n  const hash = crypto.createHash('md5').update(fileBuffer).digest('hex');\n  const mimeType = getMimeType(filePath);\n\n  \u002F\u002F Create resource (attachment)\n  const resource = new Evernote.Types.Resource();\n  resource.data = new Evernote.Types.Data();\n  resource.data.body = fileBuffer;\n  resource.data.size = fileBuffer.length;\n  resource.data.bodyHash = Buffer.from(hash, 'hex');\n  resource.mime = mimeType;\n\n  \u002F\u002F Set file attributes\n  resource.attributes = new Evernote.Types.ResourceAttributes();\n  resource.attributes.fileName = path.basename(filePath);\n\n  \u002F\u002F Create ENML with embedded resource\n  const enml = `\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE en-note SYSTEM \"http:\u002F\u002Fxml.evernote.com\u002Fpub\u002Fenml2.dtd\">\n\u003Cen-note>\n  ${content}\n  \u003Cen-media type=\"${mimeType}\" hash=\"${hash}\"\u002F>\n\u003C\u002Fen-note>`;\n\n  \u002F\u002F Create note\n  const note = new Evernote.Types.Note();\n  note.title = title;\n  note.content = enml;\n  note.resources = [resource];\n\n  return noteStore.createNote(note);\n}\n\nfunction getMimeType(filePath) {\n  const ext = path.extname(filePath).toLowerCase();\n  const mimeTypes = {\n    '.png': 'image\u002Fpng',\n    '.jpg': 'image\u002Fjpeg',\n    '.jpeg': 'image\u002Fjpeg',\n    '.gif': 'image\u002Fgif',\n    '.pdf': 'application\u002Fpdf',\n    '.txt': 'text\u002Fplain',\n    '.doc': 'application\u002Fmsword',\n    '.docx': 'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document'\n  };\n  return mimeTypes[ext] || 'application\u002Foctet-stream';\n}\n```\n\n### Pattern 6: Working with Tags\n\n```javascript\nasync function getOrCreateTag(noteStore, tagName) {\n  \u002F\u002F Try to find existing tag\n  const tags = await noteStore.listTags();\n  const existing = tags.find(t =>\n    t.name.toLowerCase() === tagName.toLowerCase()\n  );\n\n  if (existing) {\n    return existing;\n  }\n\n  \u002F\u002F Create new tag\n  const tag = new Evernote.Types.Tag();\n  tag.name = tagName;\n  return noteStore.createTag(tag);\n}\n\nasync function addTagsToNote(noteStore, noteGuid, tagNames) {\n  \u002F\u002F Get current note\n  const note = await noteStore.getNote(noteGuid, false, false, false, false);\n\n  \u002F\u002F Resolve tag names to GUIDs\n  const tagGuids = await Promise.all(\n    tagNames.map(async name => {\n      const tag = await getOrCreateTag(noteStore, name);\n      return tag.guid;\n    })\n  );\n\n  \u002F\u002F Merge with existing tags\n  const existingTags = note.tagGuids || [];\n  const allTags = [...new Set([...existingTags, ...tagGuids])];\n\n  \u002F\u002F Update note\n  note.tagGuids = allTags;\n  return noteStore.updateNote(note);\n}\n```\n\n### Pattern 7: Notebook Operations\n\n```javascript\nasync function getOrCreateNotebook(noteStore, notebookName, stack = null) {\n  const notebooks = await noteStore.listNotebooks();\n  const existing = notebooks.find(n =>\n    n.name.toLowerCase() === notebookName.toLowerCase()\n  );\n\n  if (existing) {\n    return existing;\n  }\n\n  const notebook = new Evernote.Types.Notebook();\n  notebook.name = notebookName;\n  if (stack) {\n    notebook.stack = stack;\n  }\n\n  return noteStore.createNotebook(notebook);\n}\n\nasync function moveNoteToNotebook(noteStore, noteGuid, notebookName) {\n  const notebook = await getOrCreateNotebook(noteStore, notebookName);\n  const note = await noteStore.getNote(noteGuid, false, false, false, false);\n\n  note.notebookGuid = notebook.guid;\n  return noteStore.updateNote(note);\n}\n```\n\n### Pattern 8: Error Handling Wrapper\n\n```javascript\nclass EvernoteError extends Error {\n  constructor(originalError) {\n    super(originalError.message || 'Evernote API error');\n    this.name = 'EvernoteError';\n    this.code = originalError.errorCode;\n    this.parameter = originalError.parameter;\n    this.rateLimitDuration = originalError.rateLimitDuration;\n    this.original = originalError;\n  }\n\n  get isRateLimit() {\n    return this.code === Evernote.Errors.EDAMErrorCode.RATE_LIMIT_REACHED;\n  }\n\n  get isNotFound() {\n    return this.code === Evernote.Errors.EDAMErrorCode.UNKNOWN;\n  }\n\n  get isInvalidData() {\n    return this.code === Evernote.Errors.EDAMErrorCode.BAD_DATA_FORMAT;\n  }\n}\n\nasync function withErrorHandling(operation) {\n  try {\n    return await operation();\n  } catch (error) {\n    if (error.errorCode !== undefined) {\n      throw new EvernoteError(error);\n    }\n    throw error;\n  }\n}\n\n\u002F\u002F Usage\ntry {\n  const note = await withErrorHandling(() =>\n    noteStore.getNote(guid, true, false, false, false)\n  );\n} catch (error) {\n  if (error instanceof EvernoteError && error.isRateLimit) {\n    console.log(`Rate limited. Retry in ${error.rateLimitDuration}s`);\n  }\n}\n```\n\n### Pattern 9: Batch Operations with Rate Limit Handling\n\n```javascript\nasync function batchProcess(items, operation, options = {}) {\n  const {\n    concurrency = 1,  \u002F\u002F Keep at 1 to avoid rate limits\n    delayMs = 100,\n    onProgress = () => {}\n  } = options;\n\n  const results = [];\n  let processed = 0;\n\n  for (const item of items) {\n    try {\n      const result = await operation(item);\n      results.push({ success: true, item, result });\n    } catch (error) {\n      if (error.rateLimitDuration) {\n        \u002F\u002F Wait for rate limit to clear\n        console.log(`Rate limited, waiting ${error.rateLimitDuration}s...`);\n        await sleep(error.rateLimitDuration * 1000);\n        \u002F\u002F Retry\n        const result = await operation(item);\n        results.push({ success: true, item, result });\n      } else {\n        results.push({ success: false, item, error });\n      }\n    }\n\n    processed++;\n    onProgress(processed, items.length);\n\n    \u002F\u002F Add delay between operations\n    if (processed \u003C items.length) {\n      await sleep(delayMs);\n    }\n  }\n\n  return results;\n}\n\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\n\n\u002F\u002F Usage\nconst notes = await searchNotes(noteStore, 'tag:archive');\nconst results = await batchProcess(\n  notes.notes,\n  note => noteStore.deleteNote(note.guid),\n  {\n    delayMs: 200,\n    onProgress: (done, total) => console.log(`${done}\u002F${total}`)\n  }\n);\n```\n\n## Output\n\n- Reusable SDK patterns for common operations\n- Efficient search with NoteFilter\n- Pagination for large result sets\n- Attachment handling with proper MIME types\n- Tag and notebook management utilities\n- Production error handling\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `RATE_LIMIT_REACHED` | Too many API calls | Use rateLimitDuration, add delays |\n| `BAD_DATA_FORMAT` | Invalid ENML | Validate before sending |\n| `DATA_CONFLICT` | Concurrent modification | Refetch and retry |\n| `QUOTA_REACHED` | Account storage full | Check user's remaining quota |\n\n## Resources\n\n- [API Reference](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Freference\u002F)\n- [Search Grammar](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Farticles\u002Fsearch_grammar.php)\n- [Core Concepts](https:\u002F\u002Fdev.evernote.com\u002Fdoc\u002Farticles\u002Fcore_concepts.php)\n\n## Next Steps\n\nSee `evernote-core-workflow-a` for note creation and management workflows.\n",{"name":5,"author":47,"license":15,"version":48,"description":49,"allowed-tools":50},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Advanced Evernote SDK patterns and best practices.\nUse when implementing complex note operations, batch processing,\nsearch queries, or optimizing SDK usage.\nTrigger with phrases like \"evernote sdk patterns\", \"evernote best practices\",\n\"evernote advanced\", \"evernote batch operations\".\n","Read, Write, Edit, Grep","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fevernote-pack\u002Fskills\u002Fevernote-sdk-patterns",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill evernote-sdk-patterns",{"tool":66,"command":67},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill evernote-sdk-patterns",{"tool":69,"command":70},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill evernote-sdk-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fevernote-pack\u002Fskills\u002Fevernote-sdk-patterns\u002FSKILL.md",true,[],[75,108,143,166,192,219],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":88,"publishedAt":107},"01M6FCR7G5A005P364Z6ZWCJDP","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[83],{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,27,105,106],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","you","fonts","2026-11-11 15:11:14",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":112,"sourceHtmlUrl":113,"categories":114,"keywords":118,"publishedAt":42},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[115],{"categoryNo":116,"categoryName":117,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000009","前端开发",[119,120,95,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,33,100,136,137,138,139,140,141,142],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","for","jsx","suite",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":147,"sourceHtmlUrl":148,"categories":149,"keywords":154,"publishedAt":42},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[150,153],{"categoryNo":151,"categoryName":152,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":116,"categoryName":117,"taxonomyType":86,"taxonomyTypeDesc":87},[155,156,157,123,158,159,120,160,93,161,133,162,163,164,165,27,140],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","applications","behavior","local",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":170,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":42},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[174,175,176,177,178,179,180,181,33,182,183,184,185,186,187,188,27,189,190,191,140,23],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":196,"sourceHtmlUrl":197,"categories":198,"keywords":202,"publishedAt":42},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[199],{"categoryNo":200,"categoryName":201,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000023","Skill与智能体开发",[203,204,205,206,207,208,209,210,211,212,213,214,215,216,27,140,217,23,218],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","integrations","specialized","guide","new skill","existing skill","users","Existing","new",{"skillNo":220,"name":221,"nameZh":6,"description":222,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":223,"sourceHtmlUrl":224,"categories":225,"keywords":227,"publishedAt":42},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[226],{"categoryNo":200,"categoryName":201,"taxonomyType":86,"taxonomyTypeDesc":87},[221,228,229,230,231,232,233,161,234,235,33,236,237,238,239,140,240],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]