agentleFS
supportersimulatorsupportersimulator/3-surgeons/skills/setup-api-keys/SKILL.md

setup-api-keys

Skill2 starsChanged 9 months agoMITView on GitHub

Interactive API key resolution — guides users through fixing missing surgeon API keys with detected options

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Only show options where the tool is actually available.

    line 40
  2. Very specific:

    If uses_command: true (e.g., aws secretsmanager call in .zshrc):

    line 45
  3. Very specific:

    If uses_command: false (plain value): The key was likely auto-resolved by diagnose_auth.

    line 52
  4. Very specific:

    If metadata.exists: false: Ask user for the key value, then store:

    line 75
  5. Distinctive:

    NEVER ask the user to paste a key in chat: Instead:

    line 91
  6. Distinctive:

    If still failing, present remaining options

    line 102
  7. Distinctive:

    If all options exhausted, explain degraded mode (2/3 surgeons)

    line 103
  8. Distinctive:

    NEVER display or log the actual API key value

    line 107
  9. Distinctive:

    If user accidentally pastes a key in chat, warn them to rotate it immediately

    line 108
  10. Distinctive:

    Prefer Keychain/1Password over shell profile for persistence (encrypted at rest)

    line 109
  11. Distinctive:

    All subprocess commands use 10s timeout

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Setup API Keys

When This Fires

  • probe returns a surgeon with status: "fail" and a remediation field
  • Any tool returns an auth error mid-operation
  • User asks about API key configuration

Flow

  1. Read the remediation plan from the probe/tool response
  2. Present options as a numbered list — only show sources where available: true
  3. Wait for user choice
  4. Execute the resolution based on choice
  5. Persist if requested — offer Keychain storage for future sessions
  6. Re-run probe to verify the fix worked

Presenting Options

Format the remediation.sources into a clear menu:

🔑 {surgeon} needs {key_name} ({provider}).

{N}. {source.description}
   → `{source.resolve_command}`
{N+1}. Switch to a local model (free, no API key needed)
   → Available: {local_alternatives list}
{N+2}. Paste a key manually
   → I'll store it securely (env var or Keychain)
{N+3}. Skip for now
   → {skip_option}

Only show options where the tool is actually available. Don't show AWS if aws CLI isn't installed.

Executing Each Choice

Shell Profile (method: "shell_profile")

If uses_command: true (e.g., aws secretsmanager call in .zshrc):

# Run the export line to load the key
eval '{resolve_command}'

Then verify with probe.

If uses_command: false (plain value): The key was likely auto-resolved by diagnose_auth. Just re-probe.

AWS Secrets Manager (method: "aws_secretsmanager")

# Get the key value
KEY_VALUE=$(aws secretsmanager get-secret-value --secret-id {metadata.secret_id} --query SecretString --output text)
export {key_name}="$KEY_VALUE"

Then offer: "Want me to add this to your shell profile for future sessions?"

1Password (method: "1password")

KEY_VALUE=$(op item get "{provider}" --fields credential)
export {key_name}="$KEY_VALUE"

macOS Keychain (method: "keychain")

If metadata.exists: true:

KEY_VALUE=$(security find-generic-password -s {metadata.service} -w)
export {key_name}="$KEY_VALUE"

If metadata.exists: false: Ask user for the key value, then store:

security add-generic-password -s {metadata.service} -a 3surgeons -w "{key_value}"

Switch Provider (local alternative)

Edit ~/.3surgeons/config.yaml to point the surgeon at the local backend:

surgeons:
  cardiologist:
    provider: {detected.provider}
    endpoint: {detected.endpoint}
    model: {detected.models[0]}

Manual Paste

NEVER ask the user to paste a key in chat. Instead:

# Guide them to set it in their environment
export {key_name}="your-key-here"
# Or store in Keychain
security add-generic-password -s 3surgeons-{surgeon} -a 3surgeons -w "your-key-here"

After Resolution

  1. Re-run probe to verify
  2. If still failing, present remaining options
  3. If all options exhausted, explain degraded mode (2/3 surgeons)

Security Rules

  • NEVER display or log the actual API key value
  • If user accidentally pastes a key in chat, warn them to rotate it immediately
  • Prefer Keychain/1Password over shell profile for persistence (encrypted at rest)
  • All subprocess commands use 10s timeout

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.