analyzing-release-read…
Trigger a pre-merge release readiness review on a GitHub PR, GitLab MR, or local branch. Use when the user wants to analyze code changes for risk, correctness,…
Configure AWS Security Agent for the current workspace — provision or reuse an agent space, IAM service role, and S3 bucket. Use when the user asks to "set up security agent", "configure security scanner", "is security agent configured", or on first-time use before any scan or
$ npx -y skills add aws/agent-toolkit-for-aws --skill setup-security-agent --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/setup-security-agentContext preview
The summary Claude sees to decide when to auto-load this skill.
Configure AWS Security Agent for the current workspace — provision or reuse an agent space, IAM service role, and S3 bucket. Use when the user asks to "set up security agent", "configure security scanner", "is security agent configured", or on first-time use before any scan or
name: setup-security-agent description: Configure AWS Security Agent for the current workspace — provision or reuse an agent space, IAM service role, and S3 bucket. Use when the user asks to "set up security agent", "configure security scanner", "is security agent configured", or on first-time use before any scan or pentest.
This skill handles ONE thing: making sure the workspace has a working agent space, IAM service role, and S3 bucket linked together. Scans and pentests live in separate skills and assume this is done.
---
All Security Agent skills share workspace-local state at `.security-agent/`:
This skill's job is to populate `config.json` and create `.gitignore`.
Other skills compute these on each invocation rather than reading them from `config.json`:
| Value | Convention | |-------|------------| | `ACCOUNT` | `aws sts get-caller-identity --query Account --output text` | | `REGION` | `config.region` (default `us-east-1`) | | `service_role_arn` | `arn:aws:iam::${ACCOUNT}:role/SecurityAgentScanRole` | | `s3_bucket` | `security-agent-scans-${ACCOUNT}-${REGION}` |
Why minimal config: the role name and bucket name are deterministic, so storing them adds drift risk (a user re-creating a role manually would silently use a stale path). Only `agent_space_id` is stored because users may have multiple agent spaces and we don't want to ask which one every session.
---
1. **Check existing state:** read `.security-agent/config.json` if it exists. 2. **Caller identity + region:**
export ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
export REGION="${AWS_REGION:-us-east-1}"3. **Agent space:**
aws securityagent batch-get-agent-spaces --agent-space-ids <id>
If the response shows it doesn't exist, treat as missing.
aws securityagent list-agent-spaces
aws securityagent create-agent-space --name security-scans
Capture returned `agentSpaceId`. 4. **Service role** (`SecurityAgentScanRole`, ARN `arn:aws:iam::$ACCOUNT:role/SecurityAgentScanRole`):
aws iam get-role --role-name SecurityAgentScanRole
# Trust policy — includes aws:SourceAccount confused-deputy guard
cat > /tmp/sa-trust.json <<EOF
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"securityagent.amazonaws.com"},"Action":"sts:AssumeRole","Condition":{"StringEquals":{"aws:SourceAccount":"${ACCOUNT}"}}}]}
EOF
# Permissions policy (S3 + CloudWatch Logs)
cat > /tmp/sa-perms.json <<EOF
{"Version":"2012-10-17","Statement":[
{"Effect":"Allow","Action":["s3:GetObject","s3:GetObjectVersion","s3:ListBucket"],"Resource":["arn:aws:s3:::security-agent-scans-${ACCOUNT}-${REGION}","arn:aws:s3:::security-agent-scans-${ACCOUNT}-${REGION}/*"]},
{"Effect":"Allow","Action":["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"],"Resource":"arn:aws:logs:*:${ACCOUNT}:log-group:/aws/securityagent/*"}
]}
EOF
aws iam create-role --role-name SecurityAgentScanRole --assume-role-policy-document file:///tmp/sa-trust.json
# if EntityAlreadyExists:
aws iam update-assume-role-policy --role-name SecurityAgentScanRole --policy-document file:///tmp/sa-trust.json
# always (re)apply permissions:
aws iam put-role-policy --role-name SecurityAgentScanRole --policy-name SecurityAgentCodeReviewAccess --policy-document file:///tmp/sa-perms.json5. **S3 bucket** (`security-agent-scans-$ACCOUNT-$REGION`):
> **Bucket-ownership enforcement (required).** The bucket name is derived from > the caller's AWS account ID and region — both non-secret and publicly > derivable from ARNs / ECR URIs — so any third party can pre-register > ("squat") the predictable name in their own account. Every S3 call MUST > pass `--expected-bucket-owner "$ACCOUNT"` so the operation fails closed if > the bucket is owned by someone else. A `403 Forbidden` on a bucket that > exists but is foreign-owned is **fatal** — abort setup and never upload.
BUCKET="security-agent-scans-${ACCOUNT}-${REGION}"
NEED_CREATE=0
if aws s3api head-bucket --bucket "$BUCKET" --expected-bucket-owner "$ACCOUNT" 2>/tmp/sa-head.err; then
: # bucket exists and is owned by this account — safe to reuse
elif grep -q '404' /tmp/sa-head.err; then
NEED_CREATE=1
elif grep -Eq '403|Forbidden' /tmp/sa-head.err; then
echo "FATAL: bucket $BUCKET exists but is owned by another account (403Help AI coding agents build, deploy, and manage applications on AWS. The Agent Toolkit for AWS gives AI coding agents the tools, knowledge, and guardrails they need to work with AWS services.
Repo: aws/agent-toolkit-for-aws
Trigger a pre-merge release readiness review on a GitHub PR, GitLab MR, or local branch. Use when the user wants to analyze code changes for risk, correctness,…
Have a fast, conversational analysis with the AWS DevOps Agent. Use for cost optimization, architecture review, topology mapping, knowledge / runbook…
Coordinate the AWS DevOps Agent across multiple AgentSpaces from one Claude Code session — route questions to the right space (prod vs staging vs knowledge),…
Run a fast AWS Security Agent diff scan on only the changed code since a git ref. Use when the user asks to scan changes, run a diff scan, check what changed…
Run a deep root-cause investigation on the AWS DevOps Agent. Use when the user describes an incident, alarm, outage, or unexplained behavior — keywords like…
Run an AWS Security Agent penetration test against a live web application — registers and verifies the target domain, exercises the supplied endpoints with the…