xarchitecture
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Generate, validate, and test IAM policies with automated policy creation and best practices enforcement
How it fires
How this command gets triggered: by you, by Claude, or both.
/xpolicyContext preview
What this command does when you run it.
Generate, validate, and test IAM policies with automated policy creation and best practices enforcement
description: Generate, validate, and test IAM policies with automated policy creation and best practices enforcement tags: [iam, security, policies, aws, compliance, validation]
Manage IAM policies and security configurations based on the arguments provided in $ARGUMENTS.
First, examine the current AWS and IAM setup: !find . -name "*.tf" -o -name "*.yml" -o -name "*.yaml" | xargs grep -l "iam\|IAM" 2>/dev/null | head -5 !ls -la iam/ policies/ security/ terraform/ 2>/dev/null | head -3 !which aws 2>/dev/null && aws --version || echo "AWS CLI not available" !aws sts get-caller-identity 2>/dev/null || echo "AWS credentials not configured"
Based on $ARGUMENTS, perform the appropriate IAM policy operation:
If generating IAM policies (--generate, --service, --resource, --template): !find . -name "*.json" | xargs grep -l "Version.*2012-10-17" 2>/dev/null | head -5 !aws iam list-roles --max-items 5 2>/dev/null || echo "IAM access not available" !find . -name "*.tf" | xargs grep -l "aws_iam" 2>/dev/null | head -3
Generate IAM policies:
If validating policies (--validate, --lint, --syntax-check, --compliance): !find . -name "*.json" -o -name "*.yml" -o -name "*.yaml" | head -10 !python -c "import json; print('JSON validation available')" 2>/dev/null || echo "Python JSON not available" !which jq 2>/dev/null && echo "jq available for JSON processing" || echo "jq not available"
Validate policy configurations:
If testing policies (--test, --simulate, --dry-run, --permissions-test): !aws iam simulate-principal-policy --help 2>/dev/null | head -1 || echo "AWS IAM simulation not available" !find . -name "*test*" | grep -i iam | head -3 2>/dev/null !python -c "import boto3; print('AWS SDK available')" 2>/dev/null || echo "AWS SDK not available"
Test policy functionality:
If analyzing policies (--analyze, --permissions, --vulnerabilities, --least-privilege): !grep -r "\*" . --include="*.json" | grep -i "action\|resource" | head -5 2>/dev/null !aws iam get-account-authorization-details 2>/dev/null | head -10 || echo "IAM account details not accessible" !pip list | grep -E "(boto3|botocore)" 2>/dev/null || echo "AWS Python SDK not installed"
Analyze security posture:
If managing policies (--deploy, --attach, --version, --rollback): !aws iam list-policies --scope Local --max-items 5 2>/dev/null || echo "IAM policy listing not available" !find . -name "*.tf" | xargs grep -l "aws_iam_policy" 2>/dev/null | head -3 !ls -la terraform/ cloudformation/ iac/ 2>/dev/null | head -3
Manage policy lifecycle:
Think step by step about IAM policy requirements and provide:
1. **Security Assessment**:
2. **Policy Strategy**:
3. **Implementation Plan**:
4. **Security Optimization**:
Generate comprehensive IAM policy management with security validation, compliance checking, testing framework, and deployment automation.
If no specific operation is provided, perform IAM security assessment and recommend policy improvements based on current configuration and security best practices.
Transform Claude Code into a complete development platform with 45 AI-powered commands that automate your entire software development workflow. Now with improved git identity management!
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Manage project configuration files, environment variables, and application settings
Continue an execution plan from where it left off across sessions
Interactive debugging support with error analysis and fix suggestions - integrates with Debug Specialist sub-agent for complex…