Agent Skillswaybarrios/opencode-power-pack › hf-cloud-aws-context-discovery

hf-cloud-aws-context-discovery

GitHub

在执行 AWS 工作前自动发现并验证本地 AWS 配置,包括 Profile、Region 及身份凭证。特别识别 SSO 角色以提前规避 IAM 权限错误,确保后续 SageMaker 等操作的安全性与准确性。

skills/hf-cloud-aws-context-discovery/SKILL.md waybarrios/opencode-power-pack

Trigger Scenarios

执行 AWS 相关任务前 需要确认当前 AWS 上下文时

Install

npx skills add waybarrios/opencode-power-pack --skill hf-cloud-aws-context-discovery -g -y
More Options

Use without installing

npx skills use waybarrios/opencode-power-pack@hf-cloud-aws-context-discovery

指定 Agent (Claude Code)

npx skills add waybarrios/opencode-power-pack --skill hf-cloud-aws-context-discovery -a claude-code -g -y

安装 repo 全部 skill

npx skills add waybarrios/opencode-power-pack --all -g -y

预览 repo 内 skill

npx skills add waybarrios/opencode-power-pack --list

SKILL.md

Frontmatter
{
    "name": "hf-cloud-aws-context-discovery",
    "license": "Apache-2.0 (modified; see UPSTREAMS.json)",
    "description": "Discover the active AWS profile, region, account, and caller identity before SageMaker or AWS work. Use when local AWS context is needed or unspecified; do not use for cloud-agnostic model planning."
}

AWS Context Discovery

Before doing any AWS work, read the user's local AWS config. Don't guess the region, and don't ask the user for things their config already answers.

What to discover

Run these at the start of the AWS work and remember the results for the rest of the session.

1. Active profile

AWS_PROFILE env var, else default. If the user mentioned a profile in their prompt, that overrides. If the named profile doesn't exist in ~/.aws/config, surface that clearly.

2. Region

Resolution order — stop at the first one that produces a value:

  1. Region the user explicitly named in this conversation
  2. AWS_REGION env var
  3. AWS_DEFAULT_REGION env var
  4. region field on the active profile in ~/.aws/config
  5. Ask the user — but only after the first four have failed

Do not fall back to us-east-1 or any other hardcoded default.

3. Credentials, account ID, caller ARN

aws sts get-caller-identity --profile <profile> --region <region>

Three purposes in one call: confirms credentials are valid (stop if not), returns the Account ID (needed for ARN construction), returns the Arn of the caller.

4. Identify SSO / assumed-role principals

The Arn field tells you what kind of principal this is. The pattern matters because it determines what IAM operations the caller can do.

ARN pattern Type IAM write capability
arn:aws:iam::<acct>:user/<name> IAM user Depends on attached policies
arn:aws:sts::<acct>:assumed-role/AWSReservedSSO_<...>/<email> SSO assumed-role Typically none — can't create/modify IAM roles
arn:aws:sts::<acct>:assumed-role/<role>/<session> Regular assumed-role Depends on the role

If the caller is SSO, surface this immediately before later skills hit iam:CreateRole and fail:

Heads up: you're authenticated via SSO (AWSReservedSSO_<PermissionSet>_...). SSO principals usually can't create IAM roles directly. If we need a SageMaker execution role, I'll look for an existing one first — if none exists, you'll need to ask whoever manages your AWS access to create one.

This is the highest-leverage thing this skill does. Surfacing it now turns a confusing mid-deployment error into a five-second conversation.

Commands to run

# Effective profile and region (faster than parsing config files)
aws configure list

# Validate credentials and get identity
aws sts get-caller-identity
aws sts get-caller-identity --profile <profile-name>  # if a profile was named

aws configure list handles env-var overrides and shows the resolved effective values. Prefer it over parsing ~/.aws/config yourself. If you need to read raw config (e.g. to list profiles), ~/.aws/config and ~/.aws/credentials are plain INI files — read-only.

What to report back

One or two lines, not a wall of text:

Working with profile my-profile in eu-west-1, account 123456789012. You're authenticated via SSO, so we'll need to use an existing IAM role rather than create one.

Don't ask the user to confirm the region you just read from their config — they configured it; that is the confirmation.

If something is wrong (credentials expired, profile doesn't exist, no region anywhere), stop and surface the specific error before continuing.

Version History

  • f198a18 Current 2026-08-16 09:11

Same Skill Collection

skills/agentic-actions-auditor/SKILL.md
skills/agents-md-revise/SKILL.md
skills/ai-slop/SKILL.md
skills/code-architect/SKILL.md
skills/code-explorer/SKILL.md
skills/code-quality/SKILL.md
skills/code-review/SKILL.md
skills/code-reviewer/SKILL.md
skills/codeql/SKILL.md
skills/design-patterns/SKILL.md
skills/differential-review/SKILL.md
skills/feature-dev/SKILL.md
skills/fp-check/SKILL.md
skills/frontend-design/SKILL.md
skills/hf-cli/SKILL.md
skills/hf-cloud-python-env-setup/SKILL.md
skills/hf-cloud-sagemaker-deployment-planner/SKILL.md
skills/hf-cloud-sagemaker-iam-preflight/SKILL.md
skills/hf-cloud-sagemaker-production-defaults/SKILL.md
skills/hf-cloud-serving-image-selection/SKILL.md
skills/hf-mem/SKILL.md
skills/huggingface-best/SKILL.md
skills/huggingface-community-evals/SKILL.md
skills/huggingface-datasets/SKILL.md
skills/huggingface-gradio/SKILL.md
skills/huggingface-llm-trainer/SKILL.md
skills/huggingface-local-models/SKILL.md
skills/huggingface-lora-space-builder/SKILL.md
skills/huggingface-paper-publisher/SKILL.md
skills/huggingface-papers/SKILL.md
skills/huggingface-spaces/SKILL.md
skills/huggingface-tool-builder/SKILL.md
skills/huggingface-trackio/SKILL.md
skills/huggingface-vision-trainer/SKILL.md
skills/huggingface-zerogpu/SKILL.md
skills/insecure-defaults/SKILL.md
skills/mcp-builder/SKILL.md
skills/paper-summarizer/SKILL.md
skills/sarif-parsing/SKILL.md
skills/security-review/SKILL.md
skills/security-threat-model/SKILL.md
skills/semgrep-rule-creator/SKILL.md
skills/semgrep-rule-variant-creator/SKILL.md
skills/semgrep/SKILL.md
skills/sharp-edges/SKILL.md
skills/skill-creator/SKILL.md
skills/supply-chain-risk-auditor/SKILL.md
skills/train-sentence-transformers/SKILL.md
skills/transformers-js/SKILL.md

Metadata

Files
0
Version
f198a18
Hash
c7819118
Indexed
2026-08-16 09:11

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 17:57
浙ICP备14020137号-1 $mapa de visitantes$