Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement authentication with Amazon Cognito. Create user pools for sign-up and sign-in, configure identity pools for AWS access, handle JWT tokens, set up social federation with Google and Facebook, and secure APIs with Cognito authorizers.
.claude/skills/terminalskills-aws-cognito/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 125% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 205% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 79% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 133% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 81% | 0% |
Amazon Cognito provides authentication, authorization, and user management. User Pools handle sign-up/sign-in and issue JWTs. Identity Pools grant temporary AWS credentials to authenticated (or guest) users.
bash# Create a user pool aws cognito-idp create-user-pool \ --pool-name app-users-prod \ --auto-verified-attributes email \ --username-attributes email \ --policies '{ "PasswordPolicy": { "MinimumLength": 12, "RequireUppercase": true, "RequireLowercase": true, "RequireNumbers": true, "RequireSymbols": false } }' \ --schema '[ {"Name":"email","Required":true,"Mutable":true}, {"Name":"name","Required":true,"Mutable":true}, {"Name":"custom:company","AttributeDataType":"String","Mutable":true} ]' \ --mfa-configuration OPTIONAL \ --email-configuration EmailSendingAccount=COGNITO_DEFAULT
bash# Create an app client (no secret for SPA/mobile) aws cognito-idp create-user-pool-client \ --user-pool-id us-east-1_ABC123 \ --client-name web-app \ --no-generate-secret \ --explicit-auth-flows ALLOW_USER_SRP_AUTH ALLOW_REFRESH_TOKEN_AUTH \ --supported-identity-providers COGNITO Google \ --callback-urls '["https://app.example.com/callback","http://localhost:3000/callback"]' \ --logout-urls '["https://app.example.com/logout"]' \ --allowed-o-auth-flows code \ --allowed-o-auth-scopes openid email profile \ --allowed-o-auth-flows-user-pool-client
bash# Create a user (admin) aws cognito-idp admin-create-user \ --user-pool-id us-east-1_ABC123 \ --username alice@example.com \ --user-attributes Name=email,Value=alice@example.com Name=name,Value="Alice Johnson" \ --temporary-password "TempPass123!" \ --message-action SUPPRESS
bash# Confirm a user (skip email verification) aws cognito-idp admin-confirm-sign-up \ --user-pool-id us-east-1_ABC123 \ --username alice@example.com
bash# Add user to a group aws cognito-idp admin-add-user-to-group \ --user-pool-id us-east-1_ABC123 \ --username alice@example.com \ --group-name admins
bash# List users aws cognito-idp list-users \ --user-pool-id us-east-1_ABC123 \ --filter 'email ^= "alice"' \ --limit 10
python# Sign up and sign in with boto3 import boto3 client = boto3.client('cognito-idp') CLIENT_ID = 'your-app-client-id' # Sign up client.sign_up( ClientId=CLIENT_ID, Username='bob@example.com', Password='SecurePass123!', UserAttributes=[ {'Name': 'email', 'Value': 'bob@example.com'}, {'Name': 'name', 'Value': 'Bob Smith'} ] ) # Confirm sign up (with code from email) client.confirm_sign_up( ClientId=CLIENT_ID, Username='bob@example.com', ConfirmationCode='123456' ) # Sign in response = client.initiate_auth( ClientId=CLIENT_ID, AuthFlow='USER_PASSWORD_AUTH', AuthParameters={ 'USERNAME': 'bob@example.com', 'PASSWORD': 'SecurePass123!' } ) id_token = response['AuthenticationResult']['IdToken'] access_token = response['AuthenticationResult']['AccessToken'] refresh_token = response['AuthenticationResult']['RefreshToken']
python# Verify Cognito JWT tokens in your API import jwt import requests REGION = 'us-east-1' USER_POOL_ID = 'us-east-1_ABC123' JWKS_URL = f'https://cognito-idp.{REGION}.amazonaws.com/{USER_POOL_ID}/.well-known/jwks.json' # Fetch JWKS (cache this) jwks = requests.get(JWKS_URL).json() def verify_token(token): # Decode header to get key ID header = jwt.get_unverified_header(token) key = next(k for k in jwks['keys'] if k['kid'] == header['kid']) public_key = jwt.algorithms.RSAAlgorithm.from_jwk(key) return jwt.decode( token, public_key, algorithms=['RS256'], audience=CLIENT_ID, issuer=f'https://cognito-idp.{REGION}.amazonaws.com/{USER_POOL_ID}' )
bash# Create Google identity provider aws cognito-idp create-identity-provider \ --user-pool-id us-east-1_ABC123 \ --provider-name Google \ --provider-type Google \ --provider-details '{ "client_id": "your-google-client-id.apps.googleusercontent.com", "client_secret": "your-google-secret", "authorize_scopes": "openid email profile" }' \ --attribute-mapping '{ "email": "email", "name": "name", "username": "sub" }'
bash# Set up a domain for the hosted UI aws cognito-idp create-user-pool-domain \ --user-pool-id us-east-1_ABC123 \ --domain my-app-auth
The hosted UI is then available at: https://my-app-auth.auth.us-east-1.amazoncognito.com/login?client_id=CLIENT_ID&response_type=code&redirect_uri=https://app.example.com/callback
bash# Create identity pool for AWS credential access aws cognito-identity create-identity-pool \ --identity-pool-name app-identity-pool \ --allow-unauthenticated-identities \ --cognito-identity-providers '[{ "ProviderName": "cognito-idp.us-east-1.amazonaws.com/us-east-1_ABC123", "ClientId": "your-app-client-id", "ServerSideTokenCheck": true }]'
bash# Add a pre-sign-up trigger for custom validation aws cognito-idp update-user-pool \ --user-pool-id us-east-1_ABC123 \ --lambda-config '{ "PreSignUp": "arn:aws:lambda:us-east-1:123456789:function:validate-signup", "PostConfirmation": "arn:aws:lambda:us-east-1:123456789:function:welcome-email", "PreTokenGeneration": "arn:aws:lambda:us-east-1:123456789:function:add-custom-claims" }'
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | pass→pass | 10,177 | 7,847 | -23% | 1 | 1 | 0% | 2,043 | 3,695 | +81% | 0 | 0 | — |
case-01 | fail→fail | 8,231 | 7,136 | -13% | 1 | 1 | 0% | 1,687 | 3,531 | +109% | 0 | 0 | — |
case-03 | fail→pass | 6,891 | 4,833 | -30% | 1 | 1 | 0% | 1,353 | 3,046 | +125% | 0 | 0 | — |
case-04 | pass→pass | 5,885 | 3,550 | -40% | 1 | 1 | 0% | 1,069 | 2,530 | +137% | 0 | 0 | — |
case-05 | pass→pass | 2,853 | 2,229 | -22% | 1 | 1 | 0% | 550 | 2,490 | +353% | 0 | 0 | — |
case-06 | pass→pass | 8,006 | 3,618 | -55% | 1 | 1 | 0% | 1,138 | 2,730 | +140% | 0 | 0 | — |
case-07 | pass→pass | 7,712 | 5,566 | -28% | 1 | 1 | 0% | 1,653 | 3,075 | +86% | 0 | 0 | — |
case-08 | pass→pass | 10,762 | 11,353 | +5% | 1 | 1 | 0% | 2,580 | 4,525 | +75% | 0 | 0 | — |
case-09 | pass→pass | 2,546 | 2,384 | -6% | 1 | 1 | 0% | 499 | 2,533 | +408% | 0 | 0 | — |
case-10 | pass→pass | 15,949 | 10,155 | -36% | 1 | 1 | 0% | 3,157 | 4,265 | +35% | 0 | 0 | — |
case-11 | pass→pass | 7,639 | 3,455 | -55% | 1 | 1 | 0% | 1,502 | 2,766 | +84% | 0 | 0 | — |
case-12 | pass→pass | 6,299 | 3,450 | -45% | 1 | 1 | 0% | 1,152 | 2,765 | +140% | 0 | 0 | — |
case-13 | pass→pass | 5,322 | 3,978 | -25% | 1 | 1 | 0% | 1,012 | 2,859 | +183% | 0 | 0 | — |
case-14 | fail→pass | 4,647 | 3,733 | -20% | 1 | 1 | 0% | 929 | 2,838 | +205% | 0 | 0 | — |
case-15 | pass→pass | 6,847 | 2,876 | -58% | 1 | 1 | 0% | 1,403 | 2,672 | +90% | 0 | 0 | — |
case-16 | pass→pass | 10,721 | 6,874 | -36% | 1 | 1 | 0% | 1,730 | 3,198 | +85% | 0 | 0 | — |
case-17 | fail→fail | 10,153 | 8,521 | -16% | 1 | 1 | 0% | 1,895 | 3,535 | +87% | 0 | 0 | — |
case-18 | pass→pass | 9,195 | 4,198 | -54% | 1 | 1 | 0% | 1,561 | 2,792 | +79% | 0 | 0 | — |
case-19 | fail→pass | 8,303 | 5,565 | -33% | 1 | 1 | 0% | 1,847 | 3,313 | +79% | 0 | 0 | — |
case-20 | fail→pass | 6,231 | 5,004 | -20% | 1 | 1 | 0% | 1,377 | 3,203 | +133% | 0 | 0 | — |
case-21 | pass→pass | 6,987 | 7,433 | +6% | 1 | 1 | 0% | 1,599 | 3,729 | +133% | 0 | 0 | — |
case-22 | pass→pass | 7,175 | 8,478 | +18% | 1 | 1 | 0% | 1,557 | 3,671 | +136% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +18 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.