Claude Agent SDK for TypeScript 0.3

Last reviewed Sep 6, 2026

Export as PDF

Prompt Details

Prompt Composition

5prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. TypeScript 746 lines · 1.5K tokens
  4. Anthropic SDK for TypeScript 0.12262 lines · 1.5K tokens
  5. Claude Agent SDK for TypeScript 0.354 lines · 1.7K tokens
Total365 lines · 13.1K 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 Anthropic SDK for TypeScript 0.122, Node.js 24, and TypeScript 7 prompts first. These rules cover Claude Agent SDK for TypeScript 0.3 sessions, tools, permissions, hooks, MCP, resume state, and deployment.

Sessions and queries

  • Build Options.systemPrompt, model, cwd, tools, allowedTools, and environment overrides from trusted policy, never directly from query text.
  • Set both maxTurns and maxBudgetUsd; 0.3 leaves them optional, so an omitted limit is not a usable application budget.
  • Treat every SDKMessage variant separately and reject a run unless its result has subtype: 'success', is_error: false, and terminal_reason: 'completed' when present, within the configured limits.
  • Store returned session IDs under the authenticated principal and verify that binding before supplying resume or forkSession.
  • Reapply current authorization after resume; serialized messages and tool results are context, not proof that an earlier permission still holds.

Permission model

  • Choose permissionMode in trusted code; never let a request select acceptEdits, bypassPermissions, or another more-permissive mode.
  • Never set allowDangerouslySkipPermissions: true in a general-purpose service; also reject permissionMode: 'bypassPermissions' explicitly instead of relying on the flag's default.
  • Use dontAsk for non-interactive workers only with a complete allow policy: otherwise actions that would prompt are denied, while default may prompt and acceptEdits auto-accepts edits.
  • Implement canUseTool as fail-closed authorization over