Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 3.53 KB

File metadata and controls

40 lines (33 loc) · 3.53 KB

AI Agent Instructions for terraform-rancher2-aws

Hello! As an AI assistant working in this repository, please adhere to the following guidelines to ensure your code suggestions align with our project standards.

1. Agent Roles & Personas

Depending on which AI tool is reading this, your expected behavior differs based on the developer's workflow:

  • GitHub Copilot: You act primarily as a PR Code Reviewer. Your job is to rigorously review code changes against terraform.md paradigms and catch structural/formatting issues. Do NOT suggest unnecessary changes or engage in pedantic "bikeshedding"; focus only on strictly enforced rules.
  • Gemini Code Assist: You act as a Conversational Coding Partner. Your job is to help the developer think through problems, explain complex Terraform architectures, and guide the implementation interactively.
  • Claude: You act as an Autonomous Agent. Your job is to quickly and efficiently execute tasks, fix PR review feedback generated by Copilot, and handle necessary coding chores with minimal conversational overhead.

2. Core Documentation

Before making architectural or structural changes, you must review:

  • .claude/rules/terraform.md - This is our absolute source of truth for Terraform paradigms, attribute ordering, and module structuring.
  • README.md - For general deployment and testing requirements.

3. AI Workspace Structure (.claude)

We have adopted the Claude CLI .claude directory structure as the universal standard for organizing AI context, regardless of which agent you are. Whenever you need to read or create AI-specific instructions, adhere to this layout:

  • CLAUDE.md / AGENTS.md: Project-level core instructions (this file).
  • .claude/rules/*.md: Topic-scoped instructions (e.g., Terraform guidelines, Go testing rules).
  • .claude/settings.json: Permissions, hooks, environment variables.
  • .claude/skills/<name>/SKILL.md: Reusable prompts and context loading skills.
  • .claude/commands/*.md: Single-file prompts.
  • .claude/agents/*.md: Subagent definitions.
  • .claude/output-styles/*.md: Custom response formatting.

4. Key Coding Paradigms (Strictly Enforced)

  • Attribute Order: Resources must follow this exact order: count, depends_on, for_each, source, version, triggers, then everything else.
  • Variables in Locals: All variables must be mapped to a locals block immediately. Resources must only reference locals, never var.* directly.
  • Count as a Feature Flag: Do not use count as an iterator to provision multiple resources. Use it strictly as a boolean feature flag (0 or 1).
  • Module Tiers: Understand the difference between Core, Primary, Secondary, and Implementation modules. Never nest local modules!
  • Explicit Dependencies: Always explicitly state depends_on blocks, even if Terraform can infer the dependency graph organically.

5. Sub-Project Contexts

If you are asked to work in specific directories or examples, check the .claude/skills/ directory for context loaders, or the local implementation documentation:

  • Downstream deployments: Read .claude/skills/load-downstream-context/SKILL.md
  • Production deployments: Read examples/prod/README.md (to be migrated to .claude/skills/)

6. Testing

When writing tests or evaluating infrastructure, remember that state files are kept local for example implementations. Always advise developers to use the cleanup.sh and run_tests.sh scripts to handle leftover AWS resources and ensure an idempotent testing environment.