一键导入
aws-profile-management
Use before any Terraform or AWS operation to verify correct credentials and profile are active. Prevents cross-environment accidents.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use before any Terraform or AWS operation to verify correct credentials and profile are active. Prevents cross-environment accidents.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when executing implementation plans with independent tasks in the current session
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Use when generating documentation for Terraform modules, infrastructure, or runbooks. Creates READMEs, operational guides, and architecture docs.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Use when you have a written implementation plan to execute in a separate session with review checkpoints
基于 SOC 职业分类
| name | aws-profile-management |
| description | Use before any Terraform or AWS operation to verify correct credentials and profile are active. Prevents cross-environment accidents. |
Credential mistakes are one of the most common causes of infrastructure accidents. This skill ensures the correct AWS profile is active before any operation.
Announce at start: "I'm using the aws-profile-management skill to verify credentials."
# Get current identity
aws sts get-caller-identity
Expected output includes:
| Environment | Expected Account | Expected Role Pattern |
|---|---|---|
| dev | 123456789012 | -dev-, -developer- |
| staging | 234567890123 | -staging-, -deploy- |
| prod | 345678901234 | -prod-, -admin- |
STOP if account doesn't match expected environment.
For assumed roles:
# Check remaining session time
aws sts get-caller-identity 2>&1 | grep -i expir || echo "Credentials valid"
For SSO:
# Check SSO session
aws sso list-accounts 2>&1 || echo "Check SSO login status"
# List available profiles
aws configure list-profiles
# Set profile for session
export AWS_PROFILE=production
# Or use inline
AWS_PROFILE=production terraform plan
# Login to SSO
aws sso login --profile production
# Verify login
aws sts get-caller-identity --profile production
# Assume role and export credentials
eval $(aws sts assume-role \
--role-arn arn:aws:iam::ACCOUNT:role/ROLE_NAME \
--role-session-name terraform-session \
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
--output text | \
awk '{print "export AWS_ACCESS_KEY_ID="$1"\nexport AWS_SECRET_ACCESS_KEY="$2"\nexport AWS_SESSION_TOKEN="$3}')
# Verify
aws sts get-caller-identity
environments/
├── dev/
├── staging/
└── prod/
# Detect environment from path
ENV=$(basename "$(pwd)")
echo "Detected environment: $ENV"
# Check backend configuration
grep -A 10 'backend' *.tf | grep -E 'bucket|key|workspace'
# Check Terraform workspace
terraform workspace show
Before any Terraform or AWS operation:
Identity Verified
Environment Confirmed
Permission Verified
| Condition | Action |
|---|---|
| Account ID doesn't match environment | STOP - wrong account! |
| Role seems too permissive for task | Verify with user |
| Credentials expired | Re-authenticate |
| Multiple AWS_* env vars set | Clear and use profile |
| Unknown account ID | Verify before proceeding |
Symptoms:
Solution:
# Clear any env vars
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
# Set correct profile
export AWS_PROFILE=correct_profile
# Verify
aws sts get-caller-identity
Symptoms:
Solution:
# For SSO
aws sso login --profile your_profile
# For assumed role
# Re-run assume-role command
Symptoms:
Solution:
# Check all credential sources
echo "Profile: $AWS_PROFILE"
echo "Access Key set: ${AWS_ACCESS_KEY_ID:+yes}"
echo "Default region: $AWS_DEFAULT_REGION"
aws configure list
This skill should be invoked before:
The profile verification output should be included in analysis reports to confirm correct environment.