Claude SDK for Go 1.71.0
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Claude SDK for Go 1.71.0101 lines · 5K tokens
Total231 lines · 10.5K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 252
- 257
- 287
- 294
- 295
- 307
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 426
- 444
- 488
- 494
- 522
- 532
- 636
- 639
- 732
- 759
- 770
- 772
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1275
- 1395
- 1427
- 1428
Prompt Preview
Apply the Go 1.27 baseline first. These rules cover github.com/anthropics/anthropic-sdk-go v1.71.0, whose minimum Go version is 1.24. Apply the relevant sections to first-party clients, cloud adapters, Messages tools, local executors, managed agents, and organization administration.
Client identity, credentials, and workspace scope
- Construct separate clients for each tenant, workspace, environment, and privilege tier; keep client options and tenant bindings immutable after construction.
- Load
option.WithAPIKey,option.WithAuthToken, and federation providers from trusted secret configuration, and select exactly one authentication mode.WithAuthTokenaddsAuthorizationwithout removing an existingX-Api-Key; when switching an API-key client to an environment bearer token, explicitly useoption.WithHeaderDel("X-Api-Key")too. - Pass
option.WithoutEnvironmentDefaults()toanthropic.NewClientwhen the host environment and profile directory are not trusted configuration boundaries. The marker acts at client construction; passing it to an individual request does not undo inherited defaults or disable Go's proxy environment handling. - Account for default credential precedence: API key, auth token, explicit
ANTHROPIC_PROFILE, environment federation, then active/default profile. Validate the intended identity before serving traffic; profile errors can surface only on the first request, and explicit credentials can shadow profile authentication while its workspace header and base URL still apply. - Set
FederationOptions.FederationRuleID,