Anthropic SDK for TypeScript 0.122
Last reviewed Oct 11, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 746 lines · 1.5K tokens
- Anthropic SDK for TypeScript 0.12262 lines · 1.5K tokens
Total311 lines · 11.5K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 95
- 113
- 116
- 117
- 200
- 208
- 209
- 214
- 250
- 295
- 297
- 319
- 321
- 323
- 330
- 338
- 346
- 347
- 352
- 354
- 362
- 367
- 377
- 426
- 444
- 459
- 471
- 488
- 494
- 502
- 522
- 524
- 532
- 602
- 639
- 653
- 732
- 754
- 770
- 807
- 829
- 838
- 841
- 862
- 863
- 908
- 915
- 916
- 918
- 922
- 942
- 943
- 1004
- 1321
- 1333
- 1427
Prompt Preview
Apply the Node.js 24 and TypeScript 7 prompts first. These rules cover Anthropic SDK for TypeScript 0.122 clients, Messages API requests, tools, streaming, files, errors, and production controls.
Clients and credentials
- Instantiate
Anthropicin trusted server code; browser use is blocked unlessdangerouslyAllowBrowser: true, never with a secret key. - Load
apiKeyfrom a server secret provider, with separate credentials and spend limits per environment and workload. Withconfigorcredentials, disable unintended environment key/bearer defaults viaapiKey: nullandauthToken: null. - Keep
baseURL, customfetch,fetchOptions, middleware, proxy/agent, anddefaultHeadersin trusted configuration. Validate profile/configbase_urlseparately: it controls credential exchanges even whenbaseURLis pinned. - Override the 10-minute
timeoutand enforce a separate workload deadline with an abort signal so disconnected callers don't leave costly work running. - Avoid mutable shared clients when tenant headers or keys differ; close custom HTTP agents at shutdown.
- Isolate federation
credentials_pathfiles per identity and configuration: the disk cache can reuse a token without checking organization, workspace, federation rule, or token endpoint. - Derive
anthropic-workspace-idanduser_profile_idfrom authorized tenant context; request headers can override the user-OAuth profile workspace default and generatedanthropic-user-profile-idheader.
Messages
- Build
systemfrom trusted policy; keep user, document, and tool-result blocks in