thachvd-kit 1.0.14 → 1.0.16

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.
Files changed (203) hide show
  1. package/.agent/agents/backend-specialist.md +263 -0
  2. package/.agent/agents/code-archaeologist.md +106 -0
  3. package/.agent/agents/database-architect.md +226 -0
  4. package/.agent/agents/debugger.md +225 -0
  5. package/.agent/agents/devops-engineer.md +242 -0
  6. package/.agent/agents/documentation-writer.md +104 -0
  7. package/.agent/agents/explorer-agent.md +73 -0
  8. package/.agent/agents/frontend-specialist.md +593 -0
  9. package/.agent/agents/game-developer.md +162 -0
  10. package/.agent/agents/mobile-developer.md +377 -0
  11. package/.agent/agents/orchestrator.md +416 -0
  12. package/.agent/agents/penetration-tester.md +188 -0
  13. package/.agent/agents/performance-optimizer.md +187 -0
  14. package/.agent/agents/product-manager.md +112 -0
  15. package/.agent/agents/product-owner.md +95 -0
  16. package/.agent/agents/project-planner.md +406 -0
  17. package/.agent/agents/qa-automation-engineer.md +103 -0
  18. package/.agent/agents/security-auditor.md +170 -0
  19. package/.agent/agents/seo-specialist.md +111 -0
  20. package/.agent/agents/test-engineer.md +158 -0
  21. package/.agent/docs/architecture.md +22 -0
  22. package/.agent/docs/conventions.md +21 -0
  23. package/.agent/docs/project.md +40 -0
  24. package/.agent/docs/workflow.md +24 -0
  25. package/.agent/rules/GEMINI.md +45 -0
  26. package/.agent/skills/api-design/SKILL.md +156 -0
  27. package/.agent/skills/api-patterns/SKILL.md +81 -0
  28. package/.agent/skills/api-patterns/api-style.md +42 -0
  29. package/.agent/skills/api-patterns/auth.md +24 -0
  30. package/.agent/skills/api-patterns/documentation.md +26 -0
  31. package/.agent/skills/api-patterns/graphql.md +41 -0
  32. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  33. package/.agent/skills/api-patterns/response.md +37 -0
  34. package/.agent/skills/api-patterns/rest.md +40 -0
  35. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  36. package/.agent/skills/api-patterns/security-testing.md +122 -0
  37. package/.agent/skills/api-patterns/trpc.md +41 -0
  38. package/.agent/skills/api-patterns/versioning.md +22 -0
  39. package/.agent/skills/app-builder/SKILL.md +75 -0
  40. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  41. package/.agent/skills/app-builder/feature-building.md +53 -0
  42. package/.agent/skills/app-builder/project-detection.md +34 -0
  43. package/.agent/skills/app-builder/scaffolding.md +118 -0
  44. package/.agent/skills/app-builder/tech-stack.md +40 -0
  45. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  46. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  47. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  48. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  49. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  50. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  51. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  52. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  53. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  54. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  55. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  56. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  57. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  58. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  59. package/.agent/skills/architecture/SKILL.md +55 -0
  60. package/.agent/skills/architecture/context-discovery.md +43 -0
  61. package/.agent/skills/architecture/examples.md +94 -0
  62. package/.agent/skills/architecture/pattern-selection.md +68 -0
  63. package/.agent/skills/architecture/patterns-reference.md +50 -0
  64. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  65. package/.agent/skills/bash-linux/SKILL.md +199 -0
  66. package/.agent/skills/behavioral-modes/SKILL.md +242 -0
  67. package/.agent/skills/brainstorming/SKILL.md +163 -0
  68. package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  69. package/.agent/skills/clean-code/SKILL.md +201 -0
  70. package/.agent/skills/code-review-checklist/SKILL.md +109 -0
  71. package/.agent/skills/database-design/SKILL.md +52 -0
  72. package/.agent/skills/database-design/database-selection.md +43 -0
  73. package/.agent/skills/database-design/indexing.md +39 -0
  74. package/.agent/skills/database-design/migrations.md +48 -0
  75. package/.agent/skills/database-design/optimization.md +36 -0
  76. package/.agent/skills/database-design/orm-selection.md +30 -0
  77. package/.agent/skills/database-design/schema-design.md +56 -0
  78. package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  79. package/.agent/skills/deployment-procedures/SKILL.md +241 -0
  80. package/.agent/skills/desktop-design/SKILL.md +25 -0
  81. package/.agent/skills/dispatching-parallel-agents/SKILL.md +112 -0
  82. package/.agent/skills/doc.md +177 -0
  83. package/.agent/skills/docker-patterns/SKILL.md +232 -0
  84. package/.agent/skills/documentation-templates/SKILL.md +194 -0
  85. package/.agent/skills/executing-plans/SKILL.md +61 -0
  86. package/.agent/skills/finishing-a-development-branch/SKILL.md +135 -0
  87. package/.agent/skills/frontend-design/SKILL.md +418 -0
  88. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  89. package/.agent/skills/frontend-design/color-system.md +311 -0
  90. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  91. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  92. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  93. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  94. package/.agent/skills/frontend-design/typography-system.md +345 -0
  95. package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  96. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  97. package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  98. package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  99. package/.agent/skills/game-development/SKILL.md +167 -0
  100. package/.agent/skills/game-development/game-art/SKILL.md +185 -0
  101. package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  102. package/.agent/skills/game-development/game-design/SKILL.md +129 -0
  103. package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  104. package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  105. package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  106. package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  107. package/.agent/skills/game-development/web-games/SKILL.md +150 -0
  108. package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  109. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  110. package/.agent/skills/golang-patterns/SKILL.md +226 -0
  111. package/.agent/skills/golang-testing/SKILL.md +182 -0
  112. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  113. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  114. package/.agent/skills/intelligent-routing/SKILL.md +335 -0
  115. package/.agent/skills/laravel-patterns/SKILL.md +224 -0
  116. package/.agent/skills/laravel-security/SKILL.md +171 -0
  117. package/.agent/skills/laravel-tdd/SKILL.md +149 -0
  118. package/.agent/skills/lint-and-validate/SKILL.md +45 -0
  119. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  120. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  121. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  122. package/.agent/skills/mobile-design/SKILL.md +394 -0
  123. package/.agent/skills/mobile-design/decision-trees.md +516 -0
  124. package/.agent/skills/mobile-design/mobile-backend.md +491 -0
  125. package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  126. package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  127. package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  128. package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  129. package/.agent/skills/mobile-design/mobile-performance.md +767 -0
  130. package/.agent/skills/mobile-design/mobile-testing.md +356 -0
  131. package/.agent/skills/mobile-design/mobile-typography.md +433 -0
  132. package/.agent/skills/mobile-design/platform-android.md +666 -0
  133. package/.agent/skills/mobile-design/platform-ios.md +561 -0
  134. package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  135. package/.agent/skills/mobile-design/touch-psychology.md +537 -0
  136. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
  137. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  138. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  139. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  140. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  141. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  142. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  143. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  144. package/.agent/skills/nextjs-react-expert/SKILL.md +286 -0
  145. package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  146. package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  147. package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  148. package/.agent/skills/parallel-agents/SKILL.md +175 -0
  149. package/.agent/skills/performance-profiling/SKILL.md +143 -0
  150. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  151. package/.agent/skills/plan-writing/SKILL.md +152 -0
  152. package/.agent/skills/powershell-windows/SKILL.md +167 -0
  153. package/.agent/skills/project-onboarding/SKILL.md +42 -0
  154. package/.agent/skills/python-patterns/SKILL.md +441 -0
  155. package/.agent/skills/react-frontend/SKILL.md +25 -0
  156. package/.agent/skills/receiving-code-review/SKILL.md +120 -0
  157. package/.agent/skills/red-team-tactics/SKILL.md +199 -0
  158. package/.agent/skills/requesting-code-review/SKILL.md +67 -0
  159. package/.agent/skills/rust-pro/SKILL.md +176 -0
  160. package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  161. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  162. package/.agent/skills/server-management/SKILL.md +161 -0
  163. package/.agent/skills/subagent-driven-development/SKILL.md +76 -0
  164. package/.agent/skills/systematic-debugging/SKILL.md +109 -0
  165. package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  166. package/.agent/skills/tdd-workflow/SKILL.md +149 -0
  167. package/.agent/skills/testing-patterns/SKILL.md +178 -0
  168. package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  169. package/.agent/skills/using-git-worktrees/SKILL.md +122 -0
  170. package/.agent/skills/verification-before-completion/SKILL.md +99 -0
  171. package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  172. package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  173. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  174. package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  175. package/.agent/skills/webapp-testing/SKILL.md +187 -0
  176. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  177. package/.agent/skills/writing-skills/SKILL.md +110 -0
  178. package/.agent/workflows/brainstorm.md +113 -0
  179. package/.agent/workflows/create.md +59 -0
  180. package/.agent/workflows/debug.md +103 -0
  181. package/.agent/workflows/deploy.md +176 -0
  182. package/.agent/workflows/enhance.md +63 -0
  183. package/.agent/workflows/orchestrate.md +237 -0
  184. package/.agent/workflows/plan.md +89 -0
  185. package/.agent/workflows/preview.md +81 -0
  186. package/.agent/workflows/status.md +86 -0
  187. package/.agent/workflows/test.md +144 -0
  188. package/.agent/workflows/ui-ux-pro-max.md +296 -0
  189. package/LICENSE +21 -21
  190. package/README.md +37 -71
  191. package/agents/frontend-specialist.md +2 -2
  192. package/agents/mobile-developer.md +4 -4
  193. package/bin/cli.js +1239 -1326
  194. package/kit/PROMPT_RECIPE.md +30 -52
  195. package/kit/README.md +29 -33
  196. package/package.json +51 -51
  197. package/rules/GEMINI.md +43 -207
  198. package/skills/desktop-design/SKILL.md +25 -25
  199. package/skills/project-onboarding/SKILL.md +42 -62
  200. package/skills/react-frontend/SKILL.md +25 -25
  201. package/PROJECT_CONTEXT.template.md +0 -68
  202. package/kit/PROJECT_CONTEXT.template.md +0 -35
  203. package/scripts/init.py +0 -1047
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: geo-fundamentals
3
+ description: Generative Engine Optimization for AI search engines (ChatGPT, Claude, Perplexity).
4
+ allowed-tools: Read, Glob, Grep
5
+ ---
6
+
7
+ # GEO Fundamentals
8
+
9
+ > Optimization for AI-powered search engines.
10
+
11
+ ---
12
+
13
+ ## 1. What is GEO?
14
+
15
+ **GEO** = Generative Engine Optimization
16
+
17
+ | Goal | Platform |
18
+ |------|----------|
19
+ | Be cited in AI responses | ChatGPT, Claude, Perplexity, Gemini |
20
+
21
+ ### SEO vs GEO
22
+
23
+ | Aspect | SEO | GEO |
24
+ |--------|-----|-----|
25
+ | Goal | #1 ranking | AI citations |
26
+ | Platform | Google | AI engines |
27
+ | Metrics | Rankings, CTR | Citation rate |
28
+ | Focus | Keywords | Entities, data |
29
+
30
+ ---
31
+
32
+ ## 2. AI Engine Landscape
33
+
34
+ | Engine | Citation Style | Opportunity |
35
+ |--------|----------------|-------------|
36
+ | **Perplexity** | Numbered [1][2] | Highest citation rate |
37
+ | **ChatGPT** | Inline/footnotes | Custom GPTs |
38
+ | **Claude** | Contextual | Long-form content |
39
+ | **Gemini** | Sources section | SEO crossover |
40
+
41
+ ---
42
+
43
+ ## 3. RAG Retrieval Factors
44
+
45
+ How AI engines select content to cite:
46
+
47
+ | Factor | Weight |
48
+ |--------|--------|
49
+ | Semantic relevance | ~40% |
50
+ | Keyword match | ~20% |
51
+ | Authority signals | ~15% |
52
+ | Freshness | ~10% |
53
+ | Source diversity | ~15% |
54
+
55
+ ---
56
+
57
+ ## 4. Content That Gets Cited
58
+
59
+ | Element | Why It Works |
60
+ |---------|--------------|
61
+ | **Original statistics** | Unique, citable data |
62
+ | **Expert quotes** | Authority transfer |
63
+ | **Clear definitions** | Easy to extract |
64
+ | **Step-by-step guides** | Actionable value |
65
+ | **Comparison tables** | Structured info |
66
+ | **FAQ sections** | Direct answers |
67
+
68
+ ---
69
+
70
+ ## 5. GEO Content Checklist
71
+
72
+ ### Content Elements
73
+
74
+ - [ ] Question-based titles
75
+ - [ ] Summary/TL;DR at top
76
+ - [ ] Original data with sources
77
+ - [ ] Expert quotes (name, title)
78
+ - [ ] FAQ section (3-5 Q&A)
79
+ - [ ] Clear definitions
80
+ - [ ] "Last updated" timestamp
81
+ - [ ] Author with credentials
82
+
83
+ ### Technical Elements
84
+
85
+ - [ ] Article schema with dates
86
+ - [ ] Person schema for author
87
+ - [ ] FAQPage schema
88
+ - [ ] Fast loading (< 2.5s)
89
+ - [ ] Clean HTML structure
90
+
91
+ ---
92
+
93
+ ## 6. Entity Building
94
+
95
+ | Action | Purpose |
96
+ |--------|---------|
97
+ | Google Knowledge Panel | Entity recognition |
98
+ | Wikipedia (if notable) | Authority source |
99
+ | Consistent info across web | Entity consolidation |
100
+ | Industry mentions | Authority signals |
101
+
102
+ ---
103
+
104
+ ## 7. AI Crawler Access
105
+
106
+ ### Key AI User-Agents
107
+
108
+ | Crawler | Engine |
109
+ |---------|--------|
110
+ | GPTBot | ChatGPT/OpenAI |
111
+ | Claude-Web | Claude |
112
+ | PerplexityBot | Perplexity |
113
+ | Googlebot | Gemini (shared) |
114
+
115
+ ### Access Decision
116
+
117
+ | Strategy | When |
118
+ |----------|------|
119
+ | Allow all | Want AI citations |
120
+ | Block GPTBot | Don't want OpenAI training |
121
+ | Selective | Allow some, block others |
122
+
123
+ ---
124
+
125
+ ## 8. Measurement
126
+
127
+ | Metric | How to Track |
128
+ |--------|--------------|
129
+ | AI citations | Manual monitoring |
130
+ | "According to [Brand]" mentions | Search in AI |
131
+ | Competitor citations | Compare share |
132
+ | AI-referred traffic | UTM parameters |
133
+
134
+ ---
135
+
136
+ ## 9. Anti-Patterns
137
+
138
+ | ❌ Don't | ✅ Do |
139
+ |----------|-------|
140
+ | Publish without dates | Add timestamps |
141
+ | Vague attributions | Name sources |
142
+ | Skip author info | Show credentials |
143
+ | Thin content | Comprehensive coverage |
144
+
145
+ ---
146
+
147
+ > **Remember:** AI cites content that's clear, authoritative, and easy to extract. Be the best answer.
148
+
149
+ ---
150
+
151
+ ## Script
152
+
153
+ | Script | Purpose | Command |
154
+ |--------|---------|---------|
155
+ | `scripts/geo_checker.py` | GEO audit (AI citation readiness) | `python scripts/geo_checker.py <project_path>` |
156
+
@@ -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,226 @@
1
+ ---
2
+ name: golang-patterns
3
+ description: Go development patterns and idioms. Use when writing Go backend services, APIs, CLI tools — covers error handling, concurrency, interfaces, project layout, and tooling.
4
+ allowed-tools: Read, Edit, Write, Bash
5
+ ---
6
+
7
+ # Go Development Patterns
8
+
9
+ ## Core Principles
10
+
11
+ | Principle | Rule |
12
+ |-----------|------|
13
+ | Simplicity over cleverness | Code should be obvious, not smart |
14
+ | Errors are values | Return errors, don't panic |
15
+ | Accept interfaces, return structs | Flexible input, concrete output |
16
+ | Zero value useful | Types work without initialization |
17
+ | Context as first param | Always `ctx context.Context` first |
18
+
19
+ ## Project Layout
20
+
21
+ ```
22
+ myproject/
23
+ ├── cmd/
24
+ │ └── myapp/
25
+ │ └── main.go # Entry point
26
+ ├── internal/
27
+ │ ├── handler/ # HTTP handlers
28
+ │ ├── service/ # Business logic
29
+ │ ├── repository/ # Data access
30
+ │ └── config/ # Configuration
31
+ ├── pkg/
32
+ │ └── client/ # Public API client
33
+ ├── api/
34
+ │ └── v1/ # OpenAPI / proto definitions
35
+ ├── testdata/
36
+ ├── go.mod
37
+ └── Makefile
38
+ ```
39
+
40
+ ## Error Handling
41
+
42
+ ```go
43
+ // Wrap errors with context
44
+ func LoadConfig(path string) (*Config, error) {
45
+ data, err := os.ReadFile(path)
46
+ if err != nil {
47
+ return nil, fmt.Errorf("load config %s: %w", path, err)
48
+ }
49
+ var cfg Config
50
+ if err := json.Unmarshal(data, &cfg); err != nil {
51
+ return nil, fmt.Errorf("parse config %s: %w", path, err)
52
+ }
53
+ return &cfg, nil
54
+ }
55
+
56
+ // Sentinel errors
57
+ var (
58
+ ErrNotFound = errors.New("resource not found")
59
+ ErrUnauthorized = errors.New("unauthorized")
60
+ )
61
+
62
+ // Type assertions
63
+ var validationErr *ValidationError
64
+ if errors.As(err, &validationErr) {
65
+ log.Printf("field %s: %s", validationErr.Field, validationErr.Message)
66
+ }
67
+
68
+ // NEVER ignore errors
69
+ result, _ := doSomething() // ❌ Bad
70
+ result, err := doSomething() // ✅ Good
71
+ if err != nil { return err }
72
+ ```
73
+
74
+ ## Concurrency Patterns
75
+
76
+ ```go
77
+ // Worker pool
78
+ func WorkerPool(jobs <-chan Job, results chan<- Result, numWorkers int) {
79
+ var wg sync.WaitGroup
80
+ for i := 0; i < numWorkers; i++ {
81
+ wg.Add(1)
82
+ go func() {
83
+ defer wg.Done()
84
+ for job := range jobs {
85
+ results <- process(job)
86
+ }
87
+ }()
88
+ }
89
+ wg.Wait()
90
+ close(results)
91
+ }
92
+
93
+ // Context for timeouts
94
+ func FetchWithTimeout(ctx context.Context, url string) ([]byte, error) {
95
+ ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
96
+ defer cancel()
97
+ req, _ := http.NewRequestWithContext(ctx, "GET", url, nil)
98
+ resp, err := http.DefaultClient.Do(req)
99
+ if err != nil {
100
+ return nil, fmt.Errorf("fetch %s: %w", url, err)
101
+ }
102
+ defer resp.Body.Close()
103
+ return io.ReadAll(resp.Body)
104
+ }
105
+
106
+ // errgroup for coordinated goroutines
107
+ func FetchAll(ctx context.Context, urls []string) ([][]byte, error) {
108
+ g, ctx := errgroup.WithContext(ctx)
109
+ results := make([][]byte, len(urls))
110
+ for i, url := range urls {
111
+ i, url := i, url
112
+ g.Go(func() error {
113
+ data, err := FetchWithTimeout(ctx, url)
114
+ if err != nil { return err }
115
+ results[i] = data
116
+ return nil
117
+ })
118
+ }
119
+ return results, g.Wait()
120
+ }
121
+
122
+ // Graceful shutdown
123
+ func GracefulShutdown(server *http.Server) {
124
+ quit := make(chan os.Signal, 1)
125
+ signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
126
+ <-quit
127
+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
128
+ defer cancel()
129
+ server.Shutdown(ctx)
130
+ }
131
+ ```
132
+
133
+ ## Interface Design
134
+
135
+ ```go
136
+ // Small, focused interfaces
137
+ type Reader interface { Read(p []byte) (n int, err error) }
138
+ type Writer interface { Write(p []byte) (n int, err error) }
139
+
140
+ // Accept interfaces, return structs
141
+ func ProcessData(r io.Reader) (*Result, error) {
142
+ data, err := io.ReadAll(r)
143
+ if err != nil { return nil, err }
144
+ return &Result{Data: data}, nil
145
+ }
146
+ ```
147
+
148
+ ## Struct Design
149
+
150
+ ```go
151
+ // Functional options pattern
152
+ type Server struct {
153
+ host string
154
+ port int
155
+ timeout time.Duration
156
+ }
157
+
158
+ type Option func(*Server)
159
+
160
+ func WithTimeout(d time.Duration) Option { return func(s *Server) { s.timeout = d } }
161
+
162
+ func NewServer(opts ...Option) *Server {
163
+ s := &Server{host: "localhost", port: 8080, timeout: 30 * time.Second}
164
+ for _, opt := range opts { opt(s) }
165
+ return s
166
+ }
167
+
168
+ // DI over global state
169
+ type Handler struct { db *sql.DB } // ✅ Good
170
+ var db *sql.DB; func init() { db, _ = ... } // ❌ Bad
171
+ ```
172
+
173
+ ## Memory and Performance
174
+
175
+ ```go
176
+ // Preallocate slices
177
+ users := make([]User, 0, len(rows)) // ✅ Known size
178
+ var users []User // ❌ Unknown size, reallocates
179
+
180
+ // sync.Pool for frequent allocations
181
+ var bufPool = sync.Pool{New: func() any { return new(bytes.Buffer) }}
182
+ buf := bufPool.Get().(*bytes.Buffer)
183
+ buf.Reset()
184
+ defer bufPool.Put(buf)
185
+ ```
186
+
187
+ ## Tooling
188
+
189
+ ```bash
190
+ go fmt ./... # Format (mandatory)
191
+ go vet ./... # Static analysis
192
+ golangci-lint run # Comprehensive linting
193
+ go test ./... -race # Race detector (always use in CI)
194
+ go mod tidy # Clean dependencies
195
+ ```
196
+
197
+ ## Anti-Patterns
198
+
199
+ ```go
200
+ // ❌ Naked returns in long functions
201
+ func process() (result int, err error) { return } // What is returned?
202
+
203
+ // ❌ Panic for control flow
204
+ panic(err) // Use return err instead
205
+
206
+ // ❌ Context in struct
207
+ type Req struct { ctx context.Context } // Must be first param, not field
208
+
209
+ // ❌ Mixing value and pointer receivers
210
+ func (c Counter) Value() int { return c.n }
211
+ func (c *Counter) Inc() { c.n++ } // Pick one style
212
+
213
+ // ❌ Package-level mutable state
214
+ var globalDB *sql.DB // Break this dependency with DI
215
+ ```
216
+
217
+ ## Quick Reference Idioms
218
+
219
+ | Idiom | Description |
220
+ |-------|-------------|
221
+ | `if err != nil { return err }` | Always handle errors |
222
+ | `defer f.Close()` | Cleanup immediately after open |
223
+ | `ctx, cancel := context.WithTimeout(...)` | Always defer cancel() |
224
+ | `i, v := i, v` | Capture loop variables in goroutines |
225
+ | `make([]T, 0, cap)` | Preallocate when size is known |
226
+ | Return early | Handle errors first, keep happy path flat |