origin-gcp-project-setup

Configure keyless GCP service account impersonation and per-repo ADC isolation for repositories.

Updated Dec 9, 2025
One-click install
npx skills add https://github.com/Aki2022/skills --skill origin-gcp-project-setup-aki2022
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: origin-gcp-project-setup
Source: https://github.com/Aki2022/skills/tree/main/origin-gcp-project-setup
Command: npx skills add https://github.com/Aki2022/skills --skill origin-gcp-project-setup-aki2022

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Setting up a new repository against a multi-project GCP environment normally involves juggling service account keys, conflicting global ADC files, and confusing CLI-versus-SDK authentication paths. This Skill automates keyless impersonation-based setup so that simply running cd into a repository activates the correct GCP identity for both gcloud/bq CLI and Node/Python SDKs. ## Core Features & Use Cases - Keyless Service Account Setup: Creates a service account, grants minimal IAM roles (BigQuery, GCS, Vertex AI), and configures TokenCreator impersonation without storing SA keys on disk. - Per-Repo ADC Isolation: Generates a dedicated ADC file per repository and wires it through .mise.toml via GOOGLE_APPLICATION_CREDENTIALS, preventing cross-repo credential collisions. - Re-authentication Recovery: Provides re-auth.sh and refresh_adc.sh to recover from RAPT/refresh_token expiry and regenerate all per-repo ADCs in one command, with optional Google Ads OAuth renewal. - Use Case: You create a new repo effectuation_score that must query BigQuery in the innovation-score project. The Skill creates the SA, grants roles, writes .mise.toml, generates the per-repo ADC, and verifies both CLI and SDK run as the service account. ## Quick Start Ask the assistant to set up the repository with its GCP project, for example: set up the effectuation_score repository with the innovation-score GCP project using keyless impersonation.

Frequently Asked Questions about origin-gcp-project-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up GCP authentication for a new repository without service account keys?

Use service account impersonation: create a service account, grant it minimal roles, give your user account the TokenCreator role, and set CLOUDSDK_AUTH_IMPERSONATE_SERVICE_ACCOUNT in .mise.toml. No SA JSON key is ever written to disk.

Why does my Python or Node SDK ignore the impersonation setting that works for gcloud CLI?

CLOUDSDK_AUTH_IMPERSONATE_SERVICE_ACCOUNT is only read by gcloud/bq CLI; Google SDKs read the ADC file instead. Generate a per-repo ADC and point GOOGLE_APPLICATION_CREDENTIALS at it in .mise.toml so SDKs also run as the service account.

How do I fix invalid_rapt or expired ADC errors in gcloud?

Run the re-auth.sh script, which performs gcloud auth login --update-adc in a temporary CLOUDSDK_CONFIG and regenerates all per-repo ADCs in one pass. Add the --ads flag if Google Ads OAuth also needs renewal.

Can multiple repositories use different GCP service accounts on the same machine?

Yes, by isolating ADC per repository. Each repo gets its own ADC file under ~/.config/gcloud, and mise switches GOOGLE_APPLICATION_CREDENTIALS automatically when you cd into the repo, avoiding global ADC collisions.

Why does bq query fail with serviceusage permission errors after setup?

The service account lacks roles/serviceusage.serviceUsageConsumer, which is required when SDKs or quota projects call APIs. Grant it alongside bigquery.dataEditor and bigquery.jobUser, since dataEditor alone cannot run queries.