From init
Safely configures and manages dlt secrets in TOML files for API keys, database passwords, tokens. Useful for credential setup requests or Python code using dlt.secrets.
npx claudepluginhub dlt-hub/dlthub-ai-workbench --plugin initThis skill uses the workspace's default tool permissions.
**Essential Reading** Credentials & config resolution: `https://dlthub.com/docs/general-usage/credentials/setup.md` `https://dlthub.com/docs/general-usage/credentials/advanced`
Prepares dltHub Runtime for production by splitting dev/prod secrets with MCP tools and configuring destinations like MotherDuck. Use for data pipeline deployment.
Guides secure secrets management using Vault, AWS Secrets Manager, Azure Key Vault, environment variables, rotation, scanning tools, and CI/CD security. For implementing storage, rotation, leak prevention, credentials review.
Validates formats, stores securely, and tests API tokens/credentials like PyPI, GitHub, AWS in Doppler secrets. Triggers on adding secrets, validating tokens, testing auth.
Share bugs, ideas, or general feedback.
Essential Reading Credentials & config resolution: https://dlthub.com/docs/general-usage/credentials/setup.md https://dlthub.com/docs/general-usage/credentials/advanced
Configure credentials in .dlt/secrets.toml. Never read secrets files directly — use dlt-workspace-mcp tools or dlt ai secrets CLI commands.
Prefer MCP — use secrets_list, secrets_view_redacted, secrets_update_fragment tools from dlt-workspace-mcp.
CLI fallback: If MCP is not connected, see cli-reference.md for equivalent dlt ai secrets commands.
Read additional docs as needed:
https://dlthub.com/docs/general-usage/credentials/complex_types.mdGcpServiceAccountCredentials, AwsCredentials, etc.): https://dlthub.com/docs/general-usage/credentials/complex_types.md#built-in-credentialshttps://dlthub.com/docs/dlt-ecosystem/destinations/Parse $ARGUMENTS:
source_name or description of what credentials are needed (e.g. "stripe api key", "postgres credentials")If called from another skill, you already know the source, destination, and which fields are needed — skip to step 3.
If called standalone (e.g. user says "set up secrets" or hit ConfigFieldMissingException):
dlt.secrets.value parameters on @dlt.source/@dlt.resource functionsUse secrets_list to list workspace-scoped secrets files. Profile-scoped files (e.g. .dlt/dev.secrets.toml) appear first — use those when present, fall back to .dlt/secrets.toml otherwise.
Pick the target file from the list — you will pass it as path to secrets_update_fragment in step 4.
Then use secrets_view_redacted (no path argument) to see the unified merged view with values replaced by ***. To inspect a specific file, pass path=".dlt/<profile>.secrets.toml".
Look for:
[sources.<name>], [destination.<name>])<configure me>)Skip this step if you already know the secrets file is empty or doesn't exist.
Before asking the user for values:
Use secrets_update_fragment with fragment (TOML string) and path (target file from step 2). Creates the file if needed, deep-merges without overwriting other sections, returns the redacted result.
CRITICAL: Only write placeholders — never pass actual secret values through secrets_update_fragment or any other tool. The user fills in real values themselves by editing the file directly.
Always scope secrets under the source or destination name:
[sources.<source_name>]
api_key = "<paste-your-api-key-here>"
[destination.<destination_name>.credentials]
host = "localhost"
port = 5432
database = "analytics"
username = "loader"
password = "<paste-your-password-here>"
<source_name> = name= arg on @dlt.source, or the function name if not set.
Use meaningful placeholders that hint at the format:
"sk-*****-your-key" or "ak-xxxx-xxxx-xxxx""ghp_xxxxxxxxxxxxxxxxxxxx" (GitHub), "xoxb-xxxx" (Slack)"<paste-your-password-here>""https://your-instance.example.com"Never use the generic "<configure me>".
Use secrets_view_redacted to see the unified merged view across all workspace secret files. Tell the user which fields still have placeholders and how to obtain real values.
You can write Python scripts that read and use secrets without ever revealing them. dlt.secrets and dlt.config work as dictionaries using the same TOML paths shown by view-redacted.
Example: you need to call the GitHub REST API and view-redacted shows [sources.github] api_key = "***":
import dlt
import requests
# reads from secrets.toml [sources.github] api_key — never prints the value
api_key = dlt.secrets["sources.github.api_key"]
resp = requests.get(
"https://api.github.com/user",
headers={"Authorization": f"Bearer {api_key}"},
)
print(resp.json()["login"])
You can also retrieve typed credentials:
from dlt.sources.credentials import GcpServiceAccountCredentials
creds = dlt.secrets.get("destination.bigquery.credentials", GcpServiceAccountCredentials)
Reference: https://dlthub.com/docs/general-usage/credentials/advanced.md#access-configs-and-secrets-in-code