[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DS03APMJ2VFWN9WTEPET9K":3,"skill-same:01M6DS03APMJ2VFWN9WTEPET9K":135},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":25,"linkOnly":26,"markdownContent":27,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M6DS03APMJ2VFWN9WTEPET9K","terragrunt-generator",null,"Generate\u002Fcreate\u002Fscaffold Terragrunt HCL files — root.hcl, terragrunt.hcl, child modules, stacks, multi-env layouts.","AntifragileTech\u002Fantifragile-claude-code","AntifragileTech","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F174357194?v=4","01M6DQCYMK4CDSQQAN0ZC72NTV","01M6DQCYS9YPW1WKMQ5TJMPQ43",9,"MIT","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002FSKILL.md",[],[18,19,20,21,22,23,24],"terragrunt generator","scaffold","create","generate","modules","files","env","2026-11-10 10:12:30",false,"---\nname: terragrunt-generator\ndescription: Generate\u002Fcreate\u002Fscaffold Terragrunt HCL files — root.hcl, terragrunt.hcl, child modules, stacks, multi-env layouts.\n---\n\n# Terragrunt Generator\n\n## Overview\n\nGenerate production-ready Terragrunt configurations following current best practices, naming conventions, and security standards. All generated configurations are automatically validated.\n\n## Trigger Phrases\n\nUse this skill when the user asks for:\n- A new `root.hcl`, `terragrunt.hcl`, or `terragrunt.stack.hcl`\n- Multi-environment Terragrunt layouts (`dev\u002Fstaging\u002Fprod`)\n- Terragrunt dependency wiring (`dependency` or `dependencies` blocks)\n- Terragrunt module source setup (local, Git, Terraform Registry via `tfr:\u002F\u002F\u002F`)\n- Stack catalog unit generation under `catalog\u002Funits\u002F*`\n\n**Terragrunt 2025 Features Supported:**\n- [Stacks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F) - Infrastructure blueprints with `terragrunt.stack.hcl` (GA since v0.78.0)\n- [Feature Flags](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F) - Runtime control via `feature` blocks\n- [Exclude Blocks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude) - Fine-grained execution control (replaces deprecated `skip`)\n- [Errors Blocks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors) - Advanced error handling (replaces deprecated `retryable_errors`)\n- [OpenTofu Engine](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F) - Alternative IaC engine support\n\n## Root Configuration Naming\n\n> **RECOMMENDED**: Use `root.hcl` instead of `terragrunt.hcl` for root files per [migration guide](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002Fmigrating-from-root-terragrunt-hcl).\n\n| Approach | Root File | Include Syntax |\n|----------|-----------|----------------|\n| **Modern** | `root.hcl` | `find_in_parent_folders(\"root.hcl\")` |\n| **Legacy** | `terragrunt.hcl` | `find_in_parent_folders()` |\n\n**Include standard:** Default to `find_in_parent_folders(\"root.hcl\")` in all new examples and generated configs. Use `find_in_parent_folders()` only when explicitly targeting a legacy root file named `terragrunt.hcl`.\n\n## Architecture Patterns\n\n> **CRITICAL:** Before generating ANY configuration, you MUST determine the architecture pattern and understand its constraints.\n\n### Pattern A: Multi-Environment with Environment-Agnostic Root\n\n**Use when:** Managing multiple environments (dev\u002Fstaging\u002Fprod) with shared root configuration.\n\n**Key principle:** `root.hcl` is **environment-agnostic** - it does NOT read environment-specific files.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC (no env.hcl references)\n├── dev\u002F\n│   ├── env.hcl           # Environment variables (locals block)\n│   ├── vpc\u002Fterragrunt.hcl\n│   └── rds\u002Fterragrunt.hcl\n└── prod\u002F\n    ├── env.hcl           # Environment variables (locals block)\n    ├── vpc\u002Fterragrunt.hcl\n    └── rds\u002Fterragrunt.hcl\n```\n\n**Root.hcl constraints:**\n- ❌ CANNOT use `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` - env.hcl doesn't exist at root level\n- ❌ CANNOT reference `local.environment` or `local.aws_region` that come from env.hcl\n- ✅ CAN use static values or `get_env()` for runtime configuration\n- ✅ CAN use `${path_relative_to_include()}` for state keys (this works dynamically)\n\n**Child modules read env.hcl:**\n```hcl\n# dev\u002Fvpc\u002Fterragrunt.hcl\ninclude \"root\" {\n  path = find_in_parent_folders(\"root.hcl\")\n}\n\nlocals {\n  env = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n}\n\ninputs = {\n  name = \"${local.env.locals.environment}-vpc\"  # Works: env.hcl exists in dev\u002F\n}\n```\n\n### Pattern B: Single Environment or Environment-Aware Root\n\n**Use when:** Single environment OR all environments share the same root with environment detection.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Can be environment-aware via get_env() or directory parsing\n├── account.hcl           # Account-level config (optional)\n├── region.hcl            # Region-level config (optional)\n└── vpc\u002F\n    └── terragrunt.hcl\n```\n\n**Root.hcl can detect environment:**\n```hcl\n# root.hcl - environment detection via directory path\nlocals {\n  # Parse environment from path (e.g., \"prod\u002Fvpc\" -> \"prod\")\n  path_parts  = split(\"\u002F\", path_relative_to_include())\n  environment = local.path_parts[0]\n\n  # OR use environment variable\n  environment = get_env(\"TG_ENVIRONMENT\", \"dev\")\n}\n```\n\n### Pattern C: Shared Environment Variables (_env directory)\n\n**Use when:** Centralizing environment variables with symlinks or direct references.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC\n├── _env\u002F                 # Centralized environment definitions\n│   ├── prod.hcl\n│   ├── staging.hcl\n│   └── dev.hcl\n├── prod\u002F\n│   ├── env.hcl           # Reads from _env\u002Fprod.hcl\n│   └── vpc\u002Fterragrunt.hcl\n└── dev\u002F\n    ├── env.hcl           # Reads from _env\u002Fdev.hcl\n    └── vpc\u002Fterragrunt.hcl\n```\n\n**env.hcl reads from _env:**\n```hcl\n# prod\u002Fenv.hcl\nlocals {\n  env_vars = read_terragrunt_config(\"${get_repo_root()}\u002F_env\u002Fprod.hcl\")\n\n  # Re-export for child modules\n  environment        = local.env_vars.locals.environment\n  aws_region         = local.env_vars.locals.aws_region\n  vpc_cidr           = local.env_vars.locals.vpc_cidr\n  # ... other variables\n}\n```\n\n### Architecture Pattern Selection Checklist (Canonical)\n\n> **MANDATORY:** Before writing any files, you MUST complete this checklist and OUTPUT it to the user with checkmarks filled in. This is not optional.\n\n**Output this completed checklist before generating any files:**\n```\n## Architecture Pattern Selection\n\n[x] Identified architecture pattern: Pattern ___ (A\u002FB\u002FC)\n[x] Root.hcl scope: [ ] environment-agnostic  OR  [ ] environment-aware\n[x] env.hcl location: ___________________\n[x] Child modules access env via: ___________________\n[x] Verified: No file references a path that doesn't exist from its location\n```\n\n**Example completed checklist:**\n```\n## Architecture Pattern Selection\n\n[x] Identified architecture pattern: Pattern A (Multi-Environment with Environment-Agnostic Root)\n[x] Root.hcl scope: [x] environment-agnostic  OR  [ ] environment-aware\n[x] env.hcl location: dev\u002Fenv.hcl, prod\u002Fenv.hcl (one per environment)\n[x] Child modules access env via: read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n[x] Verified: No file references a path that doesn't exist from its location\n```\n\n## Quick Variable Definition Examples\n\nUse these starter files for Pattern B and account\u002Fregion-aware setups.\n\n**env.hcl**\n```hcl\nlocals {\n  environment = \"dev\"\n  aws_region  = \"us-east-1\"\n  project     = \"platform\"\n}\n```\n\n**account.hcl**\n```hcl\nlocals {\n  account_id   = \"123456789012\"\n  account_name = \"shared-services\"\n}\n```\n\n**region.hcl**\n```hcl\nlocals {\n  aws_region = \"us-east-1\"\n}\n```\n\n## When to Use\n\n- Creating new Terragrunt projects or configurations\n- Setting up multi-environment infrastructure (dev\u002Fstaging\u002Fprod)\n- Implementing DRY Terraform configurations\n- Managing complex infrastructure with dependencies\n- Working with custom Terraform providers or modules\n\n## Core Capabilities\n\n### 1. Generate Root Configuration\nCreate root-level `root.hcl` or `terragrunt.hcl` with remote state, provider config, and common variables.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Root Configuration Patterns\n\n**Key placeholders to replace:**\n- `[BUCKET_NAME]`, `[AWS_REGION]`, `[DYNAMODB_TABLE]`\n- `[TERRAFORM_VERSION]`, `[PROVIDER_NAME]`, `[PROVIDER_SOURCE]`, `[PROVIDER_VERSION]`\n- `[ENVIRONMENT]`, `[PROJECT_NAME]`\n\n**Root.hcl Design Principles:**\n1. **Environment-agnostic by default** - Don't assume env.hcl exists at root level\n2. **Use static values for provider\u002Fbackend region** - Or use `get_env()` for runtime config\n3. **State key uses `path_relative_to_include()`** - This automatically includes environment path\n4. **Provider tags can be static** - Environment-specific tags go in child modules\n\n### 2. Generate Child Module Configuration\nCreate child modules with dependencies, mock outputs, and proper includes.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Child Module Patterns\n\n**Module source options:**\n- Local: `\"..\u002F..\u002Fmodules\u002Fvpc\"`\n- Git: `\"git::https:\u002F\u002Fgithub.com\u002Forg\u002Frepo.git\u002F\u002Fpath?ref=v1.0.0\"`\n- Registry: `\"tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws?version=5.1.0\"`\n\n### 3. Generate Standalone Module\nSelf-contained modules without root dependency.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl`\n\n### Canonical Placeholder Replacement Map\n\nUse this map for every generated output:\n\n| Placeholder | Meaning | Example Replacement | Notes |\n|-------------|---------|---------------------|-------|\n| `[AWS_REGION]` | AWS region | `us-east-1` | Canonical region placeholder in all templates |\n| `[ENVIRONMENT]` | Environment name | `dev` | Keep lowercase for directory naming |\n| `[PROJECT_NAME]` | Project\u002Fapplication name | `payments-platform` | Use the same value in tags and names |\n| `[BUCKET_NAME]` | Remote state S3 bucket | `acme-tfstate-prod` | Bucket must exist before first apply |\n| `[DYNAMODB_TABLE]` | State lock table | `acme-terraform-locks` | Table must exist before first apply |\n| `[PROVIDER_SOURCE]` | Terraform provider source | `hashicorp\u002Faws` | Use fully qualified source |\n| `[TERRAFORM_VERSION]` | Required Terraform\u002FOpenTofu version | `1.8.5` | Used in both `terraform_version_constraint` and `required_version`. Keep compatible with module constraints. |\n\n**Legacy alias normalization:** If you see `[REGION]` in older examples, treat it as `[AWS_REGION]` and replace it before validation.\n\n### 4. Generate Multi-Environment Infrastructure\nComplete directory structures for dev\u002Fstaging\u002Fprod.\n\n> **MANDATORY:** Before generating:\n> 1. Determine architecture pattern (see Architecture Patterns section)\n> 2. Read relevant templates for root, env, and child modules\n> 3. Verify env.hcl placement and access patterns:\n>    ```\n>    Read: assets\u002Ftemplates\u002Fenv\u002Fenv.hcl\n>    ```\n\n**Patterns:** `references\u002Fcommon-patterns.md` → Environment-Specific Patterns\n\n**Typical structure (Pattern A - Environment-Agnostic Root):**\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC root config\n├── dev\u002F\n│   ├── env.hcl           # Dev environment variables\n│   └── vpc\u002Fterragrunt.hcl\n└── prod\u002F\n    ├── env.hcl           # Prod environment variables\n    └── vpc\u002Fterragrunt.hcl\n```\n\n### 5. Generate Terragrunt Stacks (2025)\nInfrastructure blueprints using `terragrunt.stack.hcl`.\n\n> **MANDATORY:** Before generating, READ the template files:\n> ```\n> Read: assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl\n> Read: assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl\n> ```\n\n**Docs:** [Stacks Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F)\n**Template:** `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl`\n**Catalog Template:** `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Stacks Patterns\n\n**Stack path rule:** Keep `no_dot_terragrunt_stack` mode consistent across dependent units. Do not mix direct-path and `.terragrunt-stack` generation in the same dependency chain.\n\n**Commands:**\n```bash\nterragrunt stack generate    # Generate unit configurations\nterragrunt stack run plan    # Plan all units\nterragrunt stack run apply   # Apply all units\nterragrunt stack output      # Get aggregated outputs\nterragrunt stack clean       # Clean generated directories\n```\n\n### 6. Generate Feature Flags (2025)\nRuntime control without code changes.\n\n**Docs:** [Feature Flags Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F)\n**Patterns:** `references\u002Fcommon-patterns.md` → Feature Flags Patterns\n\n> **CRITICAL:** Feature flag `default` values MUST be static (boolean, string, number).\n> They CANNOT reference `local.*` values. Use static defaults and override via CLI\u002Fenv vars.\n\n**Correct:**\n```hcl\nfeature \"enable_monitoring\" {\n  default = false  # Static value - OK\n}\n```\n\n**Incorrect:**\n```hcl\nfeature \"enable_monitoring\" {\n  default = local.env.locals.enable_monitoring  # Dynamic reference - FAILS\n}\n```\n\n**Usage:**\n```bash\nterragrunt apply --feature enable_monitoring=true\n# or\nexport TG_FEATURE=\"enable_monitoring=true\"\n```\n\n**Environment-specific defaults:** Use different static defaults per environment file, not dynamic references.\n\n### 7. Generate Exclude Blocks (2025)\nFine-grained execution control (replaces deprecated `skip`).\n\n**Docs:** [Exclude Block Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude)\n**Patterns:** `references\u002Fcommon-patterns.md` → Exclude Block Patterns\n\n**Actions:** `\"plan\"`, `\"apply\"`, `\"destroy\"`, `\"all\"`, `\"all_except_output\"`\n\n**Production Recommendation:** For critical production resources, add exclude blocks to prevent accidental destruction:\n```hcl\n# Protect production databases from accidental destroy\nexclude {\n  if      = true\n  actions = [\"destroy\"]\n  exclude_dependencies = false\n}\n\n# Also use prevent_destroy for critical resources\nprevent_destroy = true\n```\n\n### 8. Generate Errors Blocks (2025)\nAdvanced error handling (replaces deprecated `retryable_errors`).\n\n**Docs:** [Errors Block Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors)\n**Patterns:** `references\u002Fcommon-patterns.md` → Errors Block Patterns\n\n### 9. Generate OpenTofu Engine Configuration (2025)\nUse OpenTofu as the IaC engine.\n\n**Docs:** [Engine Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F)\n**Patterns:** `references\u002Fcommon-patterns.md` → OpenTofu Engine Patterns\n\n### 10. Handling Custom Providers\u002FModules\nWhen generating configs with custom providers:\n\n1. **Identify** the provider name, source, and version\n2. **Search** using WebSearch: `\"[provider] terraform provider [version] documentation\"`\n3. **Or use Context7 MCP** if available for structured docs\n4. **Generate** with proper `required_providers` block\n5. **Document** authentication requirements in comments\n\n## Generation Workflow\n\n> **CRITICAL:** Follow this workflow for EVERY generation task. Skipping steps leads to validation errors.\n\n### Step 1: Understand Requirements\n- What type of configuration? (root, child, standalone, stack)\n- Single or multi-environment?\n- What dependencies exist between modules?\n- What providers\u002Fmodules will be used?\n\n### Step 2: Determine Architecture Pattern\n> **MANDATORY:** Select and document the pattern BEFORE writing any files.\n\n| Scenario | Pattern | Root.hcl Scope |\n|----------|---------|----------------|\n| Multi-env with shared root | Pattern A | Environment-agnostic |\n| Single environment | Pattern B | Environment-aware |\n| Centralized env vars | Pattern C | Environment-agnostic |\n\nComplete the **Architecture Pattern Selection Checklist (Canonical)** above and include it in output before file generation.\n\n### Step 3: Read Required Templates\n> **MANDATORY:** Read the relevant template file(s) BEFORE generating each configuration type.\n\n| Configuration Type | Template to Read | Purpose |\n|-------------------|------------------|---------|\n| Root configuration | `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl` | Shared state backend, providers, and common inputs |\n| Environment variables | `assets\u002Ftemplates\u002Fenv\u002Fenv.hcl` | Per-environment locals read by child modules (Pattern A) |\n| Child module | `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl` | Environment module wired to root include |\n| Standalone module | `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl` | Independent Terragrunt module without root include |\n| Stack file | `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl` | Blueprint that generates multiple units |\n| Catalog unit | `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl` | Reusable unit template consumed by stacks |\n\n**Also read:**\n- `references\u002Fcommon-patterns.md` - Primary source for generation patterns\n\n### Step 4: Generate with Validation\n\n> **Validation Strategy:** Use a combination of inline checks during generation and batch validation at the end.\n\n**Generation order for multi-environment projects:**\n\n1. **Generate root.hcl first**\n   - **Inline checks (during generation):**\n     - [ ] No `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` if environment-agnostic\n     - [ ] `remote_state` block has `encrypt = true`\n     - [ ] `errors` block used (not deprecated `retryable_errors`)\n\n2. **Generate env.hcl files for each environment**\n   - **Inline checks (during generation):**\n     - [ ] `locals` block contains environment, aws_region, and module-specific vars\n     - [ ] No references to files that don't exist at that directory level\n\n3. **Generate child modules (VPC, etc.) - modules with NO dependencies first**\n   - **Inline checks (during generation):**\n     - [ ] `include` block uses `find_in_parent_folders(\"root.hcl\")`\n     - [ ] `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` present\n     - [ ] `terraform.source` uses valid syntax (`tfr:\u002F\u002F\u002F`, `git::`, or relative path)\n\n4. **Generate dependent modules (RDS, EKS, etc.)**\n   - **Inline checks (during generation):**\n     - [ ] `dependency` blocks have `mock_outputs`\n     - [ ] `mock_outputs_allowed_terraform_commands` includes `[\"validate\", \"plan\", \"destroy\"]`\n     - [ ] Production modules have `prevent_destroy = true` and\u002For `exclude` block\n\n5. **Run batch validation after ALL files are generated**\n   > **Note:** Full CLI validation (`terragrunt hcl fmt`, `terragrunt dag graph`) requires all files to exist, so these are batched at the end.\n\n   ```bash\n   # Batch validation commands (run after all files exist):\n   terragrunt hcl fmt --check          # Format validation\n   terragrunt dag graph                 # Dependency graph validation\n   ```\n\n   - Invoke `Skill(devops-skills:terragrunt-validator)` for comprehensive validation\n\n### Step 5: Fix and Re-Validate\nIf validation fails:\n1. Analyze errors (path resolution, missing variables, syntax errors)\n2. Fix issues in the specific file(s)\n3. Re-validate the fixed file(s)\n4. Repeat until ALL errors are resolved\n\n### Step 6: Present Results\nFollow \"Presentation Requirements\" section below.\n\n## Validation Workflow\n\n**CRITICAL:** Every generated configuration MUST be validated.\n\n### Incremental Validation Checks\n\n**After generating root.hcl:**\n```bash\ncd \u003Cinfrastructure-directory>\nterragrunt hcl fmt --check\n```\n\n**After generating each child module:**\n```bash\ncd \u003Cmodule-directory>\nterragrunt hcl fmt --check\n# If no dependencies on other modules:\nterragrunt hcl validate --inputs\n```\n\n### Full Validation\n\nAfter all files are generated:\n\n1. **Invoke validation skill:**\n   ```\n   Invoke: Skill(devops-skills:terragrunt-validator)\n   ```\n\n2. **If validation fails:**\n   - Analyze errors (missing placeholders, invalid syntax, wrong paths)\n   - Fix issues\n   - **Re-validate** (repeat until ALL errors are resolved)\n\n3. **If validation succeeds:** Present configurations with usage instructions\n\n**Skip validation only for:** Partial snippets, documentation examples, or explicit user request\n\n### Validation Fallbacks (Environment Constraints)\n\nIf the normal validation path is unavailable, use this fallback order and report what was skipped:\n\n1. If `terragrunt` is unavailable:\n   - Run static checks:\n     ```bash\n     rg -n \"\\[[A-Z0-9_]+\\]\" .\n     rg -n \"find_in_parent_folders\\\\(\\\"env\\\\.hcl\\\"\\\\)\" .\n     ```\n   - Report that runtime Terragrunt validation is pending.\n2. If validator skill execution is unavailable:\n   - Run direct Terragrunt checks instead:\n     ```bash\n     terragrunt hcl fmt --check\n     terragrunt dag graph\n     ```\n3. If `tree` is unavailable for presentation:\n   - Use:\n     ```bash\n     find . -maxdepth 4 -type f | sort\n     ```\n\n## Presentation Requirements\n\n> **MANDATORY:** After successful validation, you MUST present ALL of the following sections. Incomplete presentation is not acceptable. Copy and fill in the templates below.\n\n### 1. Directory Structure Summary (MANDATORY)\n```bash\n# Show the generated structure\ntree \u003Cinfrastructure-directory>\n```\n\n### 2. Files Generated (MANDATORY)\n\n**Output this table with all generated files:**\n```markdown\n| File | Purpose |\n|------|---------|\n| root.hcl | Shared configuration for all child modules (state backend, provider) |\n| dev\u002Fenv.hcl | Development environment variables |\n| prod\u002Fenv.hcl | Production environment variables |\n| dev\u002Fvpc\u002Fterragrunt.hcl | VPC module for development |\n| ... | ... |\n```\n\n### 3. Usage Instructions (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Usage Instructions\n\n### Prerequisites\nBefore running Terragrunt commands, ensure:\n1. AWS credentials are configured (`aws configure` or environment variables)\n2. S3 bucket `\u003CBUCKET_NAME>` exists for state storage\n3. DynamoDB table `\u003CTABLE_NAME>` exists for state locking\n\n### Commands\n\n# Navigate to infrastructure directory\ncd \u003CINFRASTRUCTURE_DIR>\n\n# Initialize all modules\nterragrunt run --all init\n\n# Preview changes for a specific environment\ncd \u003CENV>\u002Fvpc && terragrunt plan\n\n# Preview all changes\nterragrunt run --all plan\n\n# Apply changes (requires approval)\nterragrunt run --all apply\n\n# Destroy (use with extreme caution)\nterragrunt run --all destroy\n```\n\n### 4. Placeholder Replacement and Secrets Check (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Placeholder and Secrets Check\n\n### Placeholder Replacement\n- [ ] All placeholders (`[AWS_REGION]`, `[BUCKET_NAME]`, `[DYNAMODB_TABLE]`, etc.) replaced with real values\n- [ ] No legacy placeholder aliases left (for example `[REGION]`)\n- [ ] `terraform.source` values point to real module sources and pinned versions\n\n### Secrets Safety\n- [ ] No plaintext credentials or access keys in `terragrunt.hcl`, `root.hcl`, `env.hcl`, `account.hcl`, or `region.hcl`\n- [ ] Sensitive values sourced via environment variables, secret managers, or CI variables\n- [ ] Example values kept non-sensitive and clearly marked as placeholders\n```\n\n### 5. Environment-Specific Notes (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Environment Notes\n\n### Required Environment Variables\n| Variable | Description | Example |\n|----------|-------------|---------|\n| AWS_PROFILE | AWS CLI profile to use | `my-profile` |\n| AWS_REGION | AWS region (or set in provider) | `us-east-1` |\n\n### Prerequisites\n- [ ] S3 bucket `\u003CBUCKET_NAME>` must exist before first run\n- [ ] DynamoDB table `\u003CTABLE_NAME>` must exist for state locking\n- [ ] IAM permissions for Terraform state management\n\n### Production-Specific Protections\n| Module | Protection | Description |\n|--------|------------|-------------|\n| prod\u002Frds | `prevent_destroy = true` | Prevents accidental database deletion |\n| prod\u002Frds | `exclude { actions = [\"destroy\"] }` | Blocks destroy commands |\n```\n\n### 6. Next Steps (Optional)\nSuggest what the user might want to do next (add more modules, customize configurations, etc.)\n\n## Best Practices\n\nReference `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` for comprehensive guidelines.\n\n**Key principles:**\n- Use `include` blocks to inherit root configuration (DRY)\n- Always provide mock outputs for dependencies\n- Enable state encryption (`encrypt = true`)\n- Use `generate` blocks for provider configuration\n- Specify bounded version constraints (`~> 5.0`, not `>= 5.0`) for local\u002FGit modules\n- Never hardcode credentials or secrets\n- Configure retry logic for transient errors\n\n> **Note on Version Constraints with Registry Modules:** When using Terraform Registry modules (e.g., `tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws?version=5.1.0`), they typically define their own `required_providers`. In this case, you may omit generating `required_providers` in `root.hcl` to avoid conflicts. The module's pinned version (`?version=X.X.X`) provides the version constraint. See \"Common Issues → Provider Conflict with Registry Modules\" for details.\n\n**Anti-patterns to avoid:**\n- Hardcoded account IDs, regions, or environment names\n- Missing mock outputs for dependencies\n- Duplicated configuration across modules\n- Unencrypted state storage\n- Missing or loose version constraints (except when using registry modules that define their own)\n- Root.hcl trying to read env.hcl that doesn't exist at root level\n\n## Deprecated Attributes\n\n| Deprecated | Replacement | Reference |\n|------------|-------------|-----------|\n| `skip` | `exclude` block | [Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude) |\n| `retryable_errors` | `errors.retry` block | [Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors) |\n| `run-all` | `run --all` | [Migration](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002Fmigrating-from-run-all\u002F) |\n| `--terragrunt-*` flags | Unprefixed flags | [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F) |\n| `TERRAGRUNT_*` env vars | `TG_*` env vars | [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F) |\n\n## Resources\n\n### Templates - MUST Read Before Generating\n\n| Configuration Type | Template File | Purpose | When to Read |\n|-------------------|---------------|---------|--------------|\n| Root configuration | `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl` | Shared backend, provider, and common inputs | Before generating any root.hcl |\n| Environment variables | `assets\u002Ftemplates\u002Fenv\u002Fenv.hcl` | Per-environment locals (environment, region, sizing, feature toggles) | Before generating any env.hcl (Pattern A) |\n| Child module | `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl` | Module include, source, and optional dependency scaffolding | Before generating any child module |\n| Standalone module | `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl` | Module config without root inheritance | Before generating standalone modules |\n| Stack file | `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl` | Stack blueprint and unit generation | Before generating stacks |\n| Catalog unit | `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl` | Reusable unit consumed by stack definitions | Before generating catalog units |\n\n### References\n\n| Reference | Content | Purpose | When to Read |\n|-----------|---------|---------|--------------|\n| `references\u002Fcommon-patterns.md` | All generation patterns with examples | Pick a compatible pattern before writing files | Always, before generating |\n| `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` | Comprehensive best practices | Final quality and safety checks | Always, before generating |\n\n### Official Documentation\n- [Terragrunt Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002F)\n- [Configuration Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F)\n- [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F)\n- [Stacks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F)\n- [Feature Flags](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F)\n- [Engine](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F)\n- [Migration Guides](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002F)\n\n## Common Issues\n\n### Root.hcl Cannot Find env.hcl\n\n**Symptom:**\n```\nError: Attempt to get attribute from null value\n  on .\u002Froot.hcl line X:\n  This value is null, so it does not have any attributes.\n```\n\n**Cause:** Root.hcl is trying to read `env.hcl` via `find_in_parent_folders(\"env.hcl\")`, but env.hcl doesn't exist at the root level.\n\n**Solution:** Make root.hcl environment-agnostic:\n```hcl\n# DON'T do this in root.hcl for multi-environment setups:\nlocals {\n  env_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))  # FAILS\n}\n\n# DO use static values or get_env():\ngenerate \"provider\" {\n  path      = \"provider.tf\"\n  if_exists = \"overwrite_terragrunt\"\n  contents  = \u003C\u003CEOF\nprovider \"aws\" {\n  region = \"us-east-1\"  # Static value, or use get_env(\"AWS_REGION\", \"us-east-1\")\n}\nEOF\n}\n```\n\n### Provider Conflict with Registry Modules\n\nWhen using Terraform Registry modules (e.g., `tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws`), they may define their own `required_providers` block. This can conflict with provider configuration generated by `root.hcl`.\n\n**Symptoms:**\n```\nError: Duplicate required providers configuration\n```\n\n**Solutions:**\n1. **Remove conflicting generate block** - If using registry modules that manage their own providers, avoid generating duplicate `required_providers`:\n   ```hcl\n   # In root.hcl - only generate provider config, not required_providers\n   generate \"provider\" {\n     path      = \"provider.tf\"\n     if_exists = \"overwrite_terragrunt\"\n     contents  = \u003C\u003CEOF\n   provider \"aws\" {\n     region = \"us-east-1\"\n   }\n   EOF\n   }\n   ```\n\n2. **Use if_exists = \"skip\"** - Skip generation if file already exists:\n   ```hcl\n   generate \"versions\" {\n     path      = \"versions.tf\"\n     if_exists = \"skip\"  # Don't overwrite module's versions.tf\n     contents  = \"...\"\n   }\n   ```\n\n3. **Clear cache** - If conflicts persist after fixes:\n   ```bash\n   rm -rf .terragrunt-cache\n   terragrunt init\n   ```\n\n### Feature Flag Validation Errors\n\nIf you see `Unknown variable; There is no variable named \"local\"` in feature blocks, ensure defaults are static values (see Feature Flags section above).\n\n### Child Module Cannot Find env.hcl\n\n**Symptom:**\n```\nError: Attempt to get attribute from null value\n  on .\u002Fdev\u002Fvpc\u002Fterragrunt.hcl line X:\n```\n\n**Cause:** Child module's `find_in_parent_folders(\"env.hcl\")` cannot find env.hcl.\n\n**Solution:** Ensure env.hcl exists in the environment directory:\n```\ndev\u002F\n├── env.hcl           # This file MUST exist\n└── vpc\u002F\n    └── terragrunt.hcl  # Calls find_in_parent_folders(\"env.hcl\")\n```\n\n## Quick Reference Card\n\n### File Reading Checklist\n\nBefore generating, READ these files in order:\n\n1. [ ] `references\u002Fcommon-patterns.md` - Understand available patterns\n2. [ ] `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` - Know the rules\n3. [ ] Relevant template(s) from `assets\u002Ftemplates\u002F` - Structural reference\n\n### Architecture Decision Tree\n\n```\nQ: Multiple environments (dev\u002Fstaging\u002Fprod)?\n├─ YES → Q: Shared root configuration?\n│   ├─ YES → Pattern A: Environment-Agnostic Root\n│   └─ NO  → Separate root.hcl per environment\n└─ NO  → Q: Environment detection needed?\n    ├─ YES → Pattern B: Environment-Aware Root\n    └─ NO  → Pattern B: Simple single-environment\n```\n\n### Validation Sequence\n\n1. Format check: `terragrunt hcl fmt --check`\n2. Input validation: `terragrunt hcl validate --inputs`\n3. Full validation: Invoke `Skill(devops-skills:terragrunt-validator)`\n4. Fix errors → Re-validate → Repeat until clean\n\n## Done Criteria\n\nThis skill execution is complete only when ALL are true:\n\n- One architecture checklist is completed and shown (the canonical checklist in this file)\n- Generated files consistently use modern root include syntax unless legacy was explicitly requested\n- Registry sources use canonical `tfr:\u002F\u002F\u002FNAMESPACE\u002FNAME\u002FPROVIDER?version=X.Y.Z` format\n- Dependency blocks are added only where actually needed (not left as unresolved placeholders)\n- All placeholders are replaced and secrets checks are reported in output\n- Validation succeeded, or fallback checks ran with explicit limitations documented\n","# Terragrunt Generator\n\n## Overview\n\nGenerate production-ready Terragrunt configurations following current best practices, naming conventions, and security standards. All generated configurations are automatically validated.\n\n## Trigger Phrases\n\nUse this skill when the user asks for:\n- A new `root.hcl`, `terragrunt.hcl`, or `terragrunt.stack.hcl`\n- Multi-environment Terragrunt layouts (`dev\u002Fstaging\u002Fprod`)\n- Terragrunt dependency wiring (`dependency` or `dependencies` blocks)\n- Terragrunt module source setup (local, Git, Terraform Registry via `tfr:\u002F\u002F\u002F`)\n- Stack catalog unit generation under `catalog\u002Funits\u002F*`\n\n**Terragrunt 2025 Features Supported:**\n- [Stacks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F) - Infrastructure blueprints with `terragrunt.stack.hcl` (GA since v0.78.0)\n- [Feature Flags](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F) - Runtime control via `feature` blocks\n- [Exclude Blocks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude) - Fine-grained execution control (replaces deprecated `skip`)\n- [Errors Blocks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors) - Advanced error handling (replaces deprecated `retryable_errors`)\n- [OpenTofu Engine](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F) - Alternative IaC engine support\n\n## Root Configuration Naming\n\n> **RECOMMENDED**: Use `root.hcl` instead of `terragrunt.hcl` for root files per [migration guide](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002Fmigrating-from-root-terragrunt-hcl).\n\n| Approach | Root File | Include Syntax |\n|----------|-----------|----------------|\n| **Modern** | `root.hcl` | `find_in_parent_folders(\"root.hcl\")` |\n| **Legacy** | `terragrunt.hcl` | `find_in_parent_folders()` |\n\n**Include standard:** Default to `find_in_parent_folders(\"root.hcl\")` in all new examples and generated configs. Use `find_in_parent_folders()` only when explicitly targeting a legacy root file named `terragrunt.hcl`.\n\n## Architecture Patterns\n\n> **CRITICAL:** Before generating ANY configuration, you MUST determine the architecture pattern and understand its constraints.\n\n### Pattern A: Multi-Environment with Environment-Agnostic Root\n\n**Use when:** Managing multiple environments (dev\u002Fstaging\u002Fprod) with shared root configuration.\n\n**Key principle:** `root.hcl` is **environment-agnostic** - it does NOT read environment-specific files.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC (no env.hcl references)\n├── dev\u002F\n│   ├── env.hcl           # Environment variables (locals block)\n│   ├── vpc\u002Fterragrunt.hcl\n│   └── rds\u002Fterragrunt.hcl\n└── prod\u002F\n    ├── env.hcl           # Environment variables (locals block)\n    ├── vpc\u002Fterragrunt.hcl\n    └── rds\u002Fterragrunt.hcl\n```\n\n**Root.hcl constraints:**\n- ❌ CANNOT use `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` - env.hcl doesn't exist at root level\n- ❌ CANNOT reference `local.environment` or `local.aws_region` that come from env.hcl\n- ✅ CAN use static values or `get_env()` for runtime configuration\n- ✅ CAN use `${path_relative_to_include()}` for state keys (this works dynamically)\n\n**Child modules read env.hcl:**\n```hcl\n# dev\u002Fvpc\u002Fterragrunt.hcl\ninclude \"root\" {\n  path = find_in_parent_folders(\"root.hcl\")\n}\n\nlocals {\n  env = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n}\n\ninputs = {\n  name = \"${local.env.locals.environment}-vpc\"  # Works: env.hcl exists in dev\u002F\n}\n```\n\n### Pattern B: Single Environment or Environment-Aware Root\n\n**Use when:** Single environment OR all environments share the same root with environment detection.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Can be environment-aware via get_env() or directory parsing\n├── account.hcl           # Account-level config (optional)\n├── region.hcl            # Region-level config (optional)\n└── vpc\u002F\n    └── terragrunt.hcl\n```\n\n**Root.hcl can detect environment:**\n```hcl\n# root.hcl - environment detection via directory path\nlocals {\n  # Parse environment from path (e.g., \"prod\u002Fvpc\" -> \"prod\")\n  path_parts  = split(\"\u002F\", path_relative_to_include())\n  environment = local.path_parts[0]\n\n  # OR use environment variable\n  environment = get_env(\"TG_ENVIRONMENT\", \"dev\")\n}\n```\n\n### Pattern C: Shared Environment Variables (_env directory)\n\n**Use when:** Centralizing environment variables with symlinks or direct references.\n\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC\n├── _env\u002F                 # Centralized environment definitions\n│   ├── prod.hcl\n│   ├── staging.hcl\n│   └── dev.hcl\n├── prod\u002F\n│   ├── env.hcl           # Reads from _env\u002Fprod.hcl\n│   └── vpc\u002Fterragrunt.hcl\n└── dev\u002F\n    ├── env.hcl           # Reads from _env\u002Fdev.hcl\n    └── vpc\u002Fterragrunt.hcl\n```\n\n**env.hcl reads from _env:**\n```hcl\n# prod\u002Fenv.hcl\nlocals {\n  env_vars = read_terragrunt_config(\"${get_repo_root()}\u002F_env\u002Fprod.hcl\")\n\n  # Re-export for child modules\n  environment        = local.env_vars.locals.environment\n  aws_region         = local.env_vars.locals.aws_region\n  vpc_cidr           = local.env_vars.locals.vpc_cidr\n  # ... other variables\n}\n```\n\n### Architecture Pattern Selection Checklist (Canonical)\n\n> **MANDATORY:** Before writing any files, you MUST complete this checklist and OUTPUT it to the user with checkmarks filled in. This is not optional.\n\n**Output this completed checklist before generating any files:**\n```\n## Architecture Pattern Selection\n\n[x] Identified architecture pattern: Pattern ___ (A\u002FB\u002FC)\n[x] Root.hcl scope: [ ] environment-agnostic  OR  [ ] environment-aware\n[x] env.hcl location: ___________________\n[x] Child modules access env via: ___________________\n[x] Verified: No file references a path that doesn't exist from its location\n```\n\n**Example completed checklist:**\n```\n## Architecture Pattern Selection\n\n[x] Identified architecture pattern: Pattern A (Multi-Environment with Environment-Agnostic Root)\n[x] Root.hcl scope: [x] environment-agnostic  OR  [ ] environment-aware\n[x] env.hcl location: dev\u002Fenv.hcl, prod\u002Fenv.hcl (one per environment)\n[x] Child modules access env via: read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n[x] Verified: No file references a path that doesn't exist from its location\n```\n\n## Quick Variable Definition Examples\n\nUse these starter files for Pattern B and account\u002Fregion-aware setups.\n\n**env.hcl**\n```hcl\nlocals {\n  environment = \"dev\"\n  aws_region  = \"us-east-1\"\n  project     = \"platform\"\n}\n```\n\n**account.hcl**\n```hcl\nlocals {\n  account_id   = \"123456789012\"\n  account_name = \"shared-services\"\n}\n```\n\n**region.hcl**\n```hcl\nlocals {\n  aws_region = \"us-east-1\"\n}\n```\n\n## When to Use\n\n- Creating new Terragrunt projects or configurations\n- Setting up multi-environment infrastructure (dev\u002Fstaging\u002Fprod)\n- Implementing DRY Terraform configurations\n- Managing complex infrastructure with dependencies\n- Working with custom Terraform providers or modules\n\n## Core Capabilities\n\n### 1. Generate Root Configuration\nCreate root-level `root.hcl` or `terragrunt.hcl` with remote state, provider config, and common variables.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Root Configuration Patterns\n\n**Key placeholders to replace:**\n- `[BUCKET_NAME]`, `[AWS_REGION]`, `[DYNAMODB_TABLE]`\n- `[TERRAFORM_VERSION]`, `[PROVIDER_NAME]`, `[PROVIDER_SOURCE]`, `[PROVIDER_VERSION]`\n- `[ENVIRONMENT]`, `[PROJECT_NAME]`\n\n**Root.hcl Design Principles:**\n1. **Environment-agnostic by default** - Don't assume env.hcl exists at root level\n2. **Use static values for provider\u002Fbackend region** - Or use `get_env()` for runtime config\n3. **State key uses `path_relative_to_include()`** - This automatically includes environment path\n4. **Provider tags can be static** - Environment-specific tags go in child modules\n\n### 2. Generate Child Module Configuration\nCreate child modules with dependencies, mock outputs, and proper includes.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Child Module Patterns\n\n**Module source options:**\n- Local: `\"..\u002F..\u002Fmodules\u002Fvpc\"`\n- Git: `\"git::https:\u002F\u002Fgithub.com\u002Forg\u002Frepo.git\u002F\u002Fpath?ref=v1.0.0\"`\n- Registry: `\"tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws?version=5.1.0\"`\n\n### 3. Generate Standalone Module\nSelf-contained modules without root dependency.\n\n> **MANDATORY:** Before generating, READ the template file:\n> ```\n> Read: assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl\n> ```\n\n**Template:** `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl`\n\n### Canonical Placeholder Replacement Map\n\nUse this map for every generated output:\n\n| Placeholder | Meaning | Example Replacement | Notes |\n|-------------|---------|---------------------|-------|\n| `[AWS_REGION]` | AWS region | `us-east-1` | Canonical region placeholder in all templates |\n| `[ENVIRONMENT]` | Environment name | `dev` | Keep lowercase for directory naming |\n| `[PROJECT_NAME]` | Project\u002Fapplication name | `payments-platform` | Use the same value in tags and names |\n| `[BUCKET_NAME]` | Remote state S3 bucket | `acme-tfstate-prod` | Bucket must exist before first apply |\n| `[DYNAMODB_TABLE]` | State lock table | `acme-terraform-locks` | Table must exist before first apply |\n| `[PROVIDER_SOURCE]` | Terraform provider source | `hashicorp\u002Faws` | Use fully qualified source |\n| `[TERRAFORM_VERSION]` | Required Terraform\u002FOpenTofu version | `1.8.5` | Used in both `terraform_version_constraint` and `required_version`. Keep compatible with module constraints. |\n\n**Legacy alias normalization:** If you see `[REGION]` in older examples, treat it as `[AWS_REGION]` and replace it before validation.\n\n### 4. Generate Multi-Environment Infrastructure\nComplete directory structures for dev\u002Fstaging\u002Fprod.\n\n> **MANDATORY:** Before generating:\n> 1. Determine architecture pattern (see Architecture Patterns section)\n> 2. Read relevant templates for root, env, and child modules\n> 3. Verify env.hcl placement and access patterns:\n>    ```\n>    Read: assets\u002Ftemplates\u002Fenv\u002Fenv.hcl\n>    ```\n\n**Patterns:** `references\u002Fcommon-patterns.md` → Environment-Specific Patterns\n\n**Typical structure (Pattern A - Environment-Agnostic Root):**\n```\ninfrastructure\u002F\n├── root.hcl              # Environment-AGNOSTIC root config\n├── dev\u002F\n│   ├── env.hcl           # Dev environment variables\n│   └── vpc\u002Fterragrunt.hcl\n└── prod\u002F\n    ├── env.hcl           # Prod environment variables\n    └── vpc\u002Fterragrunt.hcl\n```\n\n### 5. Generate Terragrunt Stacks (2025)\nInfrastructure blueprints using `terragrunt.stack.hcl`.\n\n> **MANDATORY:** Before generating, READ the template files:\n> ```\n> Read: assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl\n> Read: assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl\n> ```\n\n**Docs:** [Stacks Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F)\n**Template:** `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl`\n**Catalog Template:** `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl`\n**Patterns:** `references\u002Fcommon-patterns.md` → Stacks Patterns\n\n**Stack path rule:** Keep `no_dot_terragrunt_stack` mode consistent across dependent units. Do not mix direct-path and `.terragrunt-stack` generation in the same dependency chain.\n\n**Commands:**\n```bash\nterragrunt stack generate    # Generate unit configurations\nterragrunt stack run plan    # Plan all units\nterragrunt stack run apply   # Apply all units\nterragrunt stack output      # Get aggregated outputs\nterragrunt stack clean       # Clean generated directories\n```\n\n### 6. Generate Feature Flags (2025)\nRuntime control without code changes.\n\n**Docs:** [Feature Flags Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F)\n**Patterns:** `references\u002Fcommon-patterns.md` → Feature Flags Patterns\n\n> **CRITICAL:** Feature flag `default` values MUST be static (boolean, string, number).\n> They CANNOT reference `local.*` values. Use static defaults and override via CLI\u002Fenv vars.\n\n**Correct:**\n```hcl\nfeature \"enable_monitoring\" {\n  default = false  # Static value - OK\n}\n```\n\n**Incorrect:**\n```hcl\nfeature \"enable_monitoring\" {\n  default = local.env.locals.enable_monitoring  # Dynamic reference - FAILS\n}\n```\n\n**Usage:**\n```bash\nterragrunt apply --feature enable_monitoring=true\n# or\nexport TG_FEATURE=\"enable_monitoring=true\"\n```\n\n**Environment-specific defaults:** Use different static defaults per environment file, not dynamic references.\n\n### 7. Generate Exclude Blocks (2025)\nFine-grained execution control (replaces deprecated `skip`).\n\n**Docs:** [Exclude Block Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude)\n**Patterns:** `references\u002Fcommon-patterns.md` → Exclude Block Patterns\n\n**Actions:** `\"plan\"`, `\"apply\"`, `\"destroy\"`, `\"all\"`, `\"all_except_output\"`\n\n**Production Recommendation:** For critical production resources, add exclude blocks to prevent accidental destruction:\n```hcl\n# Protect production databases from accidental destroy\nexclude {\n  if      = true\n  actions = [\"destroy\"]\n  exclude_dependencies = false\n}\n\n# Also use prevent_destroy for critical resources\nprevent_destroy = true\n```\n\n### 8. Generate Errors Blocks (2025)\nAdvanced error handling (replaces deprecated `retryable_errors`).\n\n**Docs:** [Errors Block Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors)\n**Patterns:** `references\u002Fcommon-patterns.md` → Errors Block Patterns\n\n### 9. Generate OpenTofu Engine Configuration (2025)\nUse OpenTofu as the IaC engine.\n\n**Docs:** [Engine Documentation](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F)\n**Patterns:** `references\u002Fcommon-patterns.md` → OpenTofu Engine Patterns\n\n### 10. Handling Custom Providers\u002FModules\nWhen generating configs with custom providers:\n\n1. **Identify** the provider name, source, and version\n2. **Search** using WebSearch: `\"[provider] terraform provider [version] documentation\"`\n3. **Or use Context7 MCP** if available for structured docs\n4. **Generate** with proper `required_providers` block\n5. **Document** authentication requirements in comments\n\n## Generation Workflow\n\n> **CRITICAL:** Follow this workflow for EVERY generation task. Skipping steps leads to validation errors.\n\n### Step 1: Understand Requirements\n- What type of configuration? (root, child, standalone, stack)\n- Single or multi-environment?\n- What dependencies exist between modules?\n- What providers\u002Fmodules will be used?\n\n### Step 2: Determine Architecture Pattern\n> **MANDATORY:** Select and document the pattern BEFORE writing any files.\n\n| Scenario | Pattern | Root.hcl Scope |\n|----------|---------|----------------|\n| Multi-env with shared root | Pattern A | Environment-agnostic |\n| Single environment | Pattern B | Environment-aware |\n| Centralized env vars | Pattern C | Environment-agnostic |\n\nComplete the **Architecture Pattern Selection Checklist (Canonical)** above and include it in output before file generation.\n\n### Step 3: Read Required Templates\n> **MANDATORY:** Read the relevant template file(s) BEFORE generating each configuration type.\n\n| Configuration Type | Template to Read | Purpose |\n|-------------------|------------------|---------|\n| Root configuration | `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl` | Shared state backend, providers, and common inputs |\n| Environment variables | `assets\u002Ftemplates\u002Fenv\u002Fenv.hcl` | Per-environment locals read by child modules (Pattern A) |\n| Child module | `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl` | Environment module wired to root include |\n| Standalone module | `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl` | Independent Terragrunt module without root include |\n| Stack file | `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl` | Blueprint that generates multiple units |\n| Catalog unit | `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl` | Reusable unit template consumed by stacks |\n\n**Also read:**\n- `references\u002Fcommon-patterns.md` - Primary source for generation patterns\n\n### Step 4: Generate with Validation\n\n> **Validation Strategy:** Use a combination of inline checks during generation and batch validation at the end.\n\n**Generation order for multi-environment projects:**\n\n1. **Generate root.hcl first**\n   - **Inline checks (during generation):**\n     - [ ] No `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` if environment-agnostic\n     - [ ] `remote_state` block has `encrypt = true`\n     - [ ] `errors` block used (not deprecated `retryable_errors`)\n\n2. **Generate env.hcl files for each environment**\n   - **Inline checks (during generation):**\n     - [ ] `locals` block contains environment, aws_region, and module-specific vars\n     - [ ] No references to files that don't exist at that directory level\n\n3. **Generate child modules (VPC, etc.) - modules with NO dependencies first**\n   - **Inline checks (during generation):**\n     - [ ] `include` block uses `find_in_parent_folders(\"root.hcl\")`\n     - [ ] `read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))` present\n     - [ ] `terraform.source` uses valid syntax (`tfr:\u002F\u002F\u002F`, `git::`, or relative path)\n\n4. **Generate dependent modules (RDS, EKS, etc.)**\n   - **Inline checks (during generation):**\n     - [ ] `dependency` blocks have `mock_outputs`\n     - [ ] `mock_outputs_allowed_terraform_commands` includes `[\"validate\", \"plan\", \"destroy\"]`\n     - [ ] Production modules have `prevent_destroy = true` and\u002For `exclude` block\n\n5. **Run batch validation after ALL files are generated**\n   > **Note:** Full CLI validation (`terragrunt hcl fmt`, `terragrunt dag graph`) requires all files to exist, so these are batched at the end.\n\n   ```bash\n   # Batch validation commands (run after all files exist):\n   terragrunt hcl fmt --check          # Format validation\n   terragrunt dag graph                 # Dependency graph validation\n   ```\n\n   - Invoke `Skill(devops-skills:terragrunt-validator)` for comprehensive validation\n\n### Step 5: Fix and Re-Validate\nIf validation fails:\n1. Analyze errors (path resolution, missing variables, syntax errors)\n2. Fix issues in the specific file(s)\n3. Re-validate the fixed file(s)\n4. Repeat until ALL errors are resolved\n\n### Step 6: Present Results\nFollow \"Presentation Requirements\" section below.\n\n## Validation Workflow\n\n**CRITICAL:** Every generated configuration MUST be validated.\n\n### Incremental Validation Checks\n\n**After generating root.hcl:**\n```bash\ncd \u003Cinfrastructure-directory>\nterragrunt hcl fmt --check\n```\n\n**After generating each child module:**\n```bash\ncd \u003Cmodule-directory>\nterragrunt hcl fmt --check\n# If no dependencies on other modules:\nterragrunt hcl validate --inputs\n```\n\n### Full Validation\n\nAfter all files are generated:\n\n1. **Invoke validation skill:**\n   ```\n   Invoke: Skill(devops-skills:terragrunt-validator)\n   ```\n\n2. **If validation fails:**\n   - Analyze errors (missing placeholders, invalid syntax, wrong paths)\n   - Fix issues\n   - **Re-validate** (repeat until ALL errors are resolved)\n\n3. **If validation succeeds:** Present configurations with usage instructions\n\n**Skip validation only for:** Partial snippets, documentation examples, or explicit user request\n\n### Validation Fallbacks (Environment Constraints)\n\nIf the normal validation path is unavailable, use this fallback order and report what was skipped:\n\n1. If `terragrunt` is unavailable:\n   - Run static checks:\n     ```bash\n     rg -n \"\\[[A-Z0-9_]+\\]\" .\n     rg -n \"find_in_parent_folders\\\\(\\\"env\\\\.hcl\\\"\\\\)\" .\n     ```\n   - Report that runtime Terragrunt validation is pending.\n2. If validator skill execution is unavailable:\n   - Run direct Terragrunt checks instead:\n     ```bash\n     terragrunt hcl fmt --check\n     terragrunt dag graph\n     ```\n3. If `tree` is unavailable for presentation:\n   - Use:\n     ```bash\n     find . -maxdepth 4 -type f | sort\n     ```\n\n## Presentation Requirements\n\n> **MANDATORY:** After successful validation, you MUST present ALL of the following sections. Incomplete presentation is not acceptable. Copy and fill in the templates below.\n\n### 1. Directory Structure Summary (MANDATORY)\n```bash\n# Show the generated structure\ntree \u003Cinfrastructure-directory>\n```\n\n### 2. Files Generated (MANDATORY)\n\n**Output this table with all generated files:**\n```markdown\n| File | Purpose |\n|------|---------|\n| root.hcl | Shared configuration for all child modules (state backend, provider) |\n| dev\u002Fenv.hcl | Development environment variables |\n| prod\u002Fenv.hcl | Production environment variables |\n| dev\u002Fvpc\u002Fterragrunt.hcl | VPC module for development |\n| ... | ... |\n```\n\n### 3. Usage Instructions (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Usage Instructions\n\n### Prerequisites\nBefore running Terragrunt commands, ensure:\n1. AWS credentials are configured (`aws configure` or environment variables)\n2. S3 bucket `\u003CBUCKET_NAME>` exists for state storage\n3. DynamoDB table `\u003CTABLE_NAME>` exists for state locking\n\n### Commands\n\n# Navigate to infrastructure directory\ncd \u003CINFRASTRUCTURE_DIR>\n\n# Initialize all modules\nterragrunt run --all init\n\n# Preview changes for a specific environment\ncd \u003CENV>\u002Fvpc && terragrunt plan\n\n# Preview all changes\nterragrunt run --all plan\n\n# Apply changes (requires approval)\nterragrunt run --all apply\n\n# Destroy (use with extreme caution)\nterragrunt run --all destroy\n```\n\n### 4. Placeholder Replacement and Secrets Check (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Placeholder and Secrets Check\n\n### Placeholder Replacement\n- [ ] All placeholders (`[AWS_REGION]`, `[BUCKET_NAME]`, `[DYNAMODB_TABLE]`, etc.) replaced with real values\n- [ ] No legacy placeholder aliases left (for example `[REGION]`)\n- [ ] `terraform.source` values point to real module sources and pinned versions\n\n### Secrets Safety\n- [ ] No plaintext credentials or access keys in `terragrunt.hcl`, `root.hcl`, `env.hcl`, `account.hcl`, or `region.hcl`\n- [ ] Sensitive values sourced via environment variables, secret managers, or CI variables\n- [ ] Example values kept non-sensitive and clearly marked as placeholders\n```\n\n### 5. Environment-Specific Notes (MANDATORY)\n\n> **You MUST include this section.** Copy the template below and fill in the actual values:\n\n```markdown\n## Environment Notes\n\n### Required Environment Variables\n| Variable | Description | Example |\n|----------|-------------|---------|\n| AWS_PROFILE | AWS CLI profile to use | `my-profile` |\n| AWS_REGION | AWS region (or set in provider) | `us-east-1` |\n\n### Prerequisites\n- [ ] S3 bucket `\u003CBUCKET_NAME>` must exist before first run\n- [ ] DynamoDB table `\u003CTABLE_NAME>` must exist for state locking\n- [ ] IAM permissions for Terraform state management\n\n### Production-Specific Protections\n| Module | Protection | Description |\n|--------|------------|-------------|\n| prod\u002Frds | `prevent_destroy = true` | Prevents accidental database deletion |\n| prod\u002Frds | `exclude { actions = [\"destroy\"] }` | Blocks destroy commands |\n```\n\n### 6. Next Steps (Optional)\nSuggest what the user might want to do next (add more modules, customize configurations, etc.)\n\n## Best Practices\n\nReference `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` for comprehensive guidelines.\n\n**Key principles:**\n- Use `include` blocks to inherit root configuration (DRY)\n- Always provide mock outputs for dependencies\n- Enable state encryption (`encrypt = true`)\n- Use `generate` blocks for provider configuration\n- Specify bounded version constraints (`~> 5.0`, not `>= 5.0`) for local\u002FGit modules\n- Never hardcode credentials or secrets\n- Configure retry logic for transient errors\n\n> **Note on Version Constraints with Registry Modules:** When using Terraform Registry modules (e.g., `tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws?version=5.1.0`), they typically define their own `required_providers`. In this case, you may omit generating `required_providers` in `root.hcl` to avoid conflicts. The module's pinned version (`?version=X.X.X`) provides the version constraint. See \"Common Issues → Provider Conflict with Registry Modules\" for details.\n\n**Anti-patterns to avoid:**\n- Hardcoded account IDs, regions, or environment names\n- Missing mock outputs for dependencies\n- Duplicated configuration across modules\n- Unencrypted state storage\n- Missing or loose version constraints (except when using registry modules that define their own)\n- Root.hcl trying to read env.hcl that doesn't exist at root level\n\n## Deprecated Attributes\n\n| Deprecated | Replacement | Reference |\n|------------|-------------|-----------|\n| `skip` | `exclude` block | [Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#exclude) |\n| `retryable_errors` | `errors.retry` block | [Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F#errors) |\n| `run-all` | `run --all` | [Migration](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002Fmigrating-from-run-all\u002F) |\n| `--terragrunt-*` flags | Unprefixed flags | [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F) |\n| `TERRAGRUNT_*` env vars | `TG_*` env vars | [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F) |\n\n## Resources\n\n### Templates - MUST Read Before Generating\n\n| Configuration Type | Template File | Purpose | When to Read |\n|-------------------|---------------|---------|--------------|\n| Root configuration | `assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl` | Shared backend, provider, and common inputs | Before generating any root.hcl |\n| Environment variables | `assets\u002Ftemplates\u002Fenv\u002Fenv.hcl` | Per-environment locals (environment, region, sizing, feature toggles) | Before generating any env.hcl (Pattern A) |\n| Child module | `assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl` | Module include, source, and optional dependency scaffolding | Before generating any child module |\n| Standalone module | `assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl` | Module config without root inheritance | Before generating standalone modules |\n| Stack file | `assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl` | Stack blueprint and unit generation | Before generating stacks |\n| Catalog unit | `assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl` | Reusable unit consumed by stack definitions | Before generating catalog units |\n\n### References\n\n| Reference | Content | Purpose | When to Read |\n|-----------|---------|---------|--------------|\n| `references\u002Fcommon-patterns.md` | All generation patterns with examples | Pick a compatible pattern before writing files | Always, before generating |\n| `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` | Comprehensive best practices | Final quality and safety checks | Always, before generating |\n\n### Official Documentation\n- [Terragrunt Docs](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002F)\n- [Configuration Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fconfig-blocks-and-attributes\u002F)\n- [CLI Reference](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Freference\u002Fcli-options\u002F)\n- [Stacks](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fstacks\u002F)\n- [Feature Flags](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Ffeature-flags\u002F)\n- [Engine](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Ffeatures\u002Fengine\u002F)\n- [Migration Guides](https:\u002F\u002Fterragrunt.gruntwork.io\u002Fdocs\u002Fmigrate\u002F)\n\n## Common Issues\n\n### Root.hcl Cannot Find env.hcl\n\n**Symptom:**\n```\nError: Attempt to get attribute from null value\n  on .\u002Froot.hcl line X:\n  This value is null, so it does not have any attributes.\n```\n\n**Cause:** Root.hcl is trying to read `env.hcl` via `find_in_parent_folders(\"env.hcl\")`, but env.hcl doesn't exist at the root level.\n\n**Solution:** Make root.hcl environment-agnostic:\n```hcl\n# DON'T do this in root.hcl for multi-environment setups:\nlocals {\n  env_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))  # FAILS\n}\n\n# DO use static values or get_env():\ngenerate \"provider\" {\n  path      = \"provider.tf\"\n  if_exists = \"overwrite_terragrunt\"\n  contents  = \u003C\u003CEOF\nprovider \"aws\" {\n  region = \"us-east-1\"  # Static value, or use get_env(\"AWS_REGION\", \"us-east-1\")\n}\nEOF\n}\n```\n\n### Provider Conflict with Registry Modules\n\nWhen using Terraform Registry modules (e.g., `tfr:\u002F\u002F\u002Fterraform-aws-modules\u002Fvpc\u002Faws`), they may define their own `required_providers` block. This can conflict with provider configuration generated by `root.hcl`.\n\n**Symptoms:**\n```\nError: Duplicate required providers configuration\n```\n\n**Solutions:**\n1. **Remove conflicting generate block** - If using registry modules that manage their own providers, avoid generating duplicate `required_providers`:\n   ```hcl\n   # In root.hcl - only generate provider config, not required_providers\n   generate \"provider\" {\n     path      = \"provider.tf\"\n     if_exists = \"overwrite_terragrunt\"\n     contents  = \u003C\u003CEOF\n   provider \"aws\" {\n     region = \"us-east-1\"\n   }\n   EOF\n   }\n   ```\n\n2. **Use if_exists = \"skip\"** - Skip generation if file already exists:\n   ```hcl\n   generate \"versions\" {\n     path      = \"versions.tf\"\n     if_exists = \"skip\"  # Don't overwrite module's versions.tf\n     contents  = \"...\"\n   }\n   ```\n\n3. **Clear cache** - If conflicts persist after fixes:\n   ```bash\n   rm -rf .terragrunt-cache\n   terragrunt init\n   ```\n\n### Feature Flag Validation Errors\n\nIf you see `Unknown variable; There is no variable named \"local\"` in feature blocks, ensure defaults are static values (see Feature Flags section above).\n\n### Child Module Cannot Find env.hcl\n\n**Symptom:**\n```\nError: Attempt to get attribute from null value\n  on .\u002Fdev\u002Fvpc\u002Fterragrunt.hcl line X:\n```\n\n**Cause:** Child module's `find_in_parent_folders(\"env.hcl\")` cannot find env.hcl.\n\n**Solution:** Ensure env.hcl exists in the environment directory:\n```\ndev\u002F\n├── env.hcl           # This file MUST exist\n└── vpc\u002F\n    └── terragrunt.hcl  # Calls find_in_parent_folders(\"env.hcl\")\n```\n\n## Quick Reference Card\n\n### File Reading Checklist\n\nBefore generating, READ these files in order:\n\n1. [ ] `references\u002Fcommon-patterns.md` - Understand available patterns\n2. [ ] `..\u002Fterragrunt-validator\u002Freferences\u002Fbest_practices.md` - Know the rules\n3. [ ] Relevant template(s) from `assets\u002Ftemplates\u002F` - Structural reference\n\n### Architecture Decision Tree\n\n```\nQ: Multiple environments (dev\u002Fstaging\u002Fprod)?\n├─ YES → Q: Shared root configuration?\n│   ├─ YES → Pattern A: Environment-Agnostic Root\n│   └─ NO  → Separate root.hcl per environment\n└─ NO  → Q: Environment detection needed?\n    ├─ YES → Pattern B: Environment-Aware Root\n    └─ NO  → Pattern B: Simple single-environment\n```\n\n### Validation Sequence\n\n1. Format check: `terragrunt hcl fmt --check`\n2. Input validation: `terragrunt hcl validate --inputs`\n3. Full validation: Invoke `Skill(devops-skills:terragrunt-validator)`\n4. Fix errors → Re-validate → Repeat until clean\n\n## Done Criteria\n\nThis skill execution is complete only when ALL are true:\n\n- One architecture checklist is completed and shown (the canonical checklist in this file)\n- Generated files consistently use modern root include syntax unless legacy was explicitly requested\n- Registry sources use canonical `tfr:\u002F\u002F\u002FNAMESPACE\u002FNAME\u002FPROVIDER?version=X.Y.Z` format\n- Dependency blocks are added only where actually needed (not left as unresolved placeholders)\n- All placeholders are replaced and secrets checks are reported in output\n- Validation succeeded, or fallback checks ran with explicit limitations documented\n",{"name":5,"description":7},"master","c73386b305dec167db7654e0e6feacb462d4f9dc","assets\u002Fskills\u002Fdevops\u002Fterragrunt-generator",1,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code","https:\u002F\u002Fgithub.com\u002FAntifragileTech","2026-10-02 14:22:14",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add AntifragileTech\u002Fantifragile-claude-code --skill terragrunt-generator",{"tool":43,"command":44},"bunx","bunx skills add AntifragileTech\u002Fantifragile-claude-code --skill terragrunt-generator",{"tool":46,"command":47},"pnpm","pnpm dlx skills add AntifragileTech\u002Fantifragile-claude-code --skill terragrunt-generator","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002FSKILL.md",true,[51,57,61,67,71,75,79,83,87,91,97,101,105,109,113,117,123,127,131],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},".gitignore","OTHER","其他",19,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002F.gitignore",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},".security-scan-passed",181,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002F.security-scan-passed",{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"assets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl","ASSET","资产文件",4950,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Fcatalog\u002Fterragrunt.hcl",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"assets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl",3267,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Fchild\u002Fterragrunt.hcl",{"path":72,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":73,"sourceHtmlUrl":74},"assets\u002Ftemplates\u002Fenv\u002Fenv.hcl",2279,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Fenv\u002Fenv.hcl",{"path":76,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":77,"sourceHtmlUrl":78},"assets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl",1822,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Fmodule\u002Fterragrunt.hcl",{"path":80,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":81,"sourceHtmlUrl":82},"assets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl",4001,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Froot\u002Fterragrunt.hcl",{"path":84,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":85,"sourceHtmlUrl":86},"assets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl",4906,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Fassets\u002Ftemplates\u002Fstack\u002Fterragrunt.stack.hcl",{"path":88,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":89,"sourceHtmlUrl":90},"config-template\u002Fauthorization.json.example",958,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Fconfig-template\u002Fauthorization.json.example",{"path":92,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fbest_practices.md","REFERENCE","参考文档",10150,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Freferences\u002Fbest_practices.md",{"path":98,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fcommon-patterns.md",26023,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Freferences\u002Fcommon-patterns.md",{"path":102,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fcredentials_setup.md",8079,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Freferences\u002Fcredentials_setup.md",{"path":106,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":107,"sourceHtmlUrl":108},"references\u002Finstallation_flow.md",12541,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Freferences\u002Finstallation_flow.md",{"path":110,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":111,"sourceHtmlUrl":112},"references\u002Fknown_issues.md",19330,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Freferences\u002Fknown_issues.md",{"path":114,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":115,"sourceHtmlUrl":116},"references\u002Fskill_registry.md",15066,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Freferences\u002Fskill_registry.md",{"path":118,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":121,"sourceHtmlUrl":122},"scripts\u002Fconfigure_auth.sh","SCRIPT","脚本",11777,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Fscripts\u002Fconfigure_auth.sh",{"path":124,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":125,"sourceHtmlUrl":126},"scripts\u002Fdiagnose.sh",11846,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Fscripts\u002Fdiagnose.sh",{"path":128,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":129,"sourceHtmlUrl":130},"scripts\u002Finstall_gangtise.sh",16605,"https:\u002F\u002Fgithub.com\u002FHuuBar\u002Fskill-routing-experiment\u002Fblob\u002Fmain\u002Funified_skills\u002Fdaymade\u002Fgangtise-copilot\u002Fscripts\u002Finstall_gangtise.sh",{"path":132,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":133,"sourceHtmlUrl":134},"test\u002Ftest_templates.py",18575,"https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fdevops\u002Fterragrunt-generator\u002Ftest\u002Ftest_templates.py",[136,149,162,175,188,201],{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":25},"01M6DT9Q6VYA615SCXR757TZZ7","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fwriting-skills\u002FSKILL.md",[],[143,144,145,146,147,148],"writing skills","writing","use","editing","work","deployment",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":25},"01M6DT9GFHDNY90P41WGAE1TV0","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fwriting-plans\u002FSKILL.md",[],[156,157,144,158,159,145,160,161],"plans","writing plans","requirements","task","code","spec",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":25},"01M6DT9C6PFGD86WS3HY7YE3XG","docs:write-concisely","Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fwrite-concisely\u002FSKILL.md",[],[169,170,171,172,173,174,144],"docs:write concisely","write","docs","read","Rules","documentation",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":25},"01M6DT98AWQ27P0N1CG97WAG66","kaizen:why","Iterative Five Whys root cause analysis drilling from symptoms to fundamentals","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fwhy\u002FSKILL.md",[],[177,182,183,184,185,186,187],"why","kaizen","issue","five whys","analysis","root cause analysis",{"skillNo":189,"name":190,"nameZh":6,"description":191,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":192,"categories":193,"keywords":194,"publishedAt":25},"01M6DT93EH25NAX19R3WGE1P53","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fverification-loop\u002FSKILL.md",[],[195,196,197,198,160,199,200],"verification loop","verification","loop","sessions","claude code sessions","system",{"skillNo":202,"name":203,"nameZh":6,"description":204,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":205,"categories":206,"keywords":207,"publishedAt":25},"01M6DT90GW7Z7VCN98P9DVYSNC","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002FAntifragileTech\u002Fantifragile-claude-code\u002Fblob\u002Fmaster\u002Fassets\u002Fskills\u002Fthinking\u002Fverification-before-completion\u002FSKILL.md",[],[208,196,209,147,145,210,211,212],"verification before completion","commands","evidence","claim","complete"]