Gsc cli automation
Skill bokuwalily/claude-code-skills/skills/gsc-cli-automation
Google Search Consoleをコマンドで操作したい時(サイトマップ送信・検索パフォーマンス取得・URLインデックス状態の検査)。サービスアカウントが弾かれる時のADC(ユーザー認証)フォールバック手順込み。From its SKILL.md
npx -y skills add bokuwalily/claude-code-skills --skill gsc-cli-automationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.8 KB, 812 tokens by cl100k_base, as published. Nobody here has run it
GSC をCLIで操作(googleapis + ADC)
ツール実体: ~/gsc-automation/gsc.mjs()。新規セットアップ時の手順。
Procedure
- 前提:
gcloud(brew install --cask google-cloud-sdk)、node、googleapis。 - GCPプロジェクト作成+Search Console API有効化:
gcloud auth login # ブラウザ同意(ユーザー) PID="gsc-auto-$RANDOM$RANDOM" gcloud projects create "$PID" --name="GSC Automation" gcloud config set project "$PID" gcloud services enable searchconsole.googleapis.com - 認証はADC(ユーザー)が確実(本人が全プロパティ所有なら):
googleapis 側はgcloud auth application-default login \ --scopes=openid,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/webmasters gcloud auth application-default set-quota-project "$PID"new google.auth.GoogleAuth({ scopes:['.../webmasters'] })(keyFile無し)でADCを自動使用。 - 動作確認:
node gsc.mjs sitesで所有プロパティが出れば成功。 node gsc.mjs sync(config.jsonの全sitemap送信)/report/inspectを利用。
Pitfalls
- サービスアカウント方式はGSCの「ユーザー追加」がSAメールを弾く事がある("メールアドレスが見つかりませんでした")。作りたて伝播遅延もあるが、本人所有ならADCユーザー認証の方が確実で各プロパティへのSA追加作業も不要。
- ADCは quota project 未設定だとAPIが quota エラー→
set-quota-project必須。 gcloud iam service-accounts keys createはSA作成直後だとNOT_FOUND(伝播待ち8秒で再試行)。- Indexing APIで一般ページのインデックス強制は禁止(求人/動画限定・スパム判定)。やれるのはsitemap送信+クロール待ち+URL検査(読み取り)。
- siteUrl はURLプレフィックス型なら末尾スラッシュ必須。
- GSC未登録プロパティはAPI操作不可("sufficient permission"エラー)→先にプロパティ追加+所有権確認(HTMLファイル方式が楽)。
- 秘密: SAキー/ADC credentialは絶対コミットしない。
~/.config/配下・chmod 600。
Verification
node gsc.mjs sites で siteOwner 表示。inspect <site> <page> で coverage=Submitted and indexed ならインデックス済確認。
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.