claude-code - 💡(How to fix) Fix [FEATURE] Allow `skill-creator` `run_loop.py` to use other authentication methods besides API keys

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

  1. A team at an organization uses Claude Code with console subscriptions (OAuth login via claude login).
  2. They install the skill-creator plugin to build and optimize custom skills.
  3. When they reach the description optimization step, the skill-creator instructs them to run python -m scripts.run_loop, which fails because ANTHROPIC_API_KEY is not set.
  4. If they set ANTHROPIC_API_KEY in their shell profile to fix this, Claude Code starts billing against their API key instead of their subscription.
  5. The workaround (adding the key to ~/.claude/settings.json under env) is non-obvious and requires explanation outside the plugin itself.
  6. If the optimization step used claude -p instead of the SDK directly, it would just work with zero additional setup.

Fix Action

Fix / Workaround

  1. A team at an organization uses Claude Code with console subscriptions (OAuth login via claude login).
  2. They install the skill-creator plugin to build and optimize custom skills.
  3. When they reach the description optimization step, the skill-creator instructs them to run python -m scripts.run_loop, which fails because ANTHROPIC_API_KEY is not set.
  4. If they set ANTHROPIC_API_KEY in their shell profile to fix this, Claude Code starts billing against their API key instead of their subscription.
  5. The workaround (adding the key to ~/.claude/settings.json under env) is non-obvious and requires explanation outside the plugin itself.
  6. If the optimization step used claude -p instead of the SDK directly, it would just work with zero additional setup.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

The skill-creator plugin's description optimization process (run_loop.py / improve_description.py) calls anthropic.Anthropic() directly via the Python SDK, which requires an ANTHROPIC_API_KEY environment variable to be set. This creates a conflict for users authenticated via Claude Code's console subscription (OAuth): if they set ANTHROPIC_API_KEY in their shell environment, Claude Code itself detects it and switches from their console subscription to API key billing. There is no way to supply credentials to the script without risking this side effect. Also, not all Claude Code users in a team have access to API key creation.

Proposed Solution

The description improvement step (improve_description.py) should authenticate using the already-running Claude Code session rather than requiring a separate API key. The ideal approach would be to rewrite improve_description.py to invoke claude -p as a subprocess (as run_eval.py already does), eliminating the need for ANTHROPIC_API_KEY entirely. If extended thinking is required and can't be passed via claude -p flags, an alternative would be to accept an --api-key CLI argument and pass it directly to anthropic.Anthropic(api_key=...), so users can supply credentials without setting a global environment variable.

Alternative Solutions

  • Setting ANTHROPIC_API_KEY in ~/.claude/settings.json under the env key makes it available to Claude Code subprocesses without affecting Claude Code's own auth — but this is non-obvious, requires manual setup, and is easy to misconfigure.
  • Passing the key inline (ANTHROPIC_API_KEY=... python -m scripts.run_loop ...) works but is awkward for users and doesn't scale to teams.

Priority

High - Significant impact on productivity

Feature Category

Developer tools/SDK

Use Case Example

  1. A team at an organization uses Claude Code with console subscriptions (OAuth login via claude login).
  2. They install the skill-creator plugin to build and optimize custom skills.
  3. When they reach the description optimization step, the skill-creator instructs them to run python -m scripts.run_loop, which fails because ANTHROPIC_API_KEY is not set.
  4. If they set ANTHROPIC_API_KEY in their shell profile to fix this, Claude Code starts billing against their API key instead of their subscription.
  5. The workaround (adding the key to ~/.claude/settings.json under env) is non-obvious and requires explanation outside the plugin itself.
  6. If the optimization step used claude -p instead of the SDK directly, it would just work with zero additional setup.

Additional Context

run_eval.py (also in this plugin) already uses claude -p as a subprocess and works seamlessly without any API key. The inconsistency is only in improve_description.py, which uses the Anthropic Python SDK with extended thinking. It would be worth checking whether claude -p now supports extended thinking via flags, which would allow both scripts to use the same credential-free approach.

extent analysis

TL;DR

Modify the improve_description.py script to authenticate using the Claude Code session instead of requiring a separate API key.

Guidance

  • Investigate if claude -p supports extended thinking via flags, which would allow improve_description.py to use the same credential-free approach as run_eval.py.
  • Consider rewriting improve_description.py to invoke claude -p as a subprocess, eliminating the need for ANTHROPIC_API_KEY.
  • As an alternative, modify improve_description.py to accept an --api-key CLI argument and pass it directly to anthropic.Anthropic(api_key=...), allowing users to supply credentials without setting a global environment variable.
  • Review the ~/.claude/settings.json configuration option for setting environment variables, but be aware of its limitations and potential for misconfiguration.

Example

No code example is provided, as the solution requires further investigation into the capabilities of claude -p and the specific requirements of improve_description.py.

Notes

The proposed solution aims to eliminate the need for a separate API key, reducing the risk of unintended billing changes for Claude Code users. However, the feasibility of this approach depends on the capabilities of claude -p and the requirements of the improve_description.py script.

Recommendation

Apply a workaround by modifying improve_description.py to use the Claude Code session for authentication, as this approach has the potential to eliminate the need for a separate API key and reduce the risk of unintended billing changes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING