[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F88TXRP15QDXN99FHBV04S":3,"skill-same:01M6F88TXRP15QDXN99FHBV04S":79},{"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":23,"publishedAt":47,"linkOnly":48,"markdownContent":49,"markdownBody":50,"frontMatter":51,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":59,"repositoryHtmlUrl":60,"repositoryHomepageUrl":6,"ownerHtmlUrl":61,"ownerBlogUrl":62,"ownerDescription":63,"updatedAt":64,"install":65,"resources":78},"01M6F88TXRP15QDXN99FHBV04S","obsidian-cost-tuning",null,"Optimize Obsidian plugin resource usage and external service costs.\nUse when managing API quotas, reducing storage usage,\nor optimizing sync and external service consumption.\nTrigger with phrases like \"obsidian resources\", \"obsidian quota\",\n\"optimize obsidian storage\", \"reduce obsidian costs\".","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\u002Fobsidian-pack\u002Fskills\u002Fobsidian-cost-tuning\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"tuning","obsidian cost tuning","cost","obsidian","quota","when","reduce","obsidian plugin","usage","with","resources","trigger","io","service","optimize","use","edit","write","read","api","plugin","sync","storage","2026-11-10 10:12:30",false,"---\nname: obsidian-cost-tuning\ndescription: |\n  Optimize Obsidian plugin resource usage and external service costs.\n  Use when managing API quotas, reducing storage usage,\n  or optimizing sync and external service consumption.\n  Trigger with phrases like \"obsidian resources\", \"obsidian quota\",\n  \"optimize obsidian storage\", \"reduce obsidian costs\".\nallowed-tools: Read, Write, Edit\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# Obsidian Cost Tuning\n\n## Overview\nOptimize resource consumption and external service costs for Obsidian plugins that use APIs, storage, or sync services.\n\n## Prerequisites\n- Plugin with external API integrations\n- Understanding of API pricing models\n- Access to usage metrics\n\n## Resource Categories\n\n### Cost Drivers\n| Resource | Optimization Target | Impact |\n|----------|-------------------|--------|\n| API calls | Minimize requests | High |\n| Data storage | Compress and dedupe | Medium |\n| Sync bandwidth | Reduce transfer size | Medium |\n| Compute | Cache results | Low |\n\n## Instructions\n\n### Step 1: API Request Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fapi-optimizer.ts\nimport { requestUrl } from 'obsidian';\n\ninterface CacheEntry\u003CT> {\n  data: T;\n  timestamp: number;\n  etag?: string;\n}\n\nexport class OptimizedAPIClient {\n  private cache = new Map\u003Cstring, CacheEntry\u003Cany>>();\n  private pendingRequests = new Map\u003Cstring, Promise\u003Cany>>();\n  private cacheTTL: number;\n\n  constructor(cacheTTLMs: number = 5 * 60 * 1000) { \u002F\u002F 5 min default\n    this.cacheTTL = cacheTTLMs;\n  }\n\n  async get\u003CT>(url: string, options: {\n    bypassCache?: boolean;\n    customTTL?: number;\n  } = {}): Promise\u003CT> {\n    const cacheKey = url;\n\n    \u002F\u002F Check cache\n    if (!options.bypassCache) {\n      const cached = this.cache.get(cacheKey);\n      const ttl = options.customTTL ?? this.cacheTTL;\n\n      if (cached && Date.now() - cached.timestamp \u003C ttl) {\n        console.log(`[Cache] HIT: ${url}`);\n        return cached.data as T;\n      }\n    }\n\n    \u002F\u002F Deduplicate concurrent requests\n    const pending = this.pendingRequests.get(cacheKey);\n    if (pending) {\n      console.log(`[Request] DEDUPE: ${url}`);\n      return pending as Promise\u003CT>;\n    }\n\n    \u002F\u002F Make request\n    const requestPromise = this.makeRequest\u003CT>(url, cacheKey);\n    this.pendingRequests.set(cacheKey, requestPromise);\n\n    try {\n      return await requestPromise;\n    } finally {\n      this.pendingRequests.delete(cacheKey);\n    }\n  }\n\n  private async makeRequest\u003CT>(url: string, cacheKey: string): Promise\u003CT> {\n    const cached = this.cache.get(cacheKey);\n    const headers: Record\u003Cstring, string> = {};\n\n    \u002F\u002F Use ETags for conditional requests\n    if (cached?.etag) {\n      headers['If-None-Match'] = cached.etag;\n    }\n\n    const response = await requestUrl({\n      url,\n      headers,\n      throw: false,\n    });\n\n    \u002F\u002F Not modified - use cached data\n    if (response.status === 304 && cached) {\n      console.log(`[Request] NOT MODIFIED: ${url}`);\n      this.cache.set(cacheKey, {\n        ...cached,\n        timestamp: Date.now(),\n      });\n      return cached.data as T;\n    }\n\n    \u002F\u002F Store new data\n    const etag = response.headers['etag'];\n    this.cache.set(cacheKey, {\n      data: response.json,\n      timestamp: Date.now(),\n      etag,\n    });\n\n    console.log(`[Request] FETCHED: ${url}`);\n    return response.json as T;\n  }\n\n  clearCache(): void {\n    this.cache.clear();\n  }\n\n  getCacheStats(): { size: number; entries: number } {\n    let size = 0;\n    for (const entry of this.cache.values()) {\n      size += JSON.stringify(entry.data).length;\n    }\n    return { size, entries: this.cache.size };\n  }\n}\n```\n\n### Step 2: Request Batching\n```typescript\n\u002F\u002F src\u002Fservices\u002Fbatch-requester.ts\nexport class BatchRequester\u003CT, R> {\n  private queue: Array\u003C{ input: T; resolve: (r: R) => void; reject: (e: Error) => void }> = [];\n  private batchTimeout: NodeJS.Timeout | null = null;\n  private batchProcessor: (inputs: T[]) => Promise\u003CR[]>;\n  private maxBatchSize: number;\n  private batchDelayMs: number;\n\n  constructor(\n    batchProcessor: (inputs: T[]) => Promise\u003CR[]>,\n    options: { maxBatchSize?: number; batchDelayMs?: number } = {}\n  ) {\n    this.batchProcessor = batchProcessor;\n    this.maxBatchSize = options.maxBatchSize ?? 20;\n    this.batchDelayMs = options.batchDelayMs ?? 50;\n  }\n\n  async request(input: T): Promise\u003CR> {\n    return new Promise((resolve, reject) => {\n      this.queue.push({ input, resolve, reject });\n\n      if (this.queue.length >= this.maxBatchSize) {\n        this.processBatch();\n      } else if (!this.batchTimeout) {\n        this.batchTimeout = setTimeout(() => this.processBatch(), this.batchDelayMs);\n      }\n    });\n  }\n\n  private async processBatch(): Promise\u003Cvoid> {\n    if (this.batchTimeout) {\n      clearTimeout(this.batchTimeout);\n      this.batchTimeout = null;\n    }\n\n    const batch = this.queue.splice(0, this.maxBatchSize);\n    if (batch.length === 0) return;\n\n    try {\n      const inputs = batch.map(item => item.input);\n      const results = await this.batchProcessor(inputs);\n\n      batch.forEach((item, index) => {\n        item.resolve(results[index]);\n      });\n    } catch (error) {\n      batch.forEach(item => {\n        item.reject(error as Error);\n      });\n    }\n  }\n}\n\n\u002F\u002F Usage: Batch multiple API lookups into single request\nconst batcher = new BatchRequester\u003Cstring, NoteMetadata>(\n  async (noteIds: string[]) => {\n    \u002F\u002F Single API call for multiple items\n    const response = await api.getNotes(noteIds);\n    return response.notes;\n  }\n);\n\n\u002F\u002F Individual calls are automatically batched\nconst note1 = await batcher.request('note-1');\nconst note2 = await batcher.request('note-2');\n```\n\n### Step 3: Storage Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fstorage-optimizer.ts\nexport class StorageOptimizer {\n  \u002F\u002F Compress data before storing\n  static compress(data: any): string {\n    const json = JSON.stringify(data);\n\n    \u002F\u002F Simple compression: remove whitespace and use shorter keys\n    \u002F\u002F For production, use actual compression library\n    return json\n      .replace(\u002F\\s+\u002Fg, '')\n      .replace(\u002F\"([^\"]+)\":\u002Fg, (_, key) => {\n        \u002F\u002F Use single-char keys for common fields\n        const shortKeys: Record\u003Cstring, string> = {\n          'path': 'p',\n          'name': 'n',\n          'content': 'c',\n          'modified': 'm',\n          'created': 'r',\n          'tags': 't',\n        };\n        return `\"${shortKeys[key] || key}\":`;\n      });\n  }\n\n  \u002F\u002F Decompress stored data\n  static decompress(compressed: string): any {\n    const longKeys: Record\u003Cstring, string> = {\n      'p': 'path',\n      'n': 'name',\n      'c': 'content',\n      'm': 'modified',\n      'r': 'created',\n      't': 'tags',\n    };\n\n    const expanded = compressed.replace(\u002F\"([pncmrt])\":\u002Fg, (_, key) => {\n      return `\"${longKeys[key]}\":`;\n    });\n\n    return JSON.parse(expanded);\n  }\n\n  \u002F\u002F Deduplicate repeated strings\n  static deduplicateStrings\u003CT extends object>(data: T[]): { data: T[]; dictionary: string[] } {\n    const dictionary: string[] = [];\n    const stringIndex = new Map\u003Cstring, number>();\n\n    const indexedData = data.map(item => {\n      const indexed: any = {};\n      for (const [key, value] of Object.entries(item)) {\n        if (typeof value === 'string' && value.length > 10) {\n          let index = stringIndex.get(value);\n          if (index === undefined) {\n            index = dictionary.length;\n            dictionary.push(value);\n            stringIndex.set(value, index);\n          }\n          indexed[key] = `$${index}`;\n        } else {\n          indexed[key] = value;\n        }\n      }\n      return indexed;\n    });\n\n    return { data: indexedData, dictionary };\n  }\n\n  \u002F\u002F Calculate storage savings\n  static calculateSavings(original: any, optimized: any): {\n    originalSize: number;\n    optimizedSize: number;\n    savingsPercent: number;\n  } {\n    const originalSize = JSON.stringify(original).length;\n    const optimizedSize = JSON.stringify(optimized).length;\n    const savingsPercent = ((originalSize - optimizedSize) \u002F originalSize) * 100;\n\n    return { originalSize, optimizedSize, savingsPercent };\n  }\n}\n```\n\n### Step 4: Rate Limiting with Quotas\n```typescript\n\u002F\u002F src\u002Fservices\u002Fquota-manager.ts\ninterface QuotaConfig {\n  dailyLimit: number;\n  monthlyLimit: number;\n  perMinuteLimit: number;\n}\n\nexport class QuotaManager {\n  private config: QuotaConfig;\n  private usage: {\n    daily: { count: number; date: string };\n    monthly: { count: number; month: string };\n    perMinute: number[];\n  };\n  private storageKey: string;\n\n  constructor(plugin: Plugin, config: QuotaConfig) {\n    this.config = config;\n    this.storageKey = 'api-quota-usage';\n    this.usage = this.loadUsage(plugin);\n  }\n\n  private loadUsage(plugin: Plugin): typeof this.usage {\n    const saved = plugin.loadData()?.[this.storageKey];\n    const today = new Date().toISOString().split('T')[0];\n    const month = today.substring(0, 7);\n\n    return {\n      daily: saved?.daily?.date === today\n        ? saved.daily\n        : { count: 0, date: today },\n      monthly: saved?.monthly?.month === month\n        ? saved.monthly\n        : { count: 0, month },\n      perMinute: [],\n    };\n  }\n\n  async canMakeRequest(): Promise\u003C{ allowed: boolean; reason?: string; waitMs?: number }> {\n    const now = Date.now();\n\n    \u002F\u002F Check per-minute limit\n    this.usage.perMinute = this.usage.perMinute.filter(t => now - t \u003C 60000);\n    if (this.usage.perMinute.length >= this.config.perMinuteLimit) {\n      const oldestRequest = this.usage.perMinute[0];\n      const waitMs = 60000 - (now - oldestRequest);\n      return {\n        allowed: false,\n        reason: `Rate limit: ${this.config.perMinuteLimit} requests\u002Fminute`,\n        waitMs,\n      };\n    }\n\n    \u002F\u002F Check daily limit\n    if (this.usage.daily.count >= this.config.dailyLimit) {\n      return {\n        allowed: false,\n        reason: `Daily limit reached: ${this.config.dailyLimit} requests`,\n      };\n    }\n\n    \u002F\u002F Check monthly limit\n    if (this.usage.monthly.count >= this.config.monthlyLimit) {\n      return {\n        allowed: false,\n        reason: `Monthly limit reached: ${this.config.monthlyLimit} requests`,\n      };\n    }\n\n    return { allowed: true };\n  }\n\n  recordRequest(): void {\n    const now = Date.now();\n    this.usage.perMinute.push(now);\n    this.usage.daily.count++;\n    this.usage.monthly.count++;\n  }\n\n  getUsageStats(): {\n    daily: { used: number; limit: number; percent: number };\n    monthly: { used: number; limit: number; percent: number };\n  } {\n    return {\n      daily: {\n        used: this.usage.daily.count,\n        limit: this.config.dailyLimit,\n        percent: (this.usage.daily.count \u002F this.config.dailyLimit) * 100,\n      },\n      monthly: {\n        used: this.usage.monthly.count,\n        limit: this.config.monthlyLimit,\n        percent: (this.usage.monthly.count \u002F this.config.monthlyLimit) * 100,\n      },\n    };\n  }\n}\n```\n\n### Step 5: Intelligent Sync Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fsync-optimizer.ts\nexport class SyncOptimizer {\n  private lastSyncHashes = new Map\u003Cstring, string>();\n\n  \u002F\u002F Only sync changed content\n  async getChangedFiles(\n    files: TFile[],\n    vault: Vault\n  ): Promise\u003CTFile[]> {\n    const changed: TFile[] = [];\n\n    for (const file of files) {\n      const content = await vault.cachedRead(file);\n      const hash = await this.hashContent(content);\n      const lastHash = this.lastSyncHashes.get(file.path);\n\n      if (hash !== lastHash) {\n        changed.push(file);\n        this.lastSyncHashes.set(file.path, hash);\n      }\n    }\n\n    console.log(`[Sync] ${changed.length}\u002F${files.length} files changed`);\n    return changed;\n  }\n\n  private async hashContent(content: string): Promise\u003Cstring> {\n    const encoder = new TextEncoder();\n    const data = encoder.encode(content);\n    const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n    const hashArray = Array.from(new Uint8Array(hashBuffer));\n    return hashArray.map(b => b.toString(16).padStart(2, '0')).join('').substring(0, 16);\n  }\n\n  \u002F\u002F Compress sync payload\n  static prepareForSync(data: any): { payload: string; originalSize: number; compressedSize: number } {\n    const original = JSON.stringify(data);\n    const compressed = StorageOptimizer.compress(data);\n\n    return {\n      payload: compressed,\n      originalSize: original.length,\n      compressedSize: compressed.length,\n    };\n  }\n}\n```\n\n## Output\n- API request caching and deduplication\n- Request batching for efficiency\n- Storage compression and optimization\n- Quota management with usage tracking\n- Intelligent sync with change detection\n\n## Error Handling\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Quota exceeded | Too many requests | Implement rate limiting |\n| High storage costs | Uncompressed data | Apply compression |\n| Slow sync | Full sync every time | Use delta sync |\n| API costs high | No caching | Add request caching |\n\n## Examples\n\n### Usage Dashboard Component\n```typescript\nclass UsageDashboard {\n  displayUsage(quotaManager: QuotaManager): HTMLElement {\n    const container = document.createElement('div');\n    const stats = quotaManager.getUsageStats();\n\n    container.innerHTML = `\n      \u003Ch4>API Usage\u003C\u002Fh4>\n      \u003Cdiv class=\"usage-bar\">\n        \u003Cdiv class=\"usage-fill\" style=\"width: ${stats.daily.percent}%\">\u003C\u002Fdiv>\n        \u003Cspan>Daily: ${stats.daily.used}\u002F${stats.daily.limit}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n      \u003Cdiv class=\"usage-bar\">\n        \u003Cdiv class=\"usage-fill\" style=\"width: ${stats.monthly.percent}%\">\u003C\u002Fdiv>\n        \u003Cspan>Monthly: ${stats.monthly.used}\u002F${stats.monthly.limit}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n    `;\n\n    return container;\n  }\n}\n```\n\n## Resources\n- [API Rate Limiting Best Practices](https:\u002F\u002Fcloud.google.com\u002Farchitecture\u002Frate-limiting-strategies-techniques)\n- [Data Compression Techniques](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FCompression_Streams_API)\n\n## Next Steps\nFor architecture patterns, see `obsidian-reference-architecture`.\n","# Obsidian Cost Tuning\n\n## Overview\nOptimize resource consumption and external service costs for Obsidian plugins that use APIs, storage, or sync services.\n\n## Prerequisites\n- Plugin with external API integrations\n- Understanding of API pricing models\n- Access to usage metrics\n\n## Resource Categories\n\n### Cost Drivers\n| Resource | Optimization Target | Impact |\n|----------|-------------------|--------|\n| API calls | Minimize requests | High |\n| Data storage | Compress and dedupe | Medium |\n| Sync bandwidth | Reduce transfer size | Medium |\n| Compute | Cache results | Low |\n\n## Instructions\n\n### Step 1: API Request Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fapi-optimizer.ts\nimport { requestUrl } from 'obsidian';\n\ninterface CacheEntry\u003CT> {\n  data: T;\n  timestamp: number;\n  etag?: string;\n}\n\nexport class OptimizedAPIClient {\n  private cache = new Map\u003Cstring, CacheEntry\u003Cany>>();\n  private pendingRequests = new Map\u003Cstring, Promise\u003Cany>>();\n  private cacheTTL: number;\n\n  constructor(cacheTTLMs: number = 5 * 60 * 1000) { \u002F\u002F 5 min default\n    this.cacheTTL = cacheTTLMs;\n  }\n\n  async get\u003CT>(url: string, options: {\n    bypassCache?: boolean;\n    customTTL?: number;\n  } = {}): Promise\u003CT> {\n    const cacheKey = url;\n\n    \u002F\u002F Check cache\n    if (!options.bypassCache) {\n      const cached = this.cache.get(cacheKey);\n      const ttl = options.customTTL ?? this.cacheTTL;\n\n      if (cached && Date.now() - cached.timestamp \u003C ttl) {\n        console.log(`[Cache] HIT: ${url}`);\n        return cached.data as T;\n      }\n    }\n\n    \u002F\u002F Deduplicate concurrent requests\n    const pending = this.pendingRequests.get(cacheKey);\n    if (pending) {\n      console.log(`[Request] DEDUPE: ${url}`);\n      return pending as Promise\u003CT>;\n    }\n\n    \u002F\u002F Make request\n    const requestPromise = this.makeRequest\u003CT>(url, cacheKey);\n    this.pendingRequests.set(cacheKey, requestPromise);\n\n    try {\n      return await requestPromise;\n    } finally {\n      this.pendingRequests.delete(cacheKey);\n    }\n  }\n\n  private async makeRequest\u003CT>(url: string, cacheKey: string): Promise\u003CT> {\n    const cached = this.cache.get(cacheKey);\n    const headers: Record\u003Cstring, string> = {};\n\n    \u002F\u002F Use ETags for conditional requests\n    if (cached?.etag) {\n      headers['If-None-Match'] = cached.etag;\n    }\n\n    const response = await requestUrl({\n      url,\n      headers,\n      throw: false,\n    });\n\n    \u002F\u002F Not modified - use cached data\n    if (response.status === 304 && cached) {\n      console.log(`[Request] NOT MODIFIED: ${url}`);\n      this.cache.set(cacheKey, {\n        ...cached,\n        timestamp: Date.now(),\n      });\n      return cached.data as T;\n    }\n\n    \u002F\u002F Store new data\n    const etag = response.headers['etag'];\n    this.cache.set(cacheKey, {\n      data: response.json,\n      timestamp: Date.now(),\n      etag,\n    });\n\n    console.log(`[Request] FETCHED: ${url}`);\n    return response.json as T;\n  }\n\n  clearCache(): void {\n    this.cache.clear();\n  }\n\n  getCacheStats(): { size: number; entries: number } {\n    let size = 0;\n    for (const entry of this.cache.values()) {\n      size += JSON.stringify(entry.data).length;\n    }\n    return { size, entries: this.cache.size };\n  }\n}\n```\n\n### Step 2: Request Batching\n```typescript\n\u002F\u002F src\u002Fservices\u002Fbatch-requester.ts\nexport class BatchRequester\u003CT, R> {\n  private queue: Array\u003C{ input: T; resolve: (r: R) => void; reject: (e: Error) => void }> = [];\n  private batchTimeout: NodeJS.Timeout | null = null;\n  private batchProcessor: (inputs: T[]) => Promise\u003CR[]>;\n  private maxBatchSize: number;\n  private batchDelayMs: number;\n\n  constructor(\n    batchProcessor: (inputs: T[]) => Promise\u003CR[]>,\n    options: { maxBatchSize?: number; batchDelayMs?: number } = {}\n  ) {\n    this.batchProcessor = batchProcessor;\n    this.maxBatchSize = options.maxBatchSize ?? 20;\n    this.batchDelayMs = options.batchDelayMs ?? 50;\n  }\n\n  async request(input: T): Promise\u003CR> {\n    return new Promise((resolve, reject) => {\n      this.queue.push({ input, resolve, reject });\n\n      if (this.queue.length >= this.maxBatchSize) {\n        this.processBatch();\n      } else if (!this.batchTimeout) {\n        this.batchTimeout = setTimeout(() => this.processBatch(), this.batchDelayMs);\n      }\n    });\n  }\n\n  private async processBatch(): Promise\u003Cvoid> {\n    if (this.batchTimeout) {\n      clearTimeout(this.batchTimeout);\n      this.batchTimeout = null;\n    }\n\n    const batch = this.queue.splice(0, this.maxBatchSize);\n    if (batch.length === 0) return;\n\n    try {\n      const inputs = batch.map(item => item.input);\n      const results = await this.batchProcessor(inputs);\n\n      batch.forEach((item, index) => {\n        item.resolve(results[index]);\n      });\n    } catch (error) {\n      batch.forEach(item => {\n        item.reject(error as Error);\n      });\n    }\n  }\n}\n\n\u002F\u002F Usage: Batch multiple API lookups into single request\nconst batcher = new BatchRequester\u003Cstring, NoteMetadata>(\n  async (noteIds: string[]) => {\n    \u002F\u002F Single API call for multiple items\n    const response = await api.getNotes(noteIds);\n    return response.notes;\n  }\n);\n\n\u002F\u002F Individual calls are automatically batched\nconst note1 = await batcher.request('note-1');\nconst note2 = await batcher.request('note-2');\n```\n\n### Step 3: Storage Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fstorage-optimizer.ts\nexport class StorageOptimizer {\n  \u002F\u002F Compress data before storing\n  static compress(data: any): string {\n    const json = JSON.stringify(data);\n\n    \u002F\u002F Simple compression: remove whitespace and use shorter keys\n    \u002F\u002F For production, use actual compression library\n    return json\n      .replace(\u002F\\s+\u002Fg, '')\n      .replace(\u002F\"([^\"]+)\":\u002Fg, (_, key) => {\n        \u002F\u002F Use single-char keys for common fields\n        const shortKeys: Record\u003Cstring, string> = {\n          'path': 'p',\n          'name': 'n',\n          'content': 'c',\n          'modified': 'm',\n          'created': 'r',\n          'tags': 't',\n        };\n        return `\"${shortKeys[key] || key}\":`;\n      });\n  }\n\n  \u002F\u002F Decompress stored data\n  static decompress(compressed: string): any {\n    const longKeys: Record\u003Cstring, string> = {\n      'p': 'path',\n      'n': 'name',\n      'c': 'content',\n      'm': 'modified',\n      'r': 'created',\n      't': 'tags',\n    };\n\n    const expanded = compressed.replace(\u002F\"([pncmrt])\":\u002Fg, (_, key) => {\n      return `\"${longKeys[key]}\":`;\n    });\n\n    return JSON.parse(expanded);\n  }\n\n  \u002F\u002F Deduplicate repeated strings\n  static deduplicateStrings\u003CT extends object>(data: T[]): { data: T[]; dictionary: string[] } {\n    const dictionary: string[] = [];\n    const stringIndex = new Map\u003Cstring, number>();\n\n    const indexedData = data.map(item => {\n      const indexed: any = {};\n      for (const [key, value] of Object.entries(item)) {\n        if (typeof value === 'string' && value.length > 10) {\n          let index = stringIndex.get(value);\n          if (index === undefined) {\n            index = dictionary.length;\n            dictionary.push(value);\n            stringIndex.set(value, index);\n          }\n          indexed[key] = `$${index}`;\n        } else {\n          indexed[key] = value;\n        }\n      }\n      return indexed;\n    });\n\n    return { data: indexedData, dictionary };\n  }\n\n  \u002F\u002F Calculate storage savings\n  static calculateSavings(original: any, optimized: any): {\n    originalSize: number;\n    optimizedSize: number;\n    savingsPercent: number;\n  } {\n    const originalSize = JSON.stringify(original).length;\n    const optimizedSize = JSON.stringify(optimized).length;\n    const savingsPercent = ((originalSize - optimizedSize) \u002F originalSize) * 100;\n\n    return { originalSize, optimizedSize, savingsPercent };\n  }\n}\n```\n\n### Step 4: Rate Limiting with Quotas\n```typescript\n\u002F\u002F src\u002Fservices\u002Fquota-manager.ts\ninterface QuotaConfig {\n  dailyLimit: number;\n  monthlyLimit: number;\n  perMinuteLimit: number;\n}\n\nexport class QuotaManager {\n  private config: QuotaConfig;\n  private usage: {\n    daily: { count: number; date: string };\n    monthly: { count: number; month: string };\n    perMinute: number[];\n  };\n  private storageKey: string;\n\n  constructor(plugin: Plugin, config: QuotaConfig) {\n    this.config = config;\n    this.storageKey = 'api-quota-usage';\n    this.usage = this.loadUsage(plugin);\n  }\n\n  private loadUsage(plugin: Plugin): typeof this.usage {\n    const saved = plugin.loadData()?.[this.storageKey];\n    const today = new Date().toISOString().split('T')[0];\n    const month = today.substring(0, 7);\n\n    return {\n      daily: saved?.daily?.date === today\n        ? saved.daily\n        : { count: 0, date: today },\n      monthly: saved?.monthly?.month === month\n        ? saved.monthly\n        : { count: 0, month },\n      perMinute: [],\n    };\n  }\n\n  async canMakeRequest(): Promise\u003C{ allowed: boolean; reason?: string; waitMs?: number }> {\n    const now = Date.now();\n\n    \u002F\u002F Check per-minute limit\n    this.usage.perMinute = this.usage.perMinute.filter(t => now - t \u003C 60000);\n    if (this.usage.perMinute.length >= this.config.perMinuteLimit) {\n      const oldestRequest = this.usage.perMinute[0];\n      const waitMs = 60000 - (now - oldestRequest);\n      return {\n        allowed: false,\n        reason: `Rate limit: ${this.config.perMinuteLimit} requests\u002Fminute`,\n        waitMs,\n      };\n    }\n\n    \u002F\u002F Check daily limit\n    if (this.usage.daily.count >= this.config.dailyLimit) {\n      return {\n        allowed: false,\n        reason: `Daily limit reached: ${this.config.dailyLimit} requests`,\n      };\n    }\n\n    \u002F\u002F Check monthly limit\n    if (this.usage.monthly.count >= this.config.monthlyLimit) {\n      return {\n        allowed: false,\n        reason: `Monthly limit reached: ${this.config.monthlyLimit} requests`,\n      };\n    }\n\n    return { allowed: true };\n  }\n\n  recordRequest(): void {\n    const now = Date.now();\n    this.usage.perMinute.push(now);\n    this.usage.daily.count++;\n    this.usage.monthly.count++;\n  }\n\n  getUsageStats(): {\n    daily: { used: number; limit: number; percent: number };\n    monthly: { used: number; limit: number; percent: number };\n  } {\n    return {\n      daily: {\n        used: this.usage.daily.count,\n        limit: this.config.dailyLimit,\n        percent: (this.usage.daily.count \u002F this.config.dailyLimit) * 100,\n      },\n      monthly: {\n        used: this.usage.monthly.count,\n        limit: this.config.monthlyLimit,\n        percent: (this.usage.monthly.count \u002F this.config.monthlyLimit) * 100,\n      },\n    };\n  }\n}\n```\n\n### Step 5: Intelligent Sync Optimization\n```typescript\n\u002F\u002F src\u002Fservices\u002Fsync-optimizer.ts\nexport class SyncOptimizer {\n  private lastSyncHashes = new Map\u003Cstring, string>();\n\n  \u002F\u002F Only sync changed content\n  async getChangedFiles(\n    files: TFile[],\n    vault: Vault\n  ): Promise\u003CTFile[]> {\n    const changed: TFile[] = [];\n\n    for (const file of files) {\n      const content = await vault.cachedRead(file);\n      const hash = await this.hashContent(content);\n      const lastHash = this.lastSyncHashes.get(file.path);\n\n      if (hash !== lastHash) {\n        changed.push(file);\n        this.lastSyncHashes.set(file.path, hash);\n      }\n    }\n\n    console.log(`[Sync] ${changed.length}\u002F${files.length} files changed`);\n    return changed;\n  }\n\n  private async hashContent(content: string): Promise\u003Cstring> {\n    const encoder = new TextEncoder();\n    const data = encoder.encode(content);\n    const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n    const hashArray = Array.from(new Uint8Array(hashBuffer));\n    return hashArray.map(b => b.toString(16).padStart(2, '0')).join('').substring(0, 16);\n  }\n\n  \u002F\u002F Compress sync payload\n  static prepareForSync(data: any): { payload: string; originalSize: number; compressedSize: number } {\n    const original = JSON.stringify(data);\n    const compressed = StorageOptimizer.compress(data);\n\n    return {\n      payload: compressed,\n      originalSize: original.length,\n      compressedSize: compressed.length,\n    };\n  }\n}\n```\n\n## Output\n- API request caching and deduplication\n- Request batching for efficiency\n- Storage compression and optimization\n- Quota management with usage tracking\n- Intelligent sync with change detection\n\n## Error Handling\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Quota exceeded | Too many requests | Implement rate limiting |\n| High storage costs | Uncompressed data | Apply compression |\n| Slow sync | Full sync every time | Use delta sync |\n| API costs high | No caching | Add request caching |\n\n## Examples\n\n### Usage Dashboard Component\n```typescript\nclass UsageDashboard {\n  displayUsage(quotaManager: QuotaManager): HTMLElement {\n    const container = document.createElement('div');\n    const stats = quotaManager.getUsageStats();\n\n    container.innerHTML = `\n      \u003Ch4>API Usage\u003C\u002Fh4>\n      \u003Cdiv class=\"usage-bar\">\n        \u003Cdiv class=\"usage-fill\" style=\"width: ${stats.daily.percent}%\">\u003C\u002Fdiv>\n        \u003Cspan>Daily: ${stats.daily.used}\u002F${stats.daily.limit}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n      \u003Cdiv class=\"usage-bar\">\n        \u003Cdiv class=\"usage-fill\" style=\"width: ${stats.monthly.percent}%\">\u003C\u002Fdiv>\n        \u003Cspan>Monthly: ${stats.monthly.used}\u002F${stats.monthly.limit}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n    `;\n\n    return container;\n  }\n}\n```\n\n## Resources\n- [API Rate Limiting Best Practices](https:\u002F\u002Fcloud.google.com\u002Farchitecture\u002Frate-limiting-strategies-techniques)\n- [Data Compression Techniques](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FCompression_Streams_API)\n\n## Next Steps\nFor architecture patterns, see `obsidian-reference-architecture`.\n",{"name":5,"author":52,"license":15,"version":53,"description":54,"allowed-tools":55},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Optimize Obsidian plugin resource usage and external service costs.\nUse when managing API quotas, reducing storage usage,\nor optimizing sync and external service consumption.\nTrigger with phrases like \"obsidian resources\", \"obsidian quota\",\n\"optimize obsidian storage\", \"reduce obsidian costs\".\n","Read, Write, Edit","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fobsidian-pack\u002Fskills\u002Fobsidian-cost-tuning",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":66,"prompt":76,"zipAvailable":77},[67,70,73],{"tool":68,"command":69},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill obsidian-cost-tuning",{"tool":71,"command":72},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill obsidian-cost-tuning",{"tool":74,"command":75},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill obsidian-cost-tuning","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fobsidian-pack\u002Fskills\u002Fobsidian-cost-tuning\u002FSKILL.md",true,[],[80,113,148,171,197,224],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":93,"publishedAt":112},"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",[88],{"categoryNo":89,"categoryName":90,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,33,110,111],"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":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":123,"publishedAt":47},"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",[120],{"categoryNo":121,"categoryName":122,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000009","前端开发",[124,125,100,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,39,105,141,142,143,144,145,146,147],"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":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":152,"sourceHtmlUrl":153,"categories":154,"keywords":159,"publishedAt":47},"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",[155,158],{"categoryNo":156,"categoryName":157,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":121,"categoryName":122,"taxonomyType":91,"taxonomyTypeDesc":92},[160,161,162,128,163,164,125,165,98,166,138,167,168,169,170,33,145],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","applications","behavior","local",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":175,"sourceHtmlUrl":176,"categories":177,"keywords":178,"publishedAt":47},"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",[],[179,180,181,182,183,184,185,186,39,187,188,189,190,191,192,193,33,194,195,196,145,29],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":198,"name":199,"nameZh":6,"description":200,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":201,"sourceHtmlUrl":202,"categories":203,"keywords":207,"publishedAt":47},"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",[204],{"categoryNo":205,"categoryName":206,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000023","Skill与智能体开发",[208,209,210,211,212,213,214,215,216,217,218,219,220,221,33,145,222,29,223],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","integrations","specialized","guide","new skill","existing skill","users","Existing","new",{"skillNo":225,"name":226,"nameZh":6,"description":227,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":228,"sourceHtmlUrl":229,"categories":230,"keywords":232,"publishedAt":47},"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",[231],{"categoryNo":205,"categoryName":206,"taxonomyType":91,"taxonomyTypeDesc":92},[226,233,234,235,236,237,238,166,239,240,39,241,242,243,244,145,245],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]