agentleFS
aws-solutions-library-samplesaws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/deployment/CLAUDE.md

guidance-for-claude-code-with-amazon-bedrock / deployment

CLAUDE.md405 starsChanged 5 months agoMIT-0View on GitHub

The file

We split this CLAUDE.md into the rules it gives an agent

10 rules. About 0 are common, 0 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always: use !Sub "arn:${AWS::Partition}:..." — never hardcode arn:aws:.

    line 13
  2. Very specific:

    Use ${AWS::Region}, ${AWS::AccountId} — never hardcode account/region.

    line 15
  3. Very specific:

    Use !If [ConditionName, TrueValue, FalseValue] — never duplicate resources.

    line 20
  4. Very specific:

    One resource per route-key: Don't create two AWS::ApiGatewayV2::Route for the same path.

    line 23
  5. Very specific:

    Use !If inside a single route resource to switch AuthorizationType or Target.

    line 24
  6. Very specific:

    Use AllowedValues where the set is finite (auth modes, regions).

    line 40
  7. Very specific:

    Don't use DependsOn for implicit dependencies (Ref/GetAtt already creates them).

    line 48
  8. Very specific:

    Don't put !Sub inside !If values that contain no variables (cfn-lint error).

    line 49
  9. Very specific:

    Don't create DeletionPolicy: Retain without documenting manual cleanup steps.

    line 50
  10. Very specific:

    Don't reference AWS::StackName in resource names if you plan nested stacks.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — CloudFormation Templates

Quick Commands

cfn-lint deployment/infrastructure/*.yaml    # Validate all templates
cfn-lint deployment/infrastructure/my-stack.yaml  # Validate single template

Key Rules

Partition & Region

  • Always use !Sub "arn:${AWS::Partition}:..." — never hardcode arn:aws:.
  • This ensures GovCloud (aws-us-gov) and China (aws-cn) compatibility.
  • Use ${AWS::Region}, ${AWS::AccountId} — never hardcode account/region.

Conditions Pattern

  • Name conditions positively: HasOidcAuth, HasQuotaEnabled (not NoOidc).
  • Empty string = disabled: !Equals [!Ref ParamName, ""] for optional params.
  • Use !If [ConditionName, TrueValue, FalseValue] — never duplicate resources.

Route-Key Conflicts

  • One resource per route-key. Don't create two AWS::ApiGatewayV2::Route for the same path.
  • Use !If inside a single route resource to switch AuthorizationType or Target.
  • See issue #682 for the pattern that caused a production regression.

IAM Permissions

  • Exact actions only — no s3:* or Action: "*".
  • Scope Resource to the specific ARN (use !Sub with resource refs).
  • Match IAM actions to actual API calls in the Lambda code.
  • See .claude/rules/iam-actions.md.

Stack Ordering

  • Destroy order matters — dependent stacks must be destroyed first.
  • See .claude/rules/stack-ordering.md for the canonical order.
  • New stacks: add to both VALID_STACKS and DESTROYABLE_STACKS in deploy.py.

Parameters

  • New parameters must have Default values (backwards compat with existing deployments).
  • Use AllowedValues where the set is finite (auth modes, regions).
  • Mark sensitive params with NoEcho: true.

Outputs & Exports

  • Conditional outputs need Condition: — don't export values that might not exist.
  • Export names: ${AWS::StackName}-ResourceName format.

Common Pitfalls

  • Don't use DependsOn for implicit dependencies (Ref/GetAtt already creates them).
  • Don't put !Sub inside !If values that contain no variables (cfn-lint error).
  • Don't create DeletionPolicy: Retain without documenting manual cleanup steps.
  • Don't reference AWS::StackName in resource names if you plan nested stacks.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.