[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F6MN4YP9NPWADHPX57QN14":3,"skill-same:01M6F6MN4YP9NPWADHPX57QN14":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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":56,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6F6MN4YP9NPWADHPX57QN14","alchemy-sdk-patterns",null,"Apply production-ready Alchemy SDK patterns for Web3 applications.\nUse when building reusable blockchain clients, implementing caching,\nmulti-chain abstractions, or type-safe contract interactions.\nTrigger: \"alchemy SDK patterns\", \"alchemy best practices\", \"alchemy code patterns\".","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Falchemy-sdk-patterns\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"patterns","alchemy sdk patterns","alchemy","sdk","caching","code patterns","chain","trigger","io","contract","code","multi-chain","blockchain","safe","ready","edit","write","read","applications","web3","2026-11-10 10:12:30",false,"---\nname: alchemy-sdk-patterns\ndescription: |\n  Apply production-ready Alchemy SDK patterns for Web3 applications.\n  Use when building reusable blockchain clients, implementing caching,\n  multi-chain abstractions, or type-safe contract interactions.\n  Trigger: \"alchemy SDK patterns\", \"alchemy best practices\", \"alchemy code patterns\".\nallowed-tools: Read, Write, Edit\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ntags: [saas, blockchain, web3, alchemy, patterns]\ncompatible-with: claude-code\n---\n\n# Alchemy SDK Patterns\n\n## Overview\n\nProduction patterns for the `alchemy-sdk` package: singleton clients, multi-chain factories, response caching, and type-safe contract wrappers.\n\n## Instructions\n\n### Step 1: Multi-Chain Client Factory\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fclient-factory.ts\nimport { Alchemy, Network } from 'alchemy-sdk';\n\ntype ChainName = 'ethereum' | 'polygon' | 'arbitrum' | 'optimism' | 'base';\n\nconst NETWORK_MAP: Record\u003CChainName, Network> = {\n  ethereum: Network.ETH_MAINNET,\n  polygon: Network.MATIC_MAINNET,\n  arbitrum: Network.ARB_MAINNET,\n  optimism: Network.OPT_MAINNET,\n  base: Network.BASE_MAINNET,\n};\n\nclass AlchemyClientFactory {\n  private static clients = new Map\u003Cstring, Alchemy>();\n\n  static getClient(chain: ChainName): Alchemy {\n    if (!this.clients.has(chain)) {\n      this.clients.set(chain, new Alchemy({\n        apiKey: process.env.ALCHEMY_API_KEY,\n        network: NETWORK_MAP[chain],\n        maxRetries: 3,\n      }));\n    }\n    return this.clients.get(chain)!;\n  }\n\n  static getAllClients(): Map\u003CChainName, Alchemy> {\n    for (const chain of Object.keys(NETWORK_MAP) as ChainName[]) {\n      this.getClient(chain);\n    }\n    return this.clients as Map\u003CChainName, Alchemy>;\n  }\n}\n\nexport { AlchemyClientFactory, ChainName };\n```\n\n### Step 2: Response Caching Layer\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fcache.ts\ninterface CacheEntry\u003CT> { data: T; expiresAt: number; }\n\nclass AlchemyCache {\n  private cache = new Map\u003Cstring, CacheEntry\u003Cany>>();\n  private defaultTtlMs: number;\n\n  constructor(defaultTtlMs: number = 30000) { \u002F\u002F 30s default\n    this.defaultTtlMs = defaultTtlMs;\n  }\n\n  async getOrFetch\u003CT>(key: string, fetcher: () => Promise\u003CT>, ttlMs?: number): Promise\u003CT> {\n    const cached = this.cache.get(key);\n    if (cached && cached.expiresAt > Date.now()) return cached.data;\n\n    const data = await fetcher();\n    this.cache.set(key, { data, expiresAt: Date.now() + (ttlMs || this.defaultTtlMs) });\n    return data;\n  }\n\n  invalidate(keyPrefix: string): void {\n    for (const key of this.cache.keys()) {\n      if (key.startsWith(keyPrefix)) this.cache.delete(key);\n    }\n  }\n}\n\n\u002F\u002F Usage with Alchemy\nconst cache = new AlchemyCache();\n\nasync function getCachedBalance(alchemy: Alchemy, address: string): Promise\u003Cstring> {\n  return cache.getOrFetch(\n    `balance:${address}`,\n    async () => {\n      const balance = await alchemy.core.getBalance(address);\n      return (parseInt(balance.toString()) \u002F 1e18).toFixed(6);\n    },\n    15000 \u002F\u002F 15s cache for balances\n  );\n}\n\nexport { AlchemyCache, getCachedBalance };\n```\n\n### Step 3: Typed NFT Query Builder\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fnft-query.ts\nimport { Alchemy, NftOrdering } from 'alchemy-sdk';\n\nclass NftQueryBuilder {\n  private alchemy: Alchemy;\n  private _owner?: string;\n  private _contracts: string[] = [];\n  private _pageSize = 20;\n  private _excludeFilters: string[] = [];\n\n  constructor(alchemy: Alchemy) { this.alchemy = alchemy; }\n\n  forOwner(address: string): this { this._owner = address; return this; }\n  inCollection(contractAddress: string): this { this._contracts.push(contractAddress); return this; }\n  pageSize(size: number): this { this._pageSize = size; return this; }\n  excludeSpam(): this { this._excludeFilters.push('SPAM'); return this; }\n\n  async execute() {\n    if (!this._owner) throw new Error('Owner address required');\n\n    return this.alchemy.nft.getNftsForOwner(this._owner, {\n      contractAddresses: this._contracts.length > 0 ? this._contracts : undefined,\n      pageSize: this._pageSize,\n      excludeFilters: this._excludeFilters as any[],\n    });\n  }\n}\n\n\u002F\u002F Usage:\n\u002F\u002F const nfts = await new NftQueryBuilder(alchemy)\n\u002F\u002F   .forOwner('vitalik.eth')\n\u002F\u002F   .excludeSpam()\n\u002F\u002F   .pageSize(50)\n\u002F\u002F   .execute();\n```\n\n### Step 4: Error Classification\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Ferrors.ts\ntype AlchemyErrorType = 'rate_limit' | 'auth' | 'network' | 'invalid_params' | 'server' | 'unknown';\n\nfunction classifyError(error: any): { type: AlchemyErrorType; retryable: boolean; message: string } {\n  const status = error.response?.status || error.code;\n\n  if (status === 429) return { type: 'rate_limit', retryable: true, message: 'Rate limit exceeded' };\n  if (status === 401 || status === 403) return { type: 'auth', retryable: false, message: 'Invalid API key' };\n  if (status >= 500) return { type: 'server', retryable: true, message: 'Alchemy server error' };\n  if (error.code === 'ECONNREFUSED' || error.code === 'ETIMEDOUT') return { type: 'network', retryable: true, message: 'Network error' };\n  if (error.message?.includes('invalid params')) return { type: 'invalid_params', retryable: false, message: error.message };\n  return { type: 'unknown', retryable: false, message: error.message };\n}\n\nexport { classifyError, AlchemyErrorType };\n```\n\n## Output\n\n- Multi-chain client factory with lazy initialization\n- Response cache with configurable TTL\n- Type-safe NFT query builder pattern\n- Structured error classification for retry decisions\n\n## Resources\n\n- [Alchemy SDK GitHub](https:\u002F\u002Fgithub.com\u002Falchemyplatform\u002Falchemy-sdk-js)\n- [Alchemy Docs](https:\u002F\u002Fwww.alchemy.com\u002Fdocs)\n\n## Next Steps\n\nApply patterns in `alchemy-core-workflow-a` for real portfolio tracking.\n\n","# Alchemy SDK Patterns\n\n## Overview\n\nProduction patterns for the `alchemy-sdk` package: singleton clients, multi-chain factories, response caching, and type-safe contract wrappers.\n\n## Instructions\n\n### Step 1: Multi-Chain Client Factory\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fclient-factory.ts\nimport { Alchemy, Network } from 'alchemy-sdk';\n\ntype ChainName = 'ethereum' | 'polygon' | 'arbitrum' | 'optimism' | 'base';\n\nconst NETWORK_MAP: Record\u003CChainName, Network> = {\n  ethereum: Network.ETH_MAINNET,\n  polygon: Network.MATIC_MAINNET,\n  arbitrum: Network.ARB_MAINNET,\n  optimism: Network.OPT_MAINNET,\n  base: Network.BASE_MAINNET,\n};\n\nclass AlchemyClientFactory {\n  private static clients = new Map\u003Cstring, Alchemy>();\n\n  static getClient(chain: ChainName): Alchemy {\n    if (!this.clients.has(chain)) {\n      this.clients.set(chain, new Alchemy({\n        apiKey: process.env.ALCHEMY_API_KEY,\n        network: NETWORK_MAP[chain],\n        maxRetries: 3,\n      }));\n    }\n    return this.clients.get(chain)!;\n  }\n\n  static getAllClients(): Map\u003CChainName, Alchemy> {\n    for (const chain of Object.keys(NETWORK_MAP) as ChainName[]) {\n      this.getClient(chain);\n    }\n    return this.clients as Map\u003CChainName, Alchemy>;\n  }\n}\n\nexport { AlchemyClientFactory, ChainName };\n```\n\n### Step 2: Response Caching Layer\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fcache.ts\ninterface CacheEntry\u003CT> { data: T; expiresAt: number; }\n\nclass AlchemyCache {\n  private cache = new Map\u003Cstring, CacheEntry\u003Cany>>();\n  private defaultTtlMs: number;\n\n  constructor(defaultTtlMs: number = 30000) { \u002F\u002F 30s default\n    this.defaultTtlMs = defaultTtlMs;\n  }\n\n  async getOrFetch\u003CT>(key: string, fetcher: () => Promise\u003CT>, ttlMs?: number): Promise\u003CT> {\n    const cached = this.cache.get(key);\n    if (cached && cached.expiresAt > Date.now()) return cached.data;\n\n    const data = await fetcher();\n    this.cache.set(key, { data, expiresAt: Date.now() + (ttlMs || this.defaultTtlMs) });\n    return data;\n  }\n\n  invalidate(keyPrefix: string): void {\n    for (const key of this.cache.keys()) {\n      if (key.startsWith(keyPrefix)) this.cache.delete(key);\n    }\n  }\n}\n\n\u002F\u002F Usage with Alchemy\nconst cache = new AlchemyCache();\n\nasync function getCachedBalance(alchemy: Alchemy, address: string): Promise\u003Cstring> {\n  return cache.getOrFetch(\n    `balance:${address}`,\n    async () => {\n      const balance = await alchemy.core.getBalance(address);\n      return (parseInt(balance.toString()) \u002F 1e18).toFixed(6);\n    },\n    15000 \u002F\u002F 15s cache for balances\n  );\n}\n\nexport { AlchemyCache, getCachedBalance };\n```\n\n### Step 3: Typed NFT Query Builder\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Fnft-query.ts\nimport { Alchemy, NftOrdering } from 'alchemy-sdk';\n\nclass NftQueryBuilder {\n  private alchemy: Alchemy;\n  private _owner?: string;\n  private _contracts: string[] = [];\n  private _pageSize = 20;\n  private _excludeFilters: string[] = [];\n\n  constructor(alchemy: Alchemy) { this.alchemy = alchemy; }\n\n  forOwner(address: string): this { this._owner = address; return this; }\n  inCollection(contractAddress: string): this { this._contracts.push(contractAddress); return this; }\n  pageSize(size: number): this { this._pageSize = size; return this; }\n  excludeSpam(): this { this._excludeFilters.push('SPAM'); return this; }\n\n  async execute() {\n    if (!this._owner) throw new Error('Owner address required');\n\n    return this.alchemy.nft.getNftsForOwner(this._owner, {\n      contractAddresses: this._contracts.length > 0 ? this._contracts : undefined,\n      pageSize: this._pageSize,\n      excludeFilters: this._excludeFilters as any[],\n    });\n  }\n}\n\n\u002F\u002F Usage:\n\u002F\u002F const nfts = await new NftQueryBuilder(alchemy)\n\u002F\u002F   .forOwner('vitalik.eth')\n\u002F\u002F   .excludeSpam()\n\u002F\u002F   .pageSize(50)\n\u002F\u002F   .execute();\n```\n\n### Step 4: Error Classification\n\n```typescript\n\u002F\u002F src\u002Falchemy\u002Ferrors.ts\ntype AlchemyErrorType = 'rate_limit' | 'auth' | 'network' | 'invalid_params' | 'server' | 'unknown';\n\nfunction classifyError(error: any): { type: AlchemyErrorType; retryable: boolean; message: string } {\n  const status = error.response?.status || error.code;\n\n  if (status === 429) return { type: 'rate_limit', retryable: true, message: 'Rate limit exceeded' };\n  if (status === 401 || status === 403) return { type: 'auth', retryable: false, message: 'Invalid API key' };\n  if (status >= 500) return { type: 'server', retryable: true, message: 'Alchemy server error' };\n  if (error.code === 'ECONNREFUSED' || error.code === 'ETIMEDOUT') return { type: 'network', retryable: true, message: 'Network error' };\n  if (error.message?.includes('invalid params')) return { type: 'invalid_params', retryable: false, message: error.message };\n  return { type: 'unknown', retryable: false, message: error.message };\n}\n\nexport { classifyError, AlchemyErrorType };\n```\n\n## Output\n\n- Multi-chain client factory with lazy initialization\n- Response cache with configurable TTL\n- Type-safe NFT query builder pattern\n- Structured error classification for retry decisions\n\n## Resources\n\n- [Alchemy SDK GitHub](https:\u002F\u002Fgithub.com\u002Falchemyplatform\u002Falchemy-sdk-js)\n- [Alchemy Docs](https:\u002F\u002Fwww.alchemy.com\u002Fdocs)\n\n## Next Steps\n\nApply patterns in `alchemy-core-workflow-a` for real portfolio tracking.\n\n",{"name":5,"tags":44,"author":46,"license":15,"version":47,"description":48,"allowed-tools":49,"compatible-with":50},[45,31,38,21,19],"saas","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Apply production-ready Alchemy SDK patterns for Web3 applications.\nUse when building reusable blockchain clients, implementing caching,\nmulti-chain abstractions, or type-safe contract interactions.\nTrigger: \"alchemy SDK patterns\", \"alchemy best practices\", \"alchemy code patterns\".\n","Read, Write, Edit","claude-code","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Falchemy-sdk-patterns",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill alchemy-sdk-patterns",{"tool":66,"command":67},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill alchemy-sdk-patterns",{"tool":69,"command":70},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill alchemy-sdk-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Falchemy-sdk-patterns\u002FSKILL.md",true,[],[75,84,93,101,107,113],{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[81,82,83],"model","model hierarchy","model hierarchy skill",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[90,91,92],"MCP","zoom","zoom mcp",{"skillNo":94,"name":95,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[22,99,100,91],"zoom apps sdk","apps",{"skillNo":102,"name":103,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[103],{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[109],{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[115]]