udondan/iam-floyd/iam-floyd-usage
Claude Code and agent skill by udondan/iam-floyd
- community
Checking that the SKILL.md file is still in the repository.
Expert guidance for using the iam-floyd and cdk-iam-floyd libraries to generate AWS IAM policy statements with a fluent, type-safe interface in TypeScript, JavaScript, Python, Java, C#/.NET and Go projects. Use this skill whenever a user asks how to write IAM policies with iam-floyd, wants to allow or deny AWS actions, needs to scope policies to specific resources, wants to add conditions to IAM statements, is working on least-privilege IAM in AWS CDK, or is trying to understand the library's API (toXxx, onXxx, ifXxx, allow/deny, allActions, etc.). Also trigger for questions about semantic policy classes, subclassing Statement providers, using Collections, policy documents with size limits and splitting, or converting JSON policies to iam-floyd code.
Install
npx vskill@latest install udondan/iam-floyd/iam-floyd-usageSKILL.md
Using iam-floyd / cdk-iam-floyd
IAM Floyd is a fluent, type-safe AWS IAM policy statement generator. Instead of writing error-prone JSON, you call strongly-typed methods and let the library build the correct policy structure.
It comes in two variants with the same API, released together with the same version number in every language:
- `iam-floyd` (standalone) creates statements as JSON, for the AWS SDKs,
CloudFormation, Terraform or anything else that takes an IAM policy. The packages for Python, Java, .NET and Go are native: no Node.js, no dependencies.
- `cdk-iam-floyd` creates AWS CDK v2 statements: every statement is an
iam.PolicyStatement. The packages for Python, Java, .NET and Go are built with jsii, like the AWS CDK itself, and need Node.js.
The examples in this skill are TypeScript. The API is the same in every language, with names adapted to the language, see Other languages.
Installation
| Language | iam-floyd | cdk-iam-floyd | |
|---|---|---|---|
| TypeScript / JavaScript | npm install iam-floyd | npm install cdk-iam-floyd | |
| Python (3.10+) | pip install iam-floyd | pip install cdk-iam-floyd | |
| Java (11+) | Maven com.udondan:iam-floyd | Maven com.udondan:cdk-iam-floyd | |
| C# / .NET (8+) | dotnet add package IAM.Floyd | dotnet add package CDK.IAM.Floyd | |
| Go (1.21+) | go get udondan.github.io/iam-floyd/go/iamfloyd | go get udondan.github.io/iam-floyd/go/cdkiamfloyd |
Pin the exact version (e.g."iam-floyd": "0.850.0"inpackage.json,iam-floyd==0.850.0for pip) — the package is pre-1.0.0 and the API may change.A new version is released every Monday. CDK v2 requirescdk-iam-floyd >= 0.300.0.The Go modules are not on GitHub, but on a module proxy underudondan.github.io/iam-floyd/go, which keeps the newest 30 releases.go getfinds it without any configuration.
Basic import
The statement providers (Ec2, S3, ...) live in a sub-package or namespace statement. The core classes (Operator, Collection, the policy documents, AwsManagedPolicy, AwsServicePrincipal) live in the package itself:
| Language | iam-floyd | cdk-iam-floyd | |
|---|---|---|---|
| Python | from iam_floyd import Statement | from cdk_iam_floyd import Statement | |
| Java | com.udondan.iamFloyd.statement.Ec2, core com.udondan.iamFloyd.* | com.udondan.iamFloyd.cdk.statement.Ec2, core com.udondan.iamFloyd.cdk.* | |
| C# | using Statement = IAM.Floyd.Statement;, core using IAM.Floyd; | using Statement = CDK.IAM.Floyd.Statement;, core using CDK.IAM.Floyd; | |
| Go | .../go/iamfloyd/statement, core .../go/iamfloyd, .../collection | .../go/cdkiamfloyd/statement, core and collection .../go/cdkiamfloyd |
In Go, both imports are needed: statement.NewEc2(nil) and iamfloyd.NewManagedPolicyDocument(...).
Core vocabulary — the fluent chain
Every statement follows this readable pattern:
Effect — allow() / deny()
The default effect is Allow, so .allow() is optional but improves readability.
Actions — to*()
Every documented IAM action has a typed to*() method:
Bulk action helpers:
| Method | Effect | |
|---|---|---|
allActions() | Adds ec2:* | |
allListActions() | All actions with access level _List_ | |
allReadActions() | All actions with access level _Read_ | |
allWriteActions() | All actions with access level _Write_ | |
allPermissionManagementActions() | All permission-management actions | |
allTaggingActions() | All tagging actions | |
allMatchingActions('/pattern/flags') | Regex match (JS literal style, as string) |
allMatchingActionsand access-level methods expand to an explicit list atcall time — they won't auto-update if AWS adds new actions later.
Use .compact() after access-level methods to collapse the list into wildcard patterns (reduces policy size, but future AWS actions may match unexpectedly):
Missing action? Use the generic to() escape hatch:
Resources — on*()
Every resource type has an on*() method that builds the correct ARN:
In cdk-iam-floyd, omitting account/region defaults to the CDK stack's values. In iam-floyd (standalone), they default to *.
In cdk-iam-floyd, the on*() methods also take a CDK construct (L1 or L2) in place of the name, if aws-cdk-lib has a reference interface for it (aws-cdk-lib/interfaces, e.g. IBucketRef). The ARN of the construct is used; account, region and partition are ignored:
Override defaults for multiple resources using in*() / in():
in*()methods set defaults only for resources added after them — call thembefore theon*()calls they should affect.
Already have an ARN? Use the generic on():
Conditions — if*()
Every documented condition key has an if*() method. Global AWS conditions start with ifAws*.
Multiple conditions on one statement are AND-ed together. For OR logic, use multiple statements.
Override the operator (last argument):
Deny + condition operator trap: When usingdeny()with a tag condition, theoperator direction matters a lot. The default operator on mostif*()methods isStringLike. So.deny().toStopInstances().ifResourceTag('Owner', 'alice')means"deny stop _when_ the tag matches alice" — which denies the owner, not others.To deny everyone _except_ the owner, flip it:.deny().toStopInstances().ifResourceTag('Owner', 'alice', Operator.stringNotEquals)
Complex operators (ForAllValues, ForAnyValue, IfExists):
Missing condition? Use the generic if():
Principals — for*()
In cdk-iam-floyd, avoid building assume-role policies with iam-floyd — useCDK'siam.PolicyDocument/iam.ManagedPolicywith a principal instead. iam-floyd'sfor*()methods are mainly useful for resource-based policies (S3 bucket policies, etc.)
NotAction / NotResource / NotPrincipal
Understand these well before using — they can be surprisingly permissive.
Statement SID
Building a complete policy
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/iam-floyd-usage/SKILL.md
Popularity
- Repository stars
- 573
- Repository forks
- 21
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/udondan/iam-floyd/iam-floyd-usage)