@mison/ag-kit-cn 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/.agent/ARCHITECTURE.md +285 -0
- package/.agent/agents/backend-specialist.md +268 -0
- package/.agent/agents/code-archaeologist.md +106 -0
- package/.agent/agents/database-architect.md +225 -0
- package/.agent/agents/debugger.md +225 -0
- package/.agent/agents/devops-engineer.md +242 -0
- package/.agent/agents/documentation-writer.md +104 -0
- package/.agent/agents/explorer-agent.md +73 -0
- package/.agent/agents/frontend-specialist.md +618 -0
- package/.agent/agents/game-developer.md +162 -0
- package/.agent/agents/mobile-developer.md +382 -0
- package/.agent/agents/orchestrator.md +438 -0
- package/.agent/agents/penetration-tester.md +188 -0
- package/.agent/agents/performance-optimizer.md +187 -0
- package/.agent/agents/product-manager.md +112 -0
- package/.agent/agents/product-owner.md +95 -0
- package/.agent/agents/project-planner.md +405 -0
- package/.agent/agents/qa-automation-engineer.md +103 -0
- package/.agent/agents/security-auditor.md +170 -0
- package/.agent/agents/seo-specialist.md +111 -0
- package/.agent/agents/test-engineer.md +158 -0
- package/.agent/mcp_config.json +12 -0
- package/.agent/rules/GEMINI.md +273 -0
- package/.agent/scripts/auto_preview.py +148 -0
- package/.agent/scripts/checklist.py +217 -0
- package/.agent/scripts/session_manager.py +120 -0
- package/.agent/scripts/verify_all.py +327 -0
- package/.agent/skills/api-patterns/SKILL.md +84 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +74 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/architecture/SKILL.md +57 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/bash-linux/SKILL.md +201 -0
- package/.agent/skills/behavioral-modes/SKILL.md +264 -0
- package/.agent/skills/brainstorming/SKILL.md +164 -0
- package/.agent/skills/brainstorming/dynamic-questioning.md +359 -0
- package/.agent/skills/clean-code/SKILL.md +200 -0
- package/.agent/skills/code-review-checklist/SKILL.md +125 -0
- package/.agent/skills/database-design/SKILL.md +54 -0
- package/.agent/skills/database-design/database-selection.md +43 -0
- package/.agent/skills/database-design/indexing.md +39 -0
- package/.agent/skills/database-design/migrations.md +50 -0
- package/.agent/skills/database-design/optimization.md +36 -0
- package/.agent/skills/database-design/orm-selection.md +30 -0
- package/.agent/skills/database-design/schema-design.md +56 -0
- package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
- package/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/documentation-templates/SKILL.md +194 -0
- package/.agent/skills/frontend-design/SKILL.md +418 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +307 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +727 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +1118 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +155 -0
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/intelligent-routing/SKILL.md +335 -0
- package/.agent/skills/lint-and-validate/SKILL.md +44 -0
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/mobile-design/SKILL.md +394 -0
- package/.agent/skills/mobile-design/decision-trees.md +516 -0
- package/.agent/skills/mobile-design/mobile-backend.md +491 -0
- package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
- package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
- package/.agent/skills/mobile-design/mobile-design-thinking.md +355 -0
- package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
- package/.agent/skills/mobile-design/mobile-performance.md +767 -0
- package/.agent/skills/mobile-design/mobile-testing.md +356 -0
- package/.agent/skills/mobile-design/mobile-typography.md +432 -0
- package/.agent/skills/mobile-design/platform-android.md +666 -0
- package/.agent/skills/mobile-design/platform-ios.md +561 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.agent/skills/mobile-design/touch-psychology.md +537 -0
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +311 -0
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +241 -0
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +489 -0
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +263 -0
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +431 -0
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +683 -0
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +149 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +286 -0
- package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.agent/skills/parallel-agents/SKILL.md +194 -0
- package/.agent/skills/performance-profiling/SKILL.md +149 -0
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.agent/skills/plan-writing/SKILL.md +152 -0
- package/.agent/skills/powershell-windows/SKILL.md +166 -0
- package/.agent/skills/python-patterns/SKILL.md +441 -0
- package/.agent/skills/red-team-tactics/SKILL.md +203 -0
- package/.agent/skills/rust-pro/SKILL.md +190 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +135 -0
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +215 -0
- package/.agent/skills/server-management/SKILL.md +161 -0
- package/.agent/skills/systematic-debugging/SKILL.md +114 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
- package/.agent/skills/tdd-workflow/SKILL.md +149 -0
- package/.agent/skills/testing-patterns/SKILL.md +178 -0
- package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.agent/skills/vulnerability-scanner/checklists.md +131 -0
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +459 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
- package/.agent/skills/webapp-testing/SKILL.md +187 -0
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +242 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +80 -0
- package/.agent/workflows/restore-localize-compat.md +525 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +295 -0
- package/AGENT_FLOW.md +609 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +260 -0
- package/bin/adapters/base.js +63 -0
- package/bin/adapters/codex.js +391 -0
- package/bin/adapters/gemini.js +137 -0
- package/bin/ag-kit.js +1336 -0
- package/bin/core/builder.js +80 -0
- package/bin/core/generator.js +59 -0
- package/bin/core/resource-loader.js +64 -0
- package/bin/core/transformer.js +208 -0
- package/bin/interactive.js +65 -0
- package/bin/utils/atomic-writer.js +97 -0
- package/bin/utils/git-helper.js +68 -0
- package/bin/utils/managed-block.js +65 -0
- package/bin/utils/manifest.js +241 -0
- package/bin/utils.js +82 -0
- package/docs/codex-rules-template.md +36 -0
- package/docs/mapping-spec.md +68 -0
- package/docs/multi-target-adapter.md +80 -0
- package/docs/official/README.md +53 -0
- package/docs/official/antigravity/agent-modes-settings.md +64 -0
- package/docs/official/antigravity/rules-workflows.md +96 -0
- package/docs/official/antigravity/skills.md +147 -0
- package/docs/official/codex/agents-md.md +119 -0
- package/docs/official/codex/config-advanced.md +358 -0
- package/docs/official/codex/config-basic.md +141 -0
- package/docs/official/codex/config-reference.md +223 -0
- package/docs/official/codex/config-sample.md +216 -0
- package/docs/official/codex/mcp.md +107 -0
- package/docs/official/codex/rules.md +79 -0
- package/docs/official/codex/skills.md +114 -0
- package/docs/official/sources-index.md +32 -0
- package/docs/operations.md +145 -0
- package/docs/terminology-style-guide.md +69 -0
- package/package.json +51 -0
- package/scripts/postinstall-check.js +112 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-fundamentals
|
|
3
|
+
description: 针对 AI 搜索引擎(ChatGPT、Claude、Perplexity)的生成式引擎优化。
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GEO 基础
|
|
8
|
+
|
|
9
|
+
> 针对 AI 驱动型搜索引擎的优化。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. 什么是 GEO?
|
|
14
|
+
|
|
15
|
+
**GEO** = Generative Engine Optimization(生成式引擎优化)
|
|
16
|
+
|
|
17
|
+
| 目标 | 涉及平台 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| 在 AI 的回答中被引用 | ChatGPT、Claude、Perplexity、Gemini |
|
|
20
|
+
|
|
21
|
+
### SEO 与 GEO 对比
|
|
22
|
+
|
|
23
|
+
| 维度 | SEO | GEO |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| 目标 | 排名第一 | 被 AI 引用 |
|
|
26
|
+
| 平台 | Google | AI 引擎 |
|
|
27
|
+
| 指标 | 排名、CTR | 引用率 |
|
|
28
|
+
| 核心 | 关键词 | 实体、数据 |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. AI 引擎版图
|
|
33
|
+
|
|
34
|
+
| 引擎 | 引用样式 | 机遇 |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| **Perplexity** | 编号样式 [1][2] | 引用率最高 |
|
|
37
|
+
| **ChatGPT** | 行内/脚注 | 自定义 GPTs |
|
|
38
|
+
| **Claude** | 上下文关联 | 长文本内容 |
|
|
39
|
+
| **Gemini** | 来源板块 | 与 SEO 有交集 |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 3. RAG 检索因子
|
|
44
|
+
|
|
45
|
+
AI 引擎如何选择要引用的内容:
|
|
46
|
+
|
|
47
|
+
| 因子 | 权重(估算) |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| 语义相关性 | ~40% |
|
|
50
|
+
| 关键词匹配 | ~20% |
|
|
51
|
+
| 权威性信号 | ~15% |
|
|
52
|
+
| 时效性 | ~10% |
|
|
53
|
+
| 来源多样性 | ~15% |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 4. 易被引用的内容类型
|
|
58
|
+
|
|
59
|
+
| 元素 | 作用原则 |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| **原创统计数据** | 独特、可引用的数据 |
|
|
62
|
+
| **专家语录** | 权重转移 |
|
|
63
|
+
| **清晰的定义** | 易于被提取 |
|
|
64
|
+
| **分步指南** | 提供可操作价值 |
|
|
65
|
+
| **对比表格** | 结构化信息 |
|
|
66
|
+
| **FAQ 常见问题** | 直接给出答案 |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 5. GEO 内容检查清单
|
|
71
|
+
|
|
72
|
+
### 内容元素
|
|
73
|
+
|
|
74
|
+
- [ ] 基于问题的标题
|
|
75
|
+
- [ ] 顶部包含摘要/TL;DR
|
|
76
|
+
- [ ] 带有来源说明的原创数据
|
|
77
|
+
- [ ] 专家语录(姓名、头衔)
|
|
78
|
+
- [ ] FAQ 章节(3-5 个问答)
|
|
79
|
+
- [ ] 清晰的定义
|
|
80
|
+
- [ ] “最后更新”时间戳
|
|
81
|
+
- [ ] 作者附带资质说明
|
|
82
|
+
|
|
83
|
+
### 技术元素
|
|
84
|
+
|
|
85
|
+
- [ ] 含日期的 Article schema(结构化数据)
|
|
86
|
+
- [ ] 作者的 Person schema
|
|
87
|
+
- [ ] FAQPage schema
|
|
88
|
+
- [ ] 极速加载(< 2.5s)
|
|
89
|
+
- [ ] 整洁的 HTML 结构
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 6. 实体构建
|
|
94
|
+
|
|
95
|
+
| 动作 | 目的 |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| Google 知识面板(Knowledge Panel) | 实现实体识别 |
|
|
98
|
+
| 维基百科(如具备知名度) | 建立权威来源 |
|
|
99
|
+
| 全网信息保持一致 | 实体整合 |
|
|
100
|
+
| 行业媒体提及 | 增强权威信号 |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 7. AI 爬虫访问
|
|
105
|
+
|
|
106
|
+
### 关键 AI User-Agent
|
|
107
|
+
|
|
108
|
+
| 爬虫 | 对应引擎 |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| GPTBot | ChatGPT/OpenAI |
|
|
111
|
+
| Claude-Web | Claude |
|
|
112
|
+
| PerplexityBot | Perplexity |
|
|
113
|
+
| Googlebot | Gemini(共享) |
|
|
114
|
+
|
|
115
|
+
### 访问决策
|
|
116
|
+
|
|
117
|
+
| 策略 | 适用场景 |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| 允许所有 | 渴望获得 AI 引用 |
|
|
120
|
+
| 屏蔽 GPTBot | 不希望被用于 OpenAI 训练 |
|
|
121
|
+
| 选择性允许 | 允许部分、屏蔽其他 |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 8. 效果衡量
|
|
126
|
+
|
|
127
|
+
| 指标 | 追踪方式 |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| AI 引用量 | 手动监控 |
|
|
130
|
+
| “According to [品牌]” 提及量 | 在 AI 中检索 |
|
|
131
|
+
| 竞品引用量 | 对比占有率 |
|
|
132
|
+
| AI 引流流量 | 使用 UTM 参数 |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 9. 反模式
|
|
137
|
+
|
|
138
|
+
| ❌ 禁止 | ✅ 推荐 |
|
|
139
|
+
| --- | --- |
|
|
140
|
+
| 发布不带日期的内容 | 添加时间戳 |
|
|
141
|
+
| 模糊的来源引用 | 明确标注来源名称 |
|
|
142
|
+
| 忽略作者信息 | 展示其资质背景 |
|
|
143
|
+
| 内容空洞 | 全面覆盖 |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
> **记住:** AI 会引用清晰、权威且易于提取的内容。努力成为最好的答案。
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 脚本
|
|
152
|
+
|
|
153
|
+
| 脚本 | 用途 | 执行命令 |
|
|
154
|
+
| --- | --- | --- |
|
|
155
|
+
| `scripts/geo_checker.py` | GEO 审计(AI 引用就绪度) | `python scripts/geo_checker.py <project_path>` |
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
GEO Checker - Generative Engine Optimization Audit
|
|
4
|
+
Checks PUBLIC WEB CONTENT for AI citation readiness.
|
|
5
|
+
|
|
6
|
+
PURPOSE:
|
|
7
|
+
- Analyze pages that will be INDEXED by AI engines (ChatGPT, Perplexity, etc.)
|
|
8
|
+
- Check for structured data, author info, dates, FAQ sections
|
|
9
|
+
- Help content rank in AI-generated answers
|
|
10
|
+
|
|
11
|
+
WHAT IT CHECKS:
|
|
12
|
+
- HTML files (actual web pages)
|
|
13
|
+
- JSX/TSX files (React page components)
|
|
14
|
+
- NOT markdown files (those are developer docs, not public content)
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
python geo_checker.py <project_path>
|
|
18
|
+
"""
|
|
19
|
+
import sys
|
|
20
|
+
import re
|
|
21
|
+
import json
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
# Fix Windows console encoding
|
|
25
|
+
try:
|
|
26
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
27
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
28
|
+
except AttributeError:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Directories to skip (not public content)
|
|
33
|
+
SKIP_DIRS = {
|
|
34
|
+
'node_modules', '.next', 'dist', 'build', '.git', '.github',
|
|
35
|
+
'__pycache__', '.vscode', '.idea', 'coverage', 'test', 'tests',
|
|
36
|
+
'__tests__', 'spec', 'docs', 'documentation'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Files to skip (not public pages)
|
|
40
|
+
SKIP_FILES = {
|
|
41
|
+
'jest.config', 'webpack.config', 'vite.config', 'tsconfig',
|
|
42
|
+
'package.json', 'package-lock', 'yarn.lock', '.eslintrc',
|
|
43
|
+
'tailwind.config', 'postcss.config', 'next.config'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def is_page_file(file_path: Path) -> bool:
|
|
48
|
+
"""Check if this file is likely a public-facing page."""
|
|
49
|
+
name = file_path.stem.lower()
|
|
50
|
+
|
|
51
|
+
# Skip config/utility files
|
|
52
|
+
if any(skip in name for skip in SKIP_FILES):
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
# Skip test files
|
|
56
|
+
if name.endswith('.test') or name.endswith('.spec'):
|
|
57
|
+
return False
|
|
58
|
+
if name.startswith('test_') or name.startswith('spec_'):
|
|
59
|
+
return False
|
|
60
|
+
|
|
61
|
+
# Likely page indicators
|
|
62
|
+
page_indicators = ['page', 'index', 'home', 'about', 'contact', 'blog',
|
|
63
|
+
'post', 'article', 'product', 'service', 'landing']
|
|
64
|
+
|
|
65
|
+
# Check if it's in a pages/app directory (Next.js, etc.)
|
|
66
|
+
parts = [p.lower() for p in file_path.parts]
|
|
67
|
+
if 'pages' in parts or 'app' in parts or 'routes' in parts:
|
|
68
|
+
return True
|
|
69
|
+
|
|
70
|
+
# Check filename indicators
|
|
71
|
+
if any(ind in name for ind in page_indicators):
|
|
72
|
+
return True
|
|
73
|
+
|
|
74
|
+
# HTML files are usually pages
|
|
75
|
+
if file_path.suffix.lower() == '.html':
|
|
76
|
+
return True
|
|
77
|
+
|
|
78
|
+
return False
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def find_web_pages(project_path: Path) -> list:
|
|
82
|
+
"""Find public-facing web pages only."""
|
|
83
|
+
patterns = ['**/*.html', '**/*.htm', '**/*.jsx', '**/*.tsx']
|
|
84
|
+
|
|
85
|
+
files = []
|
|
86
|
+
for pattern in patterns:
|
|
87
|
+
for f in project_path.glob(pattern):
|
|
88
|
+
# Skip excluded directories
|
|
89
|
+
if any(skip in f.parts for skip in SKIP_DIRS):
|
|
90
|
+
continue
|
|
91
|
+
|
|
92
|
+
# Check if it's likely a page
|
|
93
|
+
if is_page_file(f):
|
|
94
|
+
files.append(f)
|
|
95
|
+
|
|
96
|
+
return files[:30] # Limit to 30 pages
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def check_page(file_path: Path) -> dict:
|
|
100
|
+
"""Check a single web page for GEO elements."""
|
|
101
|
+
try:
|
|
102
|
+
content = file_path.read_text(encoding='utf-8', errors='ignore')
|
|
103
|
+
except Exception as e:
|
|
104
|
+
return {'file': str(file_path.name), 'passed': [], 'issues': [f"Error: {e}"], 'score': 0}
|
|
105
|
+
|
|
106
|
+
issues = []
|
|
107
|
+
passed = []
|
|
108
|
+
|
|
109
|
+
# 1. JSON-LD Structured Data (Critical for AI)
|
|
110
|
+
if 'application/ld+json' in content:
|
|
111
|
+
passed.append("JSON-LD structured data found")
|
|
112
|
+
if '"@type"' in content:
|
|
113
|
+
if 'Article' in content:
|
|
114
|
+
passed.append("Article schema present")
|
|
115
|
+
if 'FAQPage' in content:
|
|
116
|
+
passed.append("FAQ schema present")
|
|
117
|
+
if 'Organization' in content or 'Person' in content:
|
|
118
|
+
passed.append("Entity schema present")
|
|
119
|
+
else:
|
|
120
|
+
issues.append("No JSON-LD structured data (AI engines prefer structured content)")
|
|
121
|
+
|
|
122
|
+
# 2. Heading Structure
|
|
123
|
+
h1_count = len(re.findall(r'<h1[^>]*>', content, re.I))
|
|
124
|
+
h2_count = len(re.findall(r'<h2[^>]*>', content, re.I))
|
|
125
|
+
|
|
126
|
+
if h1_count == 1:
|
|
127
|
+
passed.append("Single H1 heading (clear topic)")
|
|
128
|
+
elif h1_count == 0:
|
|
129
|
+
issues.append("No H1 heading - page topic unclear")
|
|
130
|
+
else:
|
|
131
|
+
issues.append(f"Multiple H1 headings ({h1_count}) - confusing for AI")
|
|
132
|
+
|
|
133
|
+
if h2_count >= 2:
|
|
134
|
+
passed.append(f"{h2_count} H2 subheadings (good structure)")
|
|
135
|
+
else:
|
|
136
|
+
issues.append("Add more H2 subheadings for scannable content")
|
|
137
|
+
|
|
138
|
+
# 3. Author Attribution (E-E-A-T signal)
|
|
139
|
+
author_patterns = ['author', 'byline', 'written-by', 'contributor', 'rel="author"']
|
|
140
|
+
has_author = any(p in content.lower() for p in author_patterns)
|
|
141
|
+
if has_author:
|
|
142
|
+
passed.append("Author attribution found")
|
|
143
|
+
else:
|
|
144
|
+
issues.append("No author info (AI prefers attributed content)")
|
|
145
|
+
|
|
146
|
+
# 4. Publication Date (Freshness signal)
|
|
147
|
+
date_patterns = ['datePublished', 'dateModified', 'datetime=', 'pubdate', 'article:published']
|
|
148
|
+
has_date = any(re.search(p, content, re.I) for p in date_patterns)
|
|
149
|
+
if has_date:
|
|
150
|
+
passed.append("Publication date found")
|
|
151
|
+
else:
|
|
152
|
+
issues.append("No publication date (freshness matters for AI)")
|
|
153
|
+
|
|
154
|
+
# 5. FAQ Section (Highly citable)
|
|
155
|
+
faq_patterns = [r'<details', r'faq', r'frequently.?asked', r'"FAQPage"']
|
|
156
|
+
has_faq = any(re.search(p, content, re.I) for p in faq_patterns)
|
|
157
|
+
if has_faq:
|
|
158
|
+
passed.append("FAQ section detected (highly citable)")
|
|
159
|
+
|
|
160
|
+
# 6. Lists (Structured content)
|
|
161
|
+
list_count = len(re.findall(r'<(ul|ol)[^>]*>', content, re.I))
|
|
162
|
+
if list_count >= 2:
|
|
163
|
+
passed.append(f"{list_count} lists (structured content)")
|
|
164
|
+
|
|
165
|
+
# 7. Tables (Comparison data)
|
|
166
|
+
table_count = len(re.findall(r'<table[^>]*>', content, re.I))
|
|
167
|
+
if table_count >= 1:
|
|
168
|
+
passed.append(f"{table_count} table(s) (comparison data)")
|
|
169
|
+
|
|
170
|
+
# 8. Entity Recognition (E-E-A-T signal) - NEW 2025
|
|
171
|
+
entity_patterns = [
|
|
172
|
+
r'"@type"\s*:\s*"Organization"',
|
|
173
|
+
r'"@type"\s*:\s*"LocalBusiness"',
|
|
174
|
+
r'"@type"\s*:\s*"Brand"',
|
|
175
|
+
r'itemtype.*schema\.org/(Organization|Person|Brand)',
|
|
176
|
+
r'rel="author"'
|
|
177
|
+
]
|
|
178
|
+
has_entity = any(re.search(p, content, re.I) for p in entity_patterns)
|
|
179
|
+
if has_entity:
|
|
180
|
+
passed.append("Entity/Brand recognition (E-E-A-T)")
|
|
181
|
+
|
|
182
|
+
# 9. Original Statistics/Data (AI citation magnet) - NEW 2025
|
|
183
|
+
stat_patterns = [
|
|
184
|
+
r'\d+%', # Percentages
|
|
185
|
+
r'\$[\d,]+', # Dollar amounts
|
|
186
|
+
r'study\s+(shows|found)', # Research citations
|
|
187
|
+
r'according to', # Source attribution
|
|
188
|
+
r'data\s+(shows|reveals)', # Data-backed claims
|
|
189
|
+
r'\d+x\s+(faster|better|more)', # Comparison stats
|
|
190
|
+
r'(million|billion|trillion)', # Large numbers
|
|
191
|
+
]
|
|
192
|
+
stat_matches = sum(1 for p in stat_patterns if re.search(p, content, re.I))
|
|
193
|
+
if stat_matches >= 2:
|
|
194
|
+
passed.append("Original statistics/data (citation magnet)")
|
|
195
|
+
|
|
196
|
+
# 10. Conversational/Direct answers - NEW 2025
|
|
197
|
+
direct_answer_patterns = [
|
|
198
|
+
r'is defined as',
|
|
199
|
+
r'refers to',
|
|
200
|
+
r'means that',
|
|
201
|
+
r'the answer is',
|
|
202
|
+
r'in short,',
|
|
203
|
+
r'simply put,',
|
|
204
|
+
r'<dfn'
|
|
205
|
+
]
|
|
206
|
+
has_direct = any(re.search(p, content, re.I) for p in direct_answer_patterns)
|
|
207
|
+
if has_direct:
|
|
208
|
+
passed.append("Direct answer patterns (LLM-friendly)")
|
|
209
|
+
|
|
210
|
+
# Calculate score
|
|
211
|
+
total = len(passed) + len(issues)
|
|
212
|
+
score = (len(passed) / total * 100) if total > 0 else 0
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
'file': str(file_path.name),
|
|
216
|
+
'passed': passed,
|
|
217
|
+
'issues': issues,
|
|
218
|
+
'score': round(score)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def main():
|
|
223
|
+
target = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
224
|
+
target_path = Path(target).resolve()
|
|
225
|
+
|
|
226
|
+
print("\n" + "=" * 60)
|
|
227
|
+
print(" GEO CHECKER - AI Citation Readiness Audit")
|
|
228
|
+
print("=" * 60)
|
|
229
|
+
print(f"Project: {target_path}")
|
|
230
|
+
print("-" * 60)
|
|
231
|
+
|
|
232
|
+
# Find web pages only
|
|
233
|
+
pages = find_web_pages(target_path)
|
|
234
|
+
|
|
235
|
+
if not pages:
|
|
236
|
+
print("\n[!] No public web pages found.")
|
|
237
|
+
print(" Looking for: HTML, JSX, TSX files in pages/app directories")
|
|
238
|
+
print(" Skipping: docs, tests, config files, node_modules")
|
|
239
|
+
output = {"script": "geo_checker", "pages_found": 0, "passed": True}
|
|
240
|
+
print("\n" + json.dumps(output, indent=2))
|
|
241
|
+
sys.exit(0)
|
|
242
|
+
|
|
243
|
+
print(f"Found {len(pages)} public pages to analyze\n")
|
|
244
|
+
|
|
245
|
+
# Check each page
|
|
246
|
+
results = []
|
|
247
|
+
for page in pages:
|
|
248
|
+
result = check_page(page)
|
|
249
|
+
results.append(result)
|
|
250
|
+
|
|
251
|
+
# Print results
|
|
252
|
+
for result in results:
|
|
253
|
+
status = "[OK]" if result['score'] >= 60 else "[!]"
|
|
254
|
+
print(f"{status} {result['file']}: {result['score']}%")
|
|
255
|
+
if result['issues'] and result['score'] < 60:
|
|
256
|
+
for issue in result['issues'][:2]: # Show max 2 issues
|
|
257
|
+
print(f" - {issue}")
|
|
258
|
+
|
|
259
|
+
# Average score
|
|
260
|
+
avg_score = sum(r['score'] for r in results) / len(results) if results else 0
|
|
261
|
+
|
|
262
|
+
print("\n" + "=" * 60)
|
|
263
|
+
print(f"AVERAGE GEO SCORE: {avg_score:.0f}%")
|
|
264
|
+
print("=" * 60)
|
|
265
|
+
|
|
266
|
+
if avg_score >= 80:
|
|
267
|
+
print("[OK] Excellent - Content well-optimized for AI citations")
|
|
268
|
+
elif avg_score >= 60:
|
|
269
|
+
print("[OK] Good - Some improvements recommended")
|
|
270
|
+
elif avg_score >= 40:
|
|
271
|
+
print("[!] Needs work - Add structured elements")
|
|
272
|
+
else:
|
|
273
|
+
print("[X] Poor - Content needs GEO optimization")
|
|
274
|
+
|
|
275
|
+
# JSON output
|
|
276
|
+
output = {
|
|
277
|
+
"script": "geo_checker",
|
|
278
|
+
"project": str(target_path),
|
|
279
|
+
"pages_checked": len(results),
|
|
280
|
+
"average_score": round(avg_score),
|
|
281
|
+
"passed": avg_score >= 60
|
|
282
|
+
}
|
|
283
|
+
print("\n" + json.dumps(output, indent=2))
|
|
284
|
+
|
|
285
|
+
sys.exit(0 if avg_score >= 60 else 1)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
if __name__ == "__main__":
|
|
289
|
+
main()
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: i18n-localization
|
|
3
|
+
description: 国际化与本地化模式。包含硬编码字符串检测、翻译管理、语言文件与 RTL 支持。
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# i18n 与本地化
|
|
8
|
+
|
|
9
|
+
> 国际化(i18n)与本地化(L10n)最佳实践。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. 核心概念
|
|
14
|
+
|
|
15
|
+
| 术语 | 含义 |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| **i18n** | Internationalization(国际化)—— 使应用具备可翻译性 |
|
|
18
|
+
| **L10n** | Localization(本地化)—— 实际的翻译实施过程 |
|
|
19
|
+
| **Locale** | 语言 + 地区(例如:en-US, tr-TR) |
|
|
20
|
+
| **RTL** | Right-to-left(从右向左语言,如阿拉伯语、希伯来语) |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. 何时使用 i18n
|
|
25
|
+
|
|
26
|
+
| 项目类型 | 是否需要 i18n? |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| 公共 Web 应用 | ✅ 是 |
|
|
29
|
+
| SaaS 产品 | ✅ 是 |
|
|
30
|
+
| 内部工具 | ⚠️ 视情况而定 |
|
|
31
|
+
| 单一地区应用 | ⚠️ 考虑未来扩展 |
|
|
32
|
+
| 个人项目 | ❌ 可选 |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 3. 实现模式
|
|
37
|
+
|
|
38
|
+
### React(react-i18next)
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useTranslation } from 'react-i18next';
|
|
42
|
+
|
|
43
|
+
function Welcome() {
|
|
44
|
+
const { t } = useTranslation();
|
|
45
|
+
return <h1>{t('welcome.title')}</h1>;
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Next.js(next-intl)
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useTranslations } from 'next-intl';
|
|
53
|
+
|
|
54
|
+
export default function Page() {
|
|
55
|
+
const t = useTranslations('Home');
|
|
56
|
+
return <h1>{t('title')}</h1>;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Python(gettext)
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from gettext import gettext as _
|
|
64
|
+
|
|
65
|
+
print(_("Welcome to our app"))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4. 文件结构
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
locales/
|
|
74
|
+
├── en/
|
|
75
|
+
│ ├── common.json
|
|
76
|
+
│ ├── auth.json
|
|
77
|
+
│ └── errors.json
|
|
78
|
+
├── tr/
|
|
79
|
+
│ ├── common.json
|
|
80
|
+
│ ├── auth.json
|
|
81
|
+
│ └── errors.json
|
|
82
|
+
└── ar/ # RTL
|
|
83
|
+
└── ...
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 5. 最佳实践
|
|
89
|
+
|
|
90
|
+
### 推荐 ✅
|
|
91
|
+
|
|
92
|
+
- 使用翻译键值,而非原始文本
|
|
93
|
+
- 按功能模块对翻译进行命名空间划分
|
|
94
|
+
- 支持复数形式
|
|
95
|
+
- 根据不同地区处理日期/数字格式
|
|
96
|
+
- 从项目开始就规划 RTL 支持
|
|
97
|
+
- 对复杂字符串使用 ICU 消息格式
|
|
98
|
+
|
|
99
|
+
### 避免 ❌
|
|
100
|
+
|
|
101
|
+
- 在组件中硬编码字符串
|
|
102
|
+
- 将多个翻译片段手动拼接
|
|
103
|
+
- 假设文本长度一致(德语通常比英语长 30%)
|
|
104
|
+
- 忘记考虑 RTL 布局
|
|
105
|
+
- 在同一个文件中混用不同语言
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 6. 常见问题
|
|
110
|
+
|
|
111
|
+
| 问题 | 解决方案 |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| 缺少翻译 | 回退到默认语言 |
|
|
114
|
+
| 硬编码字符串 | 使用 Linter/检查脚本 |
|
|
115
|
+
| 日期格式 | 使用 Intl.DateTimeFormat |
|
|
116
|
+
| 数字格式 | 使用 Intl.NumberFormat |
|
|
117
|
+
| 复数逻辑 | 使用 ICU 消息格式 |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 7. RTL 支持
|
|
122
|
+
|
|
123
|
+
```css
|
|
124
|
+
/* CSS Logical Properties */
|
|
125
|
+
.container {
|
|
126
|
+
margin-inline-start: 1rem; /* Not margin-left */
|
|
127
|
+
padding-inline-end: 1rem; /* Not padding-right */
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[dir="rtl"] .icon {
|
|
131
|
+
transform: scaleX(-1);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 8. 检查清单
|
|
138
|
+
|
|
139
|
+
在正式发布前:
|
|
140
|
+
|
|
141
|
+
- [ ] 所有面向用户的字符串都使用了翻译键值
|
|
142
|
+
- [ ] 所有支持的语言都有对应的本地化文件
|
|
143
|
+
- [ ] 日期/数字格式化使用了 Intl API
|
|
144
|
+
- [ ] RTL 布局已测试(如适用)
|
|
145
|
+
- [ ] 已配置默认回退语言
|
|
146
|
+
- [ ] 组件中没有硬编码字符串
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 脚本
|
|
151
|
+
|
|
152
|
+
| 脚本 | 用途 | 执行命令 |
|
|
153
|
+
| --- | --- | --- |
|
|
154
|
+
| `scripts/i18n_checker.py` | 检测硬编码字符串与缺失翻译 | `python scripts/i18n_checker.py <project_path>` |
|