你会建立什么
这篇教学会把 Gemini CLI 变成一个初学者真的跑得起来的 SEO/GEO 终端机工作区。你会建立资料夹、加入提示词库、保存搜寻资料汇出档、请 Gemini CLI 产生唯读报告,并先理解什么叫做「成功」,再让工具碰任何网站档案。
Gemini CLI 适合这个场景,是因为它在终端机 REPL 中运作,可以处理档案、shell 指令,以及偏向 Web/API 的工作流程。对 SEO/GEO 来说,它一开始最适合当资料与监控操作员,而不是视觉化页面编辑器。
完成后,你应该会有这个结构:
seo-geo/
exports/
gsc/
bing/
ga4/
ai-visibility/
prompts/
core-prompts.md
scripts/
crawl-sitemap.mjs
compare-snapshots.mjs
reports/
first-readonly-report.md
图说:先让 Gemini CLI 读资料、写报告、提出下一步,不要一开始就让它修改网站。
开始之前
你需要三样东西:
| 需求 | 初学者替代方案 | 更好的版本 |
|---|---|---|
| Website repo | 有网站档案的任一本机资料夹 | 有 build command 的 Git repo |
| Gemini CLI | 已安装并完成登入 | 已安装并有专案设定 |
| SEO data | 手动 CSV 汇出 | GSC、Bing、GA4、AI 能见度快照 |
如果你没有 API 权限,先用 CSV 档和 Markdown 笔记开始。工作流程是一样的。
步骤 1:建立工作区资料夹
在网站 repository root 执行:
mkdir -p seo-geo/exports/gsc seo-geo/exports/bing seo-geo/exports/ga4 seo-geo/exports/ai-visibility
mkdir -p seo-geo/prompts seo-geo/scripts seo-geo/reports seo-geo/qa
建立提示词库:
cat > seo-geo/prompts/core-prompts.md <<'EOF'
# Core AI visibility prompts
## Category discovery
- What are the best tools for [your category]?
- How do I solve [main problem] for [audience]?
## Brand evaluation
- What does [brand] do?
- Who is [brand] best for?
## Buying comparison
- [brand] vs [competitor]
- Best [category] software for [audience]
EOF
把括号中的内容换成你的真实 category、audience 和 competitors。
步骤 2:加入一个小型资料样本
如果你有 Google Search Console,汇出页面或查询 CSV,存到:
seo-geo/exports/gsc/2026-07-06-pages.csv
如果没有 GSC,就先建立手动档案:
cat > seo-geo/exports/gsc/manual-pages.csv <<'EOF'
url,query,impressions,clicks,ctr,notes
https://example.com/,your category,100,3,3%,homepage query example
https://example.com/blog/example,how to solve problem,50,1,2%,blog example
EOF
AI 能见度可以先建立:
cat > seo-geo/exports/ai-visibility/manual-ai-answers.csv <<'EOF'
prompt,surface,brand_mentioned,citation_url,competitors,notes
best tools for your category,manual,false,,Competitor A;Competitor B,brand missing from category answer
what does brand do,manual,true,https://example.com/about,,answer misses primary audience
EOF
这个小型结构化样本,可以让你在接真实 API 之前先测试流程。
步骤 3:先用唯读模式跑 Gemini CLI
在 repo root 开启 Gemini CLI。第一个 prompt 不应该要求它编辑。
Inspect this repository as a read-only SEO/GEO terminal workspace.
Do not edit files.
Read:
- seo-geo/prompts/core-prompts.md
- seo-geo/exports/gsc/
- seo-geo/exports/bing/
- seo-geo/exports/ga4/
- seo-geo/exports/ai-visibility/
Return:
1. What data exists.
2. What data is missing.
3. Which pages or prompts look most important.
4. What scripts would be useful later.
5. A safe report format for seo-geo/reports/first-readonly-report.md.
好的回答应该会点名你的实际档案。如果它只泛泛谈 SEO,却没有提到 manual-pages.csv 或 core-prompts.md,请停止,要求它重新检查资料夹。
步骤 4:请 Gemini CLI 写第一份报告
Create seo-geo/reports/first-readonly-report.md.
Use only the available exports and prompt library.
Include:
- Data files reviewed
- Top search opportunities
- AI visibility gaps
- Pages that need a future review
- Missing data
- Recommended next action
Do not edit website files.
预期输出:
# First SEO/GEO Read-Only Report
## Data reviewed
- seo-geo/exports/gsc/manual-pages.csv
- seo-geo/exports/ai-visibility/manual-ai-answers.csv
## Top opportunity
| URL | Signal | Why it matters | Next action |
## AI visibility gaps
| Prompt | Brand mentioned? | Citation | Recommended page |
## Missing data
- Bing export missing
- GA4 landing-page export missing
## Next action
Review the homepage for category clarity before editing.
步骤 5:加入简单的 sitemap crawl script
cat > seo-geo/scripts/crawl-sitemap.mjs <<'EOF'
const sitemapUrl = process.argv[2];
if (!sitemapUrl) {
console.error('Usage: node seo-geo/scripts/crawl-sitemap.mjs https://example.com/sitemap.xml');
process.exit(1);
}
console.log(JSON.stringify({ sitemapUrl, status: 'TODO: implement fetch and URL checks' }, null, 2));
EOF
然后问 Gemini CLI:
Review seo-geo/scripts/crawl-sitemap.mjs.
Do not run network requests yet.
Explain how this script should eventually check sitemap URLs, HTTP status, noindex risk, and canonical issues.
步骤 6:定义什么时候可以编辑
cat > seo-geo/qa/gemini-cli-safety.md <<'EOF'
# Gemini CLI SEO/GEO safety rules
Allowed in read-only mode:
- read exports
- summarize snapshots
- write reports under seo-geo/reports/
- propose scripts
Ask before:
- editing website pages
- changing metadata helpers
- changing schema
- changing redirects, robots, canonicals, sitemap, or analytics
Never invent:
- customers
- testimonials
- awards
- revenue numbers
- rankings
- legal claims
EOF
接著 prompt:
Read seo-geo/qa/gemini-cli-safety.md and summarize what you are allowed to do in this project. Do not edit files.
初学者可直接贴上的 prompt
如果你想要最安全的第一次执行,请在网站 repo root 将这段贴进 Gemini CLI:
I want to set up a beginner-safe SEO/GEO workspace in this repo.
Please do only read-only setup and reporting first:
1. Inspect the repo structure.
2. Confirm whether `seo-geo/` folders already exist.
3. Read `seo-geo/prompts/core-prompts.md` and the exports under `seo-geo/exports/` if they exist.
4. Create or update only `seo-geo/reports/first-readonly-report.md`.
5. Do not edit website pages, metadata helpers, schema, redirects, robots.txt, sitemap, analytics, or deployment files.
6. If data is missing, list the exact CSV or snapshot files I should add next.
Return changed files, data gaps, and the first page I should review manually.
步骤 7:成功检查清单
| 检查 | 通过条件 |
|---|---|
| Folder setup |
|
| Prompt library |
|
| Data sample | 至少有一个 CSV 或 AI visibility snapshot |
| Read-only report | Gemini CLI 不改网站档案也能建立报告 |
| Safety rules | 它能摘要哪些东西不能编辑 |
| Next action | 报告点名下一个要人工 review 的页面 |
初学者常见错误
- Gemini CLI 还没读资料,就要求它编辑网站。
- 把 raw credentials 混进 prompts。
- snapshots 没有日期。
- 把单一 AI answer 当成可靠趋势。
- 让 CLI 未经 review 就改 robots、canonicals 或 redirects。
FAQ
Gemini CLI 适合改页面文案吗?
它可以编辑档案,但不是最容易做 visual page diffs 的第一选择。先用它做 terminal reports、data analysis 和 scripts。
第一个 automation 应该是什么?
读 exports 并产生 action queue 的 read-only report。
没有 GSC 或 GA4 也可以吗?
可以。先用 manual CSV files 和 AI answer notes。之后再换成 real exports。
AI coding agents for SEO/GEO 学习路径
这篇属于 Gemini CLI SEO/GEO track。请先完成这些 terminal-focused tutorials,再用 operating model 与 editor / workflow agents 搭配。
- Cursor vs Windsurf vs Gemini CLI:SEO/GEO 自动化怎么选
- 如何设定 Gemini CLI SEO/GEO Automation 工作区
- 如何用 MCP 将 Gemini CLI 接上 SEO 资料
- 如何用 Gemini CLI 做每日 SEO/GEO Monitoring
- 如何用 Gemini CLI Checkpointing 安全修 SEO
- Cursor、Windsurf、Gemini CLI、Codex、Claude Code 的 SEO/GEO 营运模型
下一篇
下一篇: 如何用 MCP 将 Gemini CLI 接上 SEO 资料
Sources and notes
- Gemini CLI documentation: Gemini CLI Docs and MCP servers with Gemini CLI 。
- Related Auspia guide: Cursor vs Windsurf vs Gemini CLI for SEO/GEO Automation 。
Author: Gabriel Finch, Auspia Search Retrieval Researcher,已 review 1,200+ AI Answers。Gabriel 撰写 retrieval systems、AI discovery 与 search infrastructure workflows。