Agent Skillsgoogle/skills › design

design

GitHub

用于生成和验证模块化 Terraform 架构的 Agent 技能。通过四阶段流程处理云架构设计,包括意图解析、模块生成、HCL 语法及语义验证,确保符合 GCP 最佳实践与安全规范,不执行部署或故障排查。

skills/cloud/design-deploy/references/design/SKILL.md google/skills

Trigger Scenarios

设计模块化 Terraform 架构 编写本地 HCL 配置 使用 terraform validate 验证 HCL 使用 terraform plan 规划 HCL

Install

npx skills add google/skills --skill design -g -y
More Options

Non-standard path

npx skills add https://github.com/google/skills/tree/main/skills/cloud/design-deploy/references/design -g -y

Use without installing

npx skills use google/skills@design

指定 Agent (Claude Code)

npx skills add google/skills --skill design -a claude-code -g -y

安装 repo 全部 skill

npx skills add google/skills --all -g -y

预览 repo 内 skill

npx skills add google/skills --list

SKILL.md

Frontmatter
{
    "name": "design",
    "license": "Apache-2.0",
    "metadata": {
        "version": "v1",
        "category": "CloudInfrastructure",
        "publisher": "google"
    },
    "description": "Processes cloud architectural design and local validation. Use when designing modular Terraform architectures, authoring local HCL, validating HCL via terraform validate, or planning HCL via terraform plan. Don't use for deploying templates, plan assessment, or troubleshooting deployment failures."
}

Simplified GCP Modular Terraform Architect Skill

This skill performs an agentic design cycle around a 4-phase generation pipeline:

graph LR
    A[1. Ingest Intent & Catalog Query] --> B[2. High-Level Architecture Planning]
    B --> C[3. Module-Only Gen & CLI Validation]
    C --> D[4. Semantic Review & Handover]
    D -->|"Goals Unmet"| B

You MUST follow these 4 explicit phases strictly in order. You must not skip phases. If the semantic review in Phase 4 determines that the configuration does not fully meet the user's architectural goals or intent, you MUST loop back to Phase 2 to replan and regenerate.


⚠️ Strict Architectural Constraints

All generated configurations must prioritize the modular structure while adhering to naming and HCL style constraints. Refer to:

  • ../generator_instructions.md for generation constraints and project defaults.
  • ../terraform_validator_instructions.md for semantic validation rules.

General defaults & policies:

  • Default Network and Subnetwork: Target the pre-existing VPC network and subnetwork both named "default" in <project_id> unless otherwise specified.
  • Secret-Safe Policy (MANDATORY): NEVER write plaintext passwords, API keys, or credentials in HCL code or terraform.tfvars. All secrets must be declared as resources in GCP Secret Manager (using the terraform-google-secret-manager module) and referenced dynamically by target services.
  • State Isolation Policy (MANDATORY): Keep the Terraform state local in the scratch folder for validation. NEVER generate a remote backend block (e.g., backend "gcs" {}), as remote state is managed dynamically by the parent orchestrator/deployment registry.

Phase 1: Ingest Intent & Catalog Query

  1. Load Inputs: Ingest user goals and instructions.

  2. Query Catalog Registry (Private and Public): To supplement the design, search both your project's custom private catalog and the public Google catalog by calling the native manage_catalog MCP tool with the CATALOG_OPERATION_LIST_COMPONENTS operation.

    • Query Private Catalog (Target Space):

      • ServerName: application_design_center

      • ToolName: manage_catalog

      • Arguments:

        {
          "project": "<project_id>",
          "location": "<location>",
          "spaceId": "<space_id>",
          "operation": "CATALOG_OPERATION_LIST_COMPONENTS"
        }
        
    • Query Public Google Catalog:

      • ServerName: application_design_center

      • ToolName: manage_catalog

      • Arguments:

        {
          "project": "gcpdesigncenter",
          "location": "us-central1",
          "spaceId": "googlespace",
          "catalogId": "googlecatalog",
          "operation": "CATALOG_OPERATION_LIST_COMPONENTS"
        }
        
    • Priority Rule: You MUST prioritize using private catalog templates (found in your target space) over public Google ones to ensure project-specific customizations are respected.
  3. Get Module Details: Fetch detailed module metadata containing inputs, outputs, and dependencies by calling the native manage_catalog MCP tool with the CATALOG_OPERATION_GET_COMPONENT_METADATA operation (or CATALOG_OPERATION_GET_COMPONENT_IAC to retrieve the underlying Terraform source code directly):

    • MCP Tool Call:

      • ServerName: application_design_center

      • Tool Name: manage_catalog

      • Arguments:

        {
          "project": "<project_id>",
          "location": "<location>",
          "spaceId": "<space_id>",
          "catalogTemplateId": "<short_module_id>",
          "catalogTemplateRevisionId": "<revision_id>",
          "operation": "CATALOG_OPERATION_GET_COMPONENT_METADATA"
        }
        
    • Constraint: Pass only the short module ID (e.g., cloud-run-job, which is the last segment of the fully qualified resource name), NOT the full resource name path returned by the list command.

    [!IMPORTANT] To ensure your local HCL declarations perfectly match the version constraints validated by the Design Center registry, you MUST extract the precise Git repository tag from the registry and use it in your HCL module source.

    The gitSource metadata block (including refTag, repo, and dir) is returned directly in the output of the manage_catalog MCP tool (under the gitSource field).

    If you need to fallback to the CLI to describe the revision details, you can run the describe command directly using the revision URI retrieved from the MCP tool:

       gcloud design-center spaces catalogs templates revisions describe <revision_uri>
    
    1. Extract the fields from the gitSource block:

      gitSource:
        dir: modules/v2
        refTag: v0.33.0
        repo: GoogleCloudPlatform/terraform-google-cloud-run
      
    2. Construct the HCL source URI using the pattern github.com/<repo>//<dir>?ref=<refTag>:

      source = "github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2?ref=v0.33.0"
      

