$npx -y skills add indranilbanerjee/digital-marketing-pro --skill credential-switchSwitch brand credentials. Use when: activating the correct API keys for MCP servers in multi-client workflows.
| 1 | # /digital-marketing-pro:credential-switch |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Switch the active credential profile to a different brand for multi-client agency management. Validates all platform connections and reports which services are available for the target brand. Ensures the correct API keys, tokens, and environment variables are active before executing any platform operations — preventing cross-client data leakage, misrouted ad spend, or accidental operations on the wrong account. |
| 6 | |
| 7 | ## Execution gate (MANDATORY — cannot be skipped) |
| 8 | |
| 9 | 1. Present the validation summary — target brand, per-platform credential status, and any warnings — as an **Execution Summary**. |
| 10 | 2. If validation is clean **and only one** client credential profile is configured, the switch may proceed automatically. If **more than one** client profile exists, or any warning / missing / expiring credential is present, the user must type `yes` (or an equivalent explicit approval) — ANY other input cancels. |
| 11 | 3. Never proceed on ambiguous input. Never auto-retry a failed switch. |
| 12 | 4. When confirmation is required, record it with `python "${CLAUDE_PLUGIN_ROOT}/scripts/approval-manager.py" --brand {slug} --action create-approval --data '{"risk_level":"medium","summary":"credential switch to {slug}"}'` **before** switching, then `python "${CLAUDE_PLUGIN_ROOT}/scripts/approval-manager.py" --brand {slug} --action mark-executed --id {approval_id}` after the switch verifies. |
| 13 | |
| 14 | ## Input Required |
| 15 | |
| 16 | The user must provide (or will be prompted for): |
| 17 | |
| 18 | - **Target brand slug**: The brand slug to switch credentials to — must match a configured brand in `~/.claude-marketing/brands/` with a corresponding credential profile in `~/.claude-marketing/credentials/` |
| 19 | - **Validation depth (optional)**: One of: |
| 20 | - Quick: Check that env vars exist and are non-empty — fast, no API calls |
| 21 | - Full: Test live API connectivity and token validity for each configured platform — slower but confirms actual access |
| 22 | - Defaults to quick for faster switching |
| 23 | - **Force switch (optional)**: If the target profile has missing or expired credentials, whether to switch anyway with warnings or abort entirely — defaults to abort on missing critical credentials (ad platforms, analytics) |
| 24 | - **Reason (optional)**: Brief note for the switch log — helps with audit trail when multiple team members share the system (e.g., "Starting monthly reporting for Acme Corp") |
| 25 | - **Platforms to validate (optional)**: Specific platforms to validate instead of all — useful when you only need certain integrations for the current task (e.g., "google-ads, google-analytics" for a paid media session) |
| 26 | |
| 27 | ## Process |
| 28 | |
| 29 | 1. **Check current context**: Read `~/.claude-marketing/brands/_active-brand.json` to identify the currently active brand, and `~/.claude-marketing/credentials/_active-profile.json` for the current credential profile. Display current state before switching. |
| 30 | 2. **Verify target brand exists**: Confirm the target brand slug has a configured profile at `~/.claude-marketing/brands/{slug}/profile.json`. If not found, list all available brands from `~/.claude-marketing/brands/` and suggest `/digital-marketing-pro:brand-setup` for new brands or `/digital-marketing-pro:client-onboarding` for new client setup |
| 31 | 3. **Check credential profile exists**: Run `credential-manager.py --action get-profile --id {slug}` to verify a credential profile exists for the target brand. If missing, explain how to create one with the required platform credentials and abort with setup instructions |
| 32 | 4. **Validate credential profile**: Run `credential-manager.py --action validate-profile --id {slug}` to check each platform's credentials — verify API keys are present and non-empty, OAuth tokens are not expired, and required environment variables are set for all MCP servers configured in `.mcp.json` |
| 33 | 5. **Present validation summary**: Display a platform-by-platform validation report — for each configured service: |
| 34 | - Platform name and type (ad platform, analytics, CRM, social, email) |
| 35 | - Credential status: configured / not configured / expired |
| 36 | - Required env vars: set or missing (with specific variable names) |
| 37 | - Token expiry date if applicable |
| 38 | - Last successful connection timestamp if available |
| 39 | 6. **Check for recent operations**: Before switching, scan `python "${CLAUDE_PLUGIN_ROOT}/scripts/execution-tracker.py" --brand {slug} --action get-history --limit 20` for recently logged executions and deliveries under the current profile that a context switch could affect. The tracker records completed runs (success/failure) — there is no live "in-progress" feed, so treat the most recent entries as potentially still settling and warn with specific operation details if any look active |
| 40 | 7. **Confirm switch intent**: If validation passed cleanly, proceed |