Implement automated secrets rotation strategy for credentials, API keys, certificates, and encryption keys with zero-downtime deployment and comprehensive audit logging.
When to Use
API key management
Database credentials
TLS/SSL certificates
Encryption key rotation
Compliance requirements
Security incident response
Service account management
Quick Start
Minimal working example:
// secrets-manager.js
const AWS = require("aws-sdk");
const crypto = require("crypto");
class SecretsManager {
constructor() {
this.secretsManager = new AWS.SecretsManager({
region: process.env.AWS_REGION,
});
this.rotationSchedule = new Map();
}
/**
* Generate new secret value
*/
generateSecret(type = "api_key", length = 32) {
switch (type) {
case "api_key":
return crypto.randomBytes(length).toString("hex");
case "password":
// Generate strong password
const chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
Node.js Secrets Manager with Rotation
Node.js Secrets Manager with Rotation
Python Secrets Rotation with Vault
Python Secrets Rotation with Vault
Kubernetes Secrets Rotation
Kubernetes Secrets Rotation
Best Practices
✅ DO
Automate rotation
Use grace periods
Verify new secrets
Maintain rotation audit trail
Implement rollback procedures
Monitor rotation failures
Use managed services (AWS Secrets Manager)
Test rotation procedures
❌ DON'T
Hardcode secrets
Share secrets
Skip verification
Rotate without grace period
Ignore rotation failures
Store secrets in version control
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: aj-geddes-useful-ai-prompts-secrets-rotation3description: Secrets Rotation4---56# Secrets Rotation78## Table of Contents910- [Overview](#overview)11- [When to Use](#when-to-use)12- [Quick Start](#quick-start)13- [Reference Guides](#reference-guides)14- [Best Practices](#best-practices)1516## Overview1718Implement automated secrets rotation strategy for credentials, API keys, certificates, and encryption keys with zero-downtime deployment and comprehensive audit logging.1920## When to Use2122- API key management23- Database credentials24- TLS/SSL certificates25- Encryption key rotation26- Compliance requirements27- Security incident response28- Service account management2930## Quick Start3132Minimal working example:3334```javascript35// secrets-manager.js36const AWS = require("aws-sdk");37const crypto = require("crypto");3839class SecretsManager {40 constructor() {41 this.secretsManager = new AWS.SecretsManager({42 region: process.env.AWS_REGION,43 });4445 this.rotationSchedule = new Map();46 }4748 /**49 * Generate new secret value50 */51 generateSecret(type = "api_key", length = 32) {52 switch (type) {53 case "api_key":54 return crypto.randomBytes(length).toString("hex");5556 case "password":57 // Generate strong password58 const chars =59 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";60// ... (see reference guides for full implementation)61```6263## Reference Guides6465Detailed implementations in the `references/` directory:6667| Guide | Contents |68|---|---|69| [Node.js Secrets Manager with Rotation](references/nodejs-secrets-manager-with-rotation.md) | Node.js Secrets Manager with Rotation |70| [Python Secrets Rotation with Vault](references/python-secrets-rotation-with-vault.md) | Python Secrets Rotation with Vault |71| [Kubernetes Secrets Rotation](references/kubernetes-secrets-rotation.md) | Kubernetes Secrets Rotation |7273## Best Practices7475### ✅ DO7677- Automate rotation78- Use grace periods79- Verify new secrets80- Maintain rotation audit trail81- Implement rollback procedures82- Monitor rotation failures83- Use managed services (AWS Secrets Manager)84- Test rotation procedures8586### ❌ DON'T8788- Hardcode secrets89- Share secrets90- Skip verification91- Rotate without grace period92- Ignore rotation failures93- Store secrets in version control9495---96> Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions.97<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-secrets-rotation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Secrets Rotation It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.