Phase 2: High-Level Architecture Planning

  1. Resource Initialization (MANDATORY): Before formulating any plan, you MUST read instructions from ../planner_instructions.md. Do not proceed until these instructions are in your active context.

  2. Design the High-Level Architecture: Based on the modules identified in Phase 1, plan the design topology connecting the key modular building blocks (VPC, Compute, Databases, Security).

  3. Formulate Integration Pattern Decisions: Determine core pattern layout decisions (such as GKE vs. Cloud Run computing model, storage engines, network boundaries, private interconnects, and database hosting structures) using available modules.

    • Note: Follow Google best practices while formulating a pattern. For example:
      1. Always use Secret Manager to store and reference database credentials instead of using passphrases as input parameters.
      2. Use Private Service Connect instead of public access for private connectivity.
  4. Gather pre-existing reusable TF modules: Check if there are any preexisting TF modules from the catalog to understand available building blocks to create end to end solution matching user intent. Catalog contains modules public catalog (published by GCP) and private catalog owned by the customer. When there is a duplicate module between public and private catalog, always prefer private catalog component/module. Inspect the selected modules by calling the native manage_catalog MCP tool with the CATALOG_OPERATION_GET_COMPONENT_METADATA operation to verify inputs, outputs, required inputs, and reference outputs:

    • MCP Tool Call:

      • ServerName: application_design_center

      • Tool Name: manage_catalog

      • Arguments:

        {
          "project": "gcpdesigncenter",
          "location": "us-central1",
          "spaceId": "googlespace",
          "catalogId": "googlecatalog",
          "operation": "CATALOG_OPERATION_GET_COMPONENT_METADATA",
          "catalogTemplateId": "<module_id>"
        }
        
    • Constraint: Use the short module ID (the last segment of the resource name, e.g., cloud-run-job), NOT the full resource path starting with projects/.... If querying a private catalog, update the project, spaceId, and catalogId arguments accordingly.
  5. Review End to End Solution Templates: Review well-architected solutions published by GCP as well as solutions published by the customer's own organization. Use these solutions as reference architectures when applicable. To explore available templates, run the local CLI script list_terraform_templates to see if a pre-existing application template can serve as your design baseline. You MUST pass your active target project ID and space ID to retrieve both public Google templates and private templates:

    python3 scripts/list_terraform_templates.py --project="<project_id>" --space_id="<space_id>" --catalog_id="<catalog_id>"
    
    • Priority Rule: In the returned list, private application templates appear first (marked with "source": "private"). You MUST prioritize using private application templates over public Google ones (marked with "source": "google") if a suitable private template is available!
  6. Fetch Terraform Template: Fetch the baseline template config to your local workspace by running the local CLI script fetch_terraform_template. You MUST pass your active target project ID and space ID:

    python3 scripts/fetch_terraform_template.py <template_id> --project="<project_id>" --space_id="<space_id>" --out_dir="<target_directory_path>"
    

    (the output directory will be created automatically if it does not exist).

  7. Review Planner Principles: Crosscheck planning directives in planner_instructions.md.


Phase 3: Module-Only Generator & CLI Validation Loop

  1. Resource Initialization (MANDATORY): Before writing any HCL, you MUST read instructions from ../generator_instructions.md. Do not proceed until these instructions are in your active context.

  2. Generate Raw HCL: Write standard Terraform code, prioritizing module blocks as much as possible, or using direct resources where no suitable module is available, based on rules in the loaded instructions.

  3. Save Configuration File: Create a dedicated workspace scratch directory unique to this execution/session (e.g. scratch/tf_validate_{session_id}/, using the session, conversation, or a unique run ID to avoid concurrent executions overwriting one another) and write the generated HCL code split into:

    • providers.tf: Provider and terraform blocks.
    • main.tf: Module and resource declarations.
    • variables.tf: Variable declarations.
    • terraform.tfvars: Variable values.
    • outputs.tf: Output declarations.
  4. Semantic Architecture Validation (MANDATORY): Before running any CLI validation, you MUST read instructions from ../terraform_validator_instructions.md. Perform a comprehensive semantic audit to ensure the configuration complies with the validator guidelines (preferring modules over resources, no custom variables, correct GitHub source formatting, etc.). Do not proceed until these instructions are in your active context.

  5. Execute Local CLI Validation Check (CRITICAL):

    • Initialize the directory using the Terraform CLI directly to pull CFT sources and download provider plugins:

      terraform -chdir=scratch/tf_validate_{session_id}/ init
      
    • Validate HCL block structures and type connections using the Terraform CLI directly:

      terraform -chdir=scratch/tf_validate_{session_id}/ validate
      
    • Dry-run resource changes and verify configuration feasibility with the Terraform CLI:

      terraform -chdir=scratch/tf_validate_{session_id}/ plan
      
    • Remediation Loop: If errors or warnings are reported by the Terraform CLI during initialization, validation, or planning, correct main.tf and repeat the check commands until clean.


