rotate-api-keys

Replace old API keys with new ones across multiple configuration files, keystores, and logs. Use this skill when the user asks to rotate, replace, update, or refresh API keys across their system. Supports .env files, JSON keystores, and log files. Automatically creates backups before making changes.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rotate-api-keys" with this command: npx skills add dalehurley/phpbot/dalehurley-phpbot-rotate-api-keys

Rotate API Keys

Input Parameters

ParameterRequiredDescriptionExample
old_api_keyYesThe API key to be replaced (the old or compromised key)sk-old-abc123
new_api_keyYesThe new API key to replace the old one withsk-new-xyz789
target_directoriesNoDirectories to search for .env files and keystores (defaults to home directory and common project paths)~/Herd ~/Code

Procedure

  1. Ask for the old and new API keys if not provided

  2. Identify all target files — .env files, keystore files (keys.json), and logs containing credentials:

    find {{SEARCH_PATH}} -name "*.env" -o -name "keys.json" -o -name "*.log"
    
  3. Create backups and replace the key in each file:

    sed -i.bak "s|{{OLD_KEY}}|{{NEW_KEY}}|g" {{FILE_PATH}}
    
  4. Verify the replacement in a sample of updated files:

    grep -o "sk-[a-zA-Z0-9-]*" {{FILE_PATH}} | head -1
    
  5. Report a summary of all updated files, backup locations, and verification results

Notes

  • Backups are created automatically using the -i.bak flag before any changes
  • Verify replacements before confirming completion
  • Revoke the old key in the API provider's dashboard after rotation
  • Large log files may take time to process

Example

rotate my API key across all my projects and config files
replace my old OpenAI key with a new one in all .env files
update this API key everywhere it appears on my system
rotate my compromised API key across all config files and keystores
refresh my API credentials across my development environment

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

desktop-control

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

summarize-unread-emails

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

csv-tools

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

screenshot

No summary provided by upstream source.

Repository SourceNeeds Review