Use when writing, reviewing, or refactoring code that checks an environment variable before calling an SDK — `if (process.env.X)`, `os.environ.get`, `os.Getenv` around analytics, auth tokens, OIDC, cloud clients, or API clients — or when a call is skipped because a key "might be missing". Checks whether the SDK already reads and validates its own credentials; drops the duplicate guard where it does, and keeps or adds one where it does not.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sdk Config?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tartinerlabs-sdk-config)
---
name: sdk-config
description: Use when writing, reviewing, or refactoring code that checks an environment variable before calling an SDK — `if (process.env.X)`, `os.environ.get`, `os.Getenv` around analytics, auth tokens, OIDC, cloud clients, or API clients — or when a call is skipped because a key "might be missing". Checks whether the SDK already reads and validates its own credentials; drops the duplicate guard where it does, and keeps or adds one where it does not.
license: MIT
allowed-tools: Read Glob Grep Edit
compatibility: Any language whose SDKs read credentials from the environment; JS/TS first-class, Python and Go via references/
metadata:
short-description: Drop env checks the SDK already does.
title: Let SDKs check their own settings
goal: keep-code-tidy
audience: developers
---
You remove configuration logic that an SDK already owns. Most SDKs resolve their own credentials (environment variables, token files, profiles, instance roles) and fail fast or do nothing when there are none. A `process.env` check in front of the call copies part of that logic, goes stale when the SDK learns a new source, and hides the SDK's own error. Where the SDK does not check, a guard is the right call — so check first, then decide.
## 1. Pick the Mode
Decide from the request; do not ask.
- **Build mode** — the task adds or changes code that calls an SDK. Apply the rules while writing it, and mention one only when it changed a decision.
- **Review mode** — the user asks to review, audit, or tidy env checks, or points at one. Work through Step 4.
## 2. Detect the Ecosystem
Read the manifest as prose (`package.json`, `pyproject.toml`, `go.mod`, …) and use that ecosystem's SDKs and error types.
| Ecosystem | Detected by | Load |
|---|---|---|
| **JS/TS** | `package.json` | the rules below |
| **Python** | `pyproject.toml`, `requirements*.txt` | [references/python.md](references/python.md) |
| **Go** | `go.mod` | [references/go.md](references/go.md) |
For another language, apply the same rules with its SDKs' credential chains.
## 3. Check What the SDK Does
For each guard, find out what the SDK does when the value is missing. Read its docs, its types, or its source in the installed package, or call it once without the variable. Never decide from memory: SDKs change how they find credentials between versions.
| Without the value, the SDK… | Then |
|---|---|
| throws a clear, typed error quickly | drop the guard; catch the error once ([rules/sdk-owned-config.md](rules/sdk-owned-config.md), [rules/handle-once.md](rules/handle-once.md)) |
| does nothing, by design | drop the guard ([rules/sdk-owned-config.md](rules/sdk-owned-config.md)) |
| sends a request with `undefined`, fails late or obscurely, retries, or bills | keep the guard, or add one ([rules/keep-real-guards.md](rules/keep-real-guards.md)) |
| is not an SDK (a raw `fetch`, the app's own setting) | keep the guard ([rules/keep-real-guards.md](rules/keep-real-guards.md)) |
## Rules
| Rule | Impact | Applies to | File |
|---|---|---|---|
| Let the SDK own its config | HIGH | env checks in front of SDK calls | [rules/sdk-owned-config.md](rules/sdk-owned-config.md) |
| Handle the failure once | HIGH | the call site whose guard was removed | [rules/handle-once.md](rules/handle-once.md) |
| Keep the guards that matter | MEDIUM | raw requests, app settings, costly or noisy calls | [rules/keep-real-guards.md](rules/keep-real-guards.md) |
## 4. Review Mode
1. **Inventory** — every env check whose only job is to skip an SDK call, with the SDK and version it guards. Report the count before editing
2. **Check each SDK** — classify each guard with the table in Step 3, and cite where you saw the behaviour (doc page, file in the package, or a run)
3. **Fix** — remove the guards the SDK makes redundant and route the failure to one handler; keep the rest, with a short comment where the reason is not obvious
4. **Test** — run the project's build and tests, or ask the user to, and report real results
End with what was removed, what was kept and why, and any guard whose SDK behaviour you could not confirm.
## Boundaries
- **Validating config at startup** (a schema over the whole environment) is a separate choice; it is fine to keep, and these rules apply to the call sites behind it.
- **Secrets** found in code are reported, never printed; rotating them belongs to `security`.