用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/aiFabricoCom/fabrico-collections-codex --skill fabrico-analyze-gcp-costs命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | fabrico-analyze-gcp-costs |
| description | Audit GCP cost optimization and labeling compliance. |
Invocation portability:
$fabrico-*below means the discovered entry workflow. Use the unqualified name for repository or filesystem installs and$fabrico-collections:fabrico-*for plugin installs.
Use the user’s current request as the workflow input. Expected context: [GCP Project ID, Region, or 'all'] [focus: specific service or 'everything'].
Prefer the
fabrico-devops-engineersubagent. When that custom agent is available, spawn it with the user's request and referenced context and adopt its operating contract. If this workflow is already running insidefabrico-devops-engineer, perform the audit locally and never spawn another DevOps engineer. If the profile is unavailable, as in a skills-only plugin installation, perform the complete workflow in the current thread with the required skills and the same audit contract. Perform an exhaustive, evidence-based GCP cost optimization and labeling compliance audit. Use a hybrid approach: analyze Terraform/IaC code first (if available), then always validate against live GCP infrastructure via API. The goal is to inspect every nook and cranny — every service, every resource, every configuration — for optimization opportunities, waste, misconfigurations, and labeling gaps.
When the user does not specify a narrow scope, default to auditing everything in the given project and region.
Before starting, load and follow these skills (in this order):
fabrico-technical-context-discovering — identify existing IaC patterns, labeling conventions, and project contextfabrico-codebase-analysing — IaC structure analysis, module relationships, and dead code detection; apply Steps 7, 2, 12 when IaC files are foundfabrico-optimizing-cloud-cost — cost analysis framework: Pricing Model Decision table, Storage Tiering Decision, labeling standards, rightsizing process, and anti-patternsfabrico-designing-multi-cloud-architecture (conditional) — GCP service selection reference, multi-cloud decision framework; load when evaluating service alternatives or migration optionsfabrico-implementing-terraform-modules (conditional) — Terraform module structure, best practices, and GCP module reference; load when Terraform files are foundfabrico-managing-secrets (conditional) — secrets management audit criteria, security checklist, and exposure risk assessment; load when security findings are in scopeScope validation:
Load required skills (MUST complete before any analysis):
fabrico-technical-context-discovering skill (read .agents/skills/fabrico-technical-context-discovering/SKILL.md) — follow its process to identify existing IaC patterns, labeling conventions, and project context.fabrico-codebase-analysing skill (read .agents/skills/fabrico-codebase-analysing/SKILL.md) — even if no IaC files are found initially, this skill's Step 7 (infrastructure code) helps identify IaC in unexpected locations, and Step 2 (dependencies) reveals infrastructure-related dependencies in any project.fabrico-optimizing-cloud-cost skill (read .agents/skills/fabrico-optimizing-cloud-cost/SKILL.md and references/tagging-standards.md) — use its GCP columns in the Pricing Model Decision table, Storage Tiering Decision table, Process steps, Checklist, and Anti-Patterns. Adapt the "Core 5" Mandatory Tags for GCP as labels: cost_center, environment, service, owner, data_class (lowercase with underscores — GCP label format). If the skill file cannot be found, use the following hardcoded defaults for the Core 5 Mandatory Labels: cost_center, environment, service, owner, data_class.fabrico-designing-multi-cloud-architecture skill (read .agents/skills/fabrico-designing-multi-cloud-architecture/SKILL.md) — load when evaluating GCP service alternatives or comparing GCP services against each other. Use its GCP service comparison tables for compute, storage, database, and networking decisions.fabrico-implementing-terraform-modules skill (read and ) — load when Terraform files (, , ) are found. Use it as the reference standard for module structure, naming conventions, provider pinning, and GCP-specific module patterns when evaluating IaC quality and generating Terraform code.All standard DevOps agent guardrails (Mutation Lock, Zero-Deletion Policy, FinOps Alerts) apply automatically. Additionally:
environment:prod..agents/skills/fabrico-implementing-terraform-modules/SKILL.mdreferences/gcp-modules.md*.tf*.tfvarsterragrunt.hclfabrico-managing-secrets skill (read .agents/skills/fabrico-managing-secrets/SKILL.md) — load when the audit scope includes security (which is always for a full audit). Use its Security Checklist, Anti-Patterns, and Cloud-Native Detection patterns when evaluating secrets management, Cloud KMS keys, and credential handling.IaC-first discovery (hybrid approach — IaC then API):
fabrico-technical-context-discovering skill process loaded in step 2.*.tf, *.tfvars, terragrunt.hcl) and Deployment Manager templates (*.yaml, *.jinja with GCP resource types).fabrico-codebase-analysing skill (loaded in step 2) — specifically run its infrastructure code analysis (Step 7), dependency check (Step 2), and dead code/duplication check (Step 12) against the IaC codebase.fabrico-implementing-terraform-modules skill (loaded in step 2) to evaluate module structure quality: check for standard file layout (main.tf/variables.tf/outputs.tf/versions.tf), provider version pinning, variable validation blocks, and adherence to GCP module best practices.machine_type, disk_size_gb, disk_type, num_instances, tier, availability_type).list, describe, and get operations only) to inventory all active resources in the specified scope via gcloud CLI commands (e.g., gcloud compute instances list, gcloud sql instances list, gcloud container clusters list, etc.).Comprehensive resource audit (check EVERYTHING):
Apply the fabrico-optimizing-cloud-cost skill's Process step 3 (Identify waste) and Checklist to systematically check each resource category below. Apply the fabrico-managing-secrets skill's Security Checklist when auditing the Security & Compliance category.
Labeling & governance audit:
Apply the fabrico-optimizing-cloud-cost skill's Required Tags table (adapted for GCP labels) and references/tagging-standards.md for the complete labeling framework.
cost_center, environment, service, owner, data_class) — GCP labels use lowercase with underscores.model_id and training_job_id labels exist.data_class label exists on all storage and database resources.environment:dev running 24/7 that are missing the schedule label.Cost & performance analysis:
gcloud billing budgets list, BigQuery billing export tables) for actual cost data. If unavailable, estimate based on machine type and runtime hours.fabrico-optimizing-cloud-cost skill's Pricing Model Decision table (GCP column) to match each resource's workload type (steady-state, variable, fault-tolerant, serverless) to the optimal pricing model (sustained use discounts, committed use discounts, Spot VMs, per-second billing). Apply the Storage Tiering Decision table for all storage resources. Reference the skill's Anti-Patterns table to flag common cost mistakes.fabrico-designing-multi-cloud-architecture skill's GCP service comparison tables when evaluating service alternatives or considering migrations between GCP service tiers (e.g., Cloud SQL vs. AlloyDB, GKE Standard vs. Autopilot, Compute Engine vs. Cloud Run).Generate and save the analysis report:
IMPORTANT: Save the report file before presenting results to the user. Do not ask for confirmation. Always use this filename pattern:
gcp-cost-audit-<project>-<region>-YYYY-MM-DD.md(e.g.gcp-cost-audit-my-project-us-central1-2026-03-05.md). After saving, tell the user the full file path on one line, then present the formatted summary below.
The saved Markdown file must be polished and presentation-ready. Follow every formatting rule below exactly — do not improvise:
Exact report structure and formatting rules:
# GCP Cost Optimization Audit
**Project:** `<project-id>` **Region:** `<region>` **Date:** YYYY-MM-DD
**Data Sources:** IaC (Terraform) / Live API / Both
**Scope:** All services / <specific services>
---
## 📋 Executive Summary
- <bullet 1>
- <bullet 2>
- ... (3–6 bullets max)
---
## 🔍 IaC vs Live Infrastructure Drift
| # | Resource | IaC State | Live State | Drift Type |
|---|----------|-----------|------------|------------|
| 1 | `instance-prod-01` | `e2-standard-4` | `e2-standard-8` | Config drift |
| 2 | `fw-allow-ssh` | Not in IaC | Active | Shadow resource |
*(If no IaC found or no drift detected, state that clearly.)*
---
## 💰 Optimization Opportunities
| # | Resource ID | Type | Current Config | Current Cost ($/mo) | Recommended Config | Est. New Cost ($/mo) | Savings ($/mo) | Path |
|---|---|---|---|---|---|---|---|---|
| 1 | `instance-prod-01` | Compute Engine | `e2-standard-4` | $140 | `e2-standard-2` | $70 | **$70** | 🟢 Golden |
| 2 | `db-prod-01` | Cloud SQL | `db-custom-8-32768, 500 GB pd-ssd` | $820 | `db-custom-4-16384, 500 GB pd-balanced` | $510 | **$310** | 🔵 Cost-Opt |
> Path legend: 🟢 Golden Path · 🔵 Cost-Optimized · 🚀 Velocity
---
## 🏷️ Label Compliance
| # | Resource ID | Type | Missing Labels | Status |
|---|---|---|---|---|
| 1 | `instance-prod-01` | Compute Engine | `owner`, `data_class` | ❌ FAIL |
| 2 | `my-bucket` | Cloud Storage | — | ✅ PASS |
---
## 🔒 Critical Security Findings
| # | Resource ID | Type | Finding | Severity |
|---|---|---|---|---|
| 1 | `fw-allow-ssh` | Firewall Rule | Port 22 open to 0.0.0.0/0 | 🔴 HIGH |
*(If none found, write: "No critical security findings detected.")*
---
## 📊 Summary
| Metric | Value |
|---|---|
| Total current monthly spend | $X,XXX |
| Total estimated optimized spend | $X,XXX |
| **Total estimated savings** | **$X,XXX/mo (XX%)** |
| Label compliance | XX% (X of Y resources fully labeled) |
| IaC coverage | XX% (X of Y resources managed by IaC) |
| Drift detected | X resources with configuration drift |
| Data sources used | GCP API / Terraform code / Both |
---
## ✅ Recommended Action Order
1. Apply optimization #X — highest savings, lowest risk
2. ...
Formatting constraints:
--- horizontal rules between every major section.❌ FAIL / ✅ PASS in label compliance status column — no bold-only text.|---| separators, not :---:).Next steps — After saving and presenting the analysis report, ask only one question:
"Would you like me to generate Terraform code to implement these optimizations?"
If no: end the workflow — the saved report stands on its own.
If yes:
1, 3, 5 or all). Only modify the resources the user selects. Apply the fabrico-implementing-terraform-modules skill's module structure patterns and best practices when generating or modifying Terraform code.fabrico-codebase-analysing skill (if not already loaded), the fabrico-technical-context-discovering skill, and the fabrico-implementing-terraform-modules skill. Apply them to the provided Terraform directory — specifically run fabrico-codebase-analysing Step 7 (infrastructure code), Step 2 (dependencies), and Step 12 (dead code) against the Terraform codebase, follow fabrico-technical-context-discovering to understand existing patterns, and use fabrico-implementing-terraform-modules for module structure reference (including references/gcp-modules.md) before making changes.Do not proceed with any code generation or file modification until the user explicitly confirms which items to implement.