Phase 4: Semantic Review & Handover

Your final modular code must be clean, robust, and securely wired.

  1. Semantic Review & Goal Alignment: Audit the validated configuration against the user's intent and architectural constraints. If the architecture fails to meet the goal or requires adjustment, loop back to Phase 2: High-Level Architecture Planning to replan and regenerate.

  2. Deliver Architectural Rationale: Output a clear, thorough final report that describes:

    • The High-Level Architecture Layout: Clear overview detailing each module or resource block and its structural role in the GCP infrastructure.
    • The Architectural Rationale: Explicit decisions for why specific compute systems, boundaries, and database models were picked. Explain the necessity of using direct resources if any were created instead of modules. If multiple products were considered, include rationale for product choice.
    • The Inter-Module Topology & Dataflow: A descriptive text-based walk-through of how data flows between the VPC network boundaries, computing blocks, and dependent database components.
  3. Output Intact Terraform Code: Read each generated file (including .tf and .tfvars files) in the target validation directory (using your standard file viewing/reading tools) and output its exact, intact HCL configuration in your final response. Each file MUST be formatted as:

    File: `<path>`
    ```hcl
    [content]
    ```
    

    Ensure you output the complete and exact file contents for all final validated files.

Reporting Issues

Report bugs or improvements for this skill at Google Skills Issues.

Version History

  • 7072dc4 Current 2026-08-13 10:31

Same Skill Collection

skills/ads/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api-setup/SKILL.md
skills/ads/data-manager-api/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-setup/SKILL.md
skills/ads/google-ads-api-mcp-setup/SKILL.md
skills/ads/google-ads-api/google-ads-api-mcp-setup/SKILL.md
skills/ads/google-mobile-ads-android-migrate-to-next-gen/SKILL.md
skills/ads/google-mobile-ads-banner/SKILL.md
skills/ads/google-mobile-ads-get-started/SKILL.md
skills/ads/google-mobile-ads-interstitial/SKILL.md
skills/ads/google-mobile-ads-rewarded/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-android-migrate-to-next-gen/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-banner/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-get-started/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-interstitial/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-rewarded/SKILL.md
skills/ads/ima-sdk-basics/SKILL.md
skills/ads/ima-sdk-client-side/SKILL.md
skills/ads/interactive-media-ads/ima-sdk-basics/SKILL.md
skills/analytics/google-analytics-admin-api-basics/SKILL.md
skills/cloud/agent-platform-endpoint-management/SKILL.md
skills/cloud/agent-platform-migrate-from-ai-studio/SKILL.md
skills/cloud/agent-platform-model-registry/SKILL.md
skills/cloud/agent-platform-prompt-management/SKILL.md
skills/cloud/agent-platform-rag-engine-management/SKILL.md
skills/cloud/agent-platform-skill-registry/SKILL.md
skills/cloud/agent-platform-troubleshooting/SKILL.md
skills/cloud/agent-platform-tuning-management/SKILL.md
skills/cloud/agent-platform-tuning/SKILL.md
skills/cloud/alloydb-basics/SKILL.md
skills/cloud/bigquery-basics/SKILL.md
skills/cloud/bigquery-bigframes/SKILL.md
skills/cloud/bigtable-basics/SKILL.md
skills/cloud/cloud-logging-configuration-basics/SKILL.md
skills/cloud/cloud-logging-cross-project-configuration/SKILL.md
skills/cloud/cloud-logging-query-generation/SKILL.md
skills/cloud/cloud-monitoring-metric-selection/SKILL.md
skills/cloud/cloud-run-basics/SKILL.md
skills/cloud/datalineage-summary/SKILL.md
skills/cloud/design-deploy/references/infra-deployment-debugging/SKILL.md
skills/cloud/design-deploy/SKILL.md
skills/cloud/detection-engineering-coverage-evaluation/SKILL.md
skills/cloud/developer-device-platform-basics/SKILL.md
skills/cloud/gcloud/SKILL.md
skills/cloud/gemini-agents-api/SKILL.md
skills/cloud/gemini-api/SKILL.md
skills/cloud/gemini-interactions-api/SKILL.md

Metadata

Files
0
Version
7072dc4
Hash
0a85de7d
Indexed
2026-08-13 10:31

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-14 07:25
浙ICP备14020137号-1 $お客様$