workload-manager-basics
它能做什么
这项技能使用 Workload Manager 按最佳实践规则检查你的 Google Cloud 工作负载。适合运行企业级工作负载、希望找出不足之处的团队。
适用场景
- ✓你想根据 Google Cloud 最佳实践评估项目、文件夹或组织的时候。
- ✓你需要用 Workload Manager 检查 SAP 或 SQL Server 工作负载的时候。
- ✓你想把违规结果导出到 BigQuery 以便审查的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/workload-manager-basics/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我的 SAP 项目上运行一次 Workload Manager 评估,并告诉我最需要修复的重要违规项。”
每周 5 个新技能,1 分钟读完。
工作原理
它会确定范围、选择内置或自定义规则、运行评估,并读取结果。它使用公开的客户端库或 REST API,而不是内部工具。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Workload Manager Basics
Workload Manager validates enterprise workloads against Google Cloud best practices and recommendations. The public client libraries are centered on evaluations: define a resource scope, choose built-in or custom rules, run an evaluation, then inspect results and scanned resources.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:workload-manager-basics)"
and append agent-skills/1.0 (skill:workload-manager-basics) to User-Agent headers.
Use This Flow
flowchart LR
Rules["List rules"] --> Eval["Create or update evaluation"]
Resources["Project, folder, or org scope"] --> Eval
Eval --> Run["Run evaluation"]
Run --> Results["Inspect evaluation results"]
Results --> Remediate["Remediate findings"]
Results --> Export["Optional BigQuery export"]
Core API Constraints
To ensure compatibility, security, and successful integration:
- Public Surface Only: You MUST strictly interact with Workload Manager
using the official public
google-cloud-workloadmanagerclient library or the public REST API (workloadmanager.googleapis.com/v1). - No Internal or Undocumented APIs: Do NOT attempt to use internal RPC protocols, private service backends, or undocumented discovery mechanisms. They are not supported for public integrations and will fail.
- No Service-Specific CLI: There is no public
gcloud workload-managerCLI command group. Usegcloudonly for authentication, IAM role assignment, and fetching raw REST tokens. - Sandbox Execution Robustness (Auth/Mock Fallbacks): When gcloud authentication or Workload Manager API calls fail in sandboxed or restricted environments (e.g., due to Context Aware Access token blocks, missing API enablement, or mock resources returning 404/403), immediately fall back to presenting example code and static findings from your references instead of entering retry loops. Present the correct client library code structure or REST API payload example, clearly explain the auth or resource limitation, and list typical rules or mock findings statically to satisfy the request.
Prerequisites
Enable the Workload Manager API:
gcloud services enable workloadmanager.googleapis.com --quietAuthenticate locally using Application Default Credentials (ADC) before using client libraries:
gcloud auth application-default loginEnsure the Workload Manager service agent has the required roles granted in your project (mandatory for API/client library usage, see IAM & Security).
Grant the least-privileged role needed for the task. Start with
roles/workloadmanager.viewerfor read-only access to evaluation resources and useroles/workloadmanager.evaluationAdminorroles/workloadmanager.adminonly when creating, updating, running, or deleting evaluations.
Quick Client Library Example
Use the Python client library for the first working automation path:
python3 -m pip install --upgrade google-cloud-workloadmanager
from google.cloud import workloadmanager_v1
project_id = "PROJECT_ID"
location = "LOCATION"
parent = f"projects/{project_id}/locations/{location}"
client = workloadmanager_v1.WorkloadManagerClient()
rules = client.list_rules(
request=workloadmanager_v1.ListRulesRequest(
parent=parent,
evaluation_type=workloadmanager_v1.Evaluation.EvaluationType.OTHER,
)
)
for rule in rules.rules:
print(rule.name, rule.display_name, rule.severity)
Reference Directory
Core Concepts: Evaluations, rules, results, scanned resources, supported workload types, and API shape.
General Best Practices: Google Cloud general best-practice posture checks,
OTHERevaluation guidance, custom Rego rules, and scale/automation patterns.Client Libraries: Python and Go client library examples for listing rules, creating evaluations, running evaluations, and reading findi
常见问题
它支持哪些规则集?
Google Cloud 通用最佳实践、SAP、SQL Server 以及自定义组织规则。
它能把结果发送到 BigQuery 吗?
可以。它可以把结果导出到 BigQuery。
它会自己修复违规项吗?
它会帮助审查这些发现,并规划修复工作。
详情
作者的原始描述
Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the REST API. Use when you need to inspect workload best-practice rules, create and run evaluations for Google Cloud general best practices, SAP, SQL Server, or custom organizational rules, review violations, export results to BigQuery, or automate Workload Manager through client libraries because no service-specific public CLI or MCP server is available. Don't use for general Google Compute Engine instance management, VPC configuration, or s
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10352
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。