Hybrid Search on AlloyDB Design

Hybrid Search on AlloyDB Design

Gathers requirements and designs hybrid search on AlloyDB combining vector and keyword search with SQL filtering, reranking, validation and serverless hosting.

Skill files6 files

assets/

references/

SKILL.md335 lines
1
---
2
name: google-cloud-solution-hybrid-search-alloydb
3
metadata:
4
version: "1.0.2"
5
category: MultiProductSolutions
6
description: >-
7
Discovers requirements and generates architectural, design, and deployment
8
guidance for dynamic hybrid search systems by combining semantic search and
9
keyword search. Optimized for AlloyDB hybrid search use cases in Google Cloud.
10
Use when users need vector search combined with structured SQL
11
filtering, faceted attributes, semantic reranking, in-database AI validation,
12
or serverless hosting across transactional relational databases, analytical
13
data warehouses, or managed database engines. DON'T use this skill for simple
14
keyword-only search, or when a standalone non-relational vector database is
15
required.
16
---
17
18
# Dynamic Hybrid Search using AlloyDB
19
20
This skill provides a workflow to design and implement secure, low-latency, and
21
high-accuracy hybrid search solutions combining structured dataset filtering,
22
vector search indexing, faceted metadata filtering, semantic reranking, recall
23
evaluation, in-database AI validation, database abstraction layers, and
24
serverless application hosting.
25
26
## Attribution
27
28
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
29
MUST read and follow the instructions in
30
[Usage Attribution](references/attribution.md).
31
32
## Overview of the workflow
33
34
The workflow consists of the following phases:
35
36
1. **Requirements discovery**. Gather detailed requirements related to
37
the cloud workload or use case that the user needs assistance for.
38
2. **Solution architecture**. Use the requirements that were gathered
39
in Phase 1 to generate a detailed solution architecture for the cloud
40
workload or use case.
41
3. **Solution validation**. Create a plan to validate the generated
42
solution, generate validation instructions and scripts, and run the
43
validation.
44
4. **Solution packaging and presentation**. Consolidate the generated
45
content and present the solution.
46
47
**Important notes about the workflow**:
48
49
- **Strict phase separation**: During Phase 1 (Requirements discovery), when you
50
ask the user clarifying questions, DON'T recommend, propose, or outline any
51
architectural designs, cloud services, or component mappings. This prevents
52
premature architecture commitments or hallucinations before the full scope is
53
understood.
54
- **Halting for approval**: For any step where you are instructed
55
to "obtain approval before proceeding", you MUST stop executing, present the
56
completed tasks to the user, and wait for their explicit approval. You MUST
57
NOT proceed to execute any subsequent tasks or generate any further guidance
58
in that response.
59
- **Ground all generated content**: For all tasks across all phases, you MUST
60
first look in the following resources:
61
- [Product Mapping](references/product-mapping.md),
62
- [Design Recommendations](references/design-recommendations.md) for the
63
required guidance. If the guidance does not provide the required information,
64
you MUST ground the generated content by using the following resources:
65
66
- Google Developer Knowledge MCP server:
67
https://developers.google.com/knowledge/mcp.md.txt
68
- Server: https://developerknowledge.googleapis.com/mcp
69
- Tools:
70
- `developerknowledge:search_documents`
71
- `developerknowledge:get_documents`
72
- `developerknowledge:answer_query`
73
- Relevant skills from https://github.com/google/skills
74
- Official Google Cloud documentation in
75
[Related Guidance](references/related-guidance.md)
76
77
## Product Renaming & Terminology
78
79
When generating solution designs, architecture diagrams, and documentation,
80
check the latest Google Cloud documentation for the most up-to-date product
81
names. The table below provides examples of name mappings to be aware of. Note
82
that underlying APIs, Terraform resources, and IAM roles may retain their legacy
83
identifiers.
84
85
<table>
86
<thead>
87
<tr>
88
<th>Legacy Name</th>
89
<th>Updated Name</th>
90
<th>Notes</th>
91
</tr>
92
</thead>
93
<tbody>
94
<tr>
95
<td>Vertex AI</td>
96
<td>Gemini Enterprise Agent Platform</td>
97
<td>Gemini Enterprise Agent Platform can be shortened to Agent Platform after first instance</td>
98
</tr>
99
<tr>
100
<td>Vertex AI Embedding</td>
101
<td>Text embedding on Gemini Enterprise Agent Platform</td>
102
<td>This refers to the text embedding models available on Gemini Enterprise Agent Platform</td>
103
</tr>
104
<tr>
105
<td>Vertex AI Matching Engine</td>
106
<td>Vector Search</td>
107
<td></td>
108
</tr>
109
</tbody>
110
</table>
111
112
## Phase 1: Requirements discovery
113
114
In this phase, you must gather detailed requirements related to the hybrid
115
search workload that the user wants to design and deploy in Google Cloud.
116
117
**Acknowledge provided requirements**: If the
118
user's prompt already contains some requirements (functional or non-functional,
119
such as catalog size, search modalities, faceted attributes, or latency
120
targets), you MUST explicitly acknowledge and restate all of these requirements
121
in your response. Do NOT ask the user to describe or re-describe any
122
requirements that they have already provided in the prompt.
123
124
Complete the following steps strictly in the specified order:
125
126
- [ ] **Step 1**: Ask the user to describe the functional requirements of the
127
workload, including catalog dataset details (e.g., e-commerce apparel, retail
128
products, patent database), search modalities (natural language text, visual
129
search, attribute filters), metadata attributes for faceted filtering (e.g.,
130
`category`, `sub_category`, `color`, `gender`, `price`), and quality checks
131
(reranking, LLM validation).
132
- [ ] **Step 2**: You MUST explicitly ask the user to describe ALL of the
133
following six categories of non-functional requirements. You need this
134
information because each category represents a critical architectural pillar,
135
and neglecting any of them can result in a solution that is insecure,
136
unreliable, or inefficient (do NOT omit any of them):
137
- **Security, privacy, and compliance**: E.g., private VPC endpoints, Private
138
Service Connect, Direct VPC Egress, and access control.
139
- **Reliability**: E.g., high availability, failover, disaster recovery goals
140
(RTO/RPO), regional vs multi-region AlloyDB topology.
141
- **Cost**: E.g., budget constraints for compute, database instances, and
142
Gemini Enterprise Agent Platform API calls.
143
- **Operational excellence**: E.g., monitoring, logging, dashboards, and
144
automated deployment.
145
- **Performance**: E.g., target P95 query latency (e.g., < 100ms), vector
146
search recall target (e.g., > 95%), catalog item scale, and QPS
147
expectations.
148
- **Sustainability**: E.g., carbon footprint, low-carbon region selection.
149
- [ ] **Step 3**: Ask the user whether the workload currently runs on other
150
cloud providers or on-premises.
151
- If the user's answer is "yes", then ask the user to describe the
152
architecture of the current deployment.
153
- If the user's answer is "no", then proceed to the next step.
154
- [ ] **Step 4**: Ask the user to describe dependencies, if any, on other
155
workloads, products, or tools (e.g., existing inventory databases, ERP
156
systems, application runtime languages like Java or Python).
157
158
- [ ] **Step 5**: Review the input that the user has provided so far, and check
159
whether there are any ambiguities, conflicts, or contradictions in the
160
functional requirements, non-functional requirements, and dependencies. You
161
MUST compare all requirements against each other to identify any conflicts.
162
163
If you identify any ambiguities, conflicts, or contradictions in the
164
requirements that the user has provided, you MUST do the following for each
165
ambiguity, conflict, or contradiction:
166
- [ ] Identify exactly where each contradiction lies and explain to the
167
user why the requirements are incompatible and cannot be simultaneously
168
satisfied. Do NOT treat fundamental contradictions as design choice
169
questions (e.g., asking how to implement or configure a conflicting
170
requirement).
171
- [ ] Ask the user to clarify their trade-off preferences to resolve the
172
contradiction.
173
- [ ] If the user delegates the choice to you (e.g., the user replies with
174
"do what you think is best" or "you decide"), then provide a clear
175
suggestion to resolve the ambiguity or contradiction, explain your
176
reasoning, and ask the user to approve your suggestion.
177
178
**Critical**: Until all the ambiguities and contradictions that you identify
179
are resolved according to the preceding guidance, you must NOT recommend or
180
generate any architecture design or Google Cloud product recommendations.
181
182
- [ ] **Step 6**: Summarize the functional and non-functional requirements
183
provided by the user into a consolidated requirements summary.
184
185
- [ ] **Step 7**: Present the generated requirements summary to the user and
186
obtain approval (the user MUST explicitly say "yes" or "I approve") before
187
proceeding to Phase 2.
188
189
**Important**: **STOP**, DON'T proceed to generate architecture diagram,
190
architecture description or product recommendations until you have confirmed the
191
generated requirements summary and resolved all ambiguities and contradictions
192
in this phase.
193
194
## Phase 2: Solution architecture
195
196
### Task 2.1: Identify Google Cloud products and features required for the workload.
197
198
- [ ] **Step 1**: Recommend products and features that are appropriate for each
199
component of the user's workload, prioritizing Google Cloud products.
200
201
**Important**: The Google Cloud products and features that you recommend
202
MUST be consistent with the guidance in
203
[Product Mapping](references/product-mapping.md).
204
205
- [ ] **Step 4**: Present the generated product recommendations to the user and
206
obtain approval (the user MUST explicitly say "yes" or "I approve") before
207
proceeding to Task 2.2.
208
209
**Important**: **STOP**, DON'T proceed to generate architecture diagram until
210
you have confirmed the generated product recommendations with the user.
211
212
### Task 2.2: Generate an architecture diagram and description
213
214
- [ ] **Step 1**: Generate an architecture diagram in the Mermaid format:
215
https://github.com/mermaid-js/mermaid.
216
217
The diagram must show the data flows and request flows across the components
218
of the architecture, based on the gathered requirements and product
219
recommendations. The diagram MUST explicitly show both the ingestion pipeline
220
and serving pipeline.
221
222
The following is an **example** of the data flows and request flows that the
223
architecture diagram should show:
224
- **Ingestion pipeline**: Catalog Data -> AlloyDB Table
225
(`apparels`) -> B-Tree Indexes on Facets -> Text embedding
226
(`text-embedding-005`) -> ScaNN Vector Index.
227
- **Serving pipeline**: User Browser -> Cloud Run Web App -> MCP
228
Toolbox for Databases -> AlloyDB Single-Query Hybrid Search (ScaNN Vector
229
Search + SQL WHERE Filters) -> `ai.rank` Reranker -> Gemini Pro
230
`ai.generate` Quality Validation -> Validated Results -> User Browser.
231
232
- [ ] **Step 2**: Generate a description that explains the purpose of each
233
component, the relationships between the components, and the task flow or data
234
flow.
235
- [ ] **Step 3**: Present the generated architecture diagram and description
236
to the user and obtain approval (the user MUST explicitly say "yes" or "I
237
approve") before proceeding to Task 2.3.
238
239
**Important**: **STOP**, DON'T proceed to generate design recommendations
240
until you have confirmed the generated architecture description with the user.
241
242
### Task 2.3: Generate design recommendations.
243
244
- [ ] **Step 1**: Generate design recommendations and best practices to
245
optimally configure each component in the architecture based on the workload
246
requirements.
247
248
**Important**:
249
- When you generate design recommendations, consider the following:
250
- Functional requirements that were gathered in Phase 1.
251
- Non-functional requirements that were gathered in Phase 1.
252
- Align the generated design recommendations with the recommendations in
253
[Design Recommendations](references/design-recommendations.md).
254
- To generate guidance for the non-functional requirements, use the
255
following skills:
256
- `google-cloud-waf-security`
257
- `google-cloud-waf-reliability`
258
- `google-cloud-waf-cost-optimization`
259
- `google-cloud-waf-operational-excellence`
260
- `google-cloud-waf-performance-optimization`
261
- `google-cloud-waf-sustainability`
262
- [ ] **Step 2**: Present the generated recommendations to the user and obtain
263
approval (the user MUST explicitly say "yes" or "I approve") before
264
proceeding to Task 2.4.
265
266
**Important**: **STOP**, DON'T proceed to generate deployment guidance until
267
you have confirmed the design recommendations with the user.
268
269
### Task 2.4: Generate deployment guidance.
270
271
- [ ] **Step 1**: Generate guidance to deploy the solution, including the
272
following:
273
- AlloyDB DDL & SQL setup scripts for extensions (`google_ml_integration`,
274
`alloydb_scann`), tables, B-Tree indexes, ScaNN vector indexes, hybrid
275
search SQL, and Gemini validation CTEs.
276
- MCP Toolbox deployment configuration on Cloud Run.
277
- Python Cloud Run Function shim deployment command.
278
- Application deployment command (`gcloud run deploy {app_name}`).
279
- Terraform code or `gcloud` CLI commands to create required infrastructure.
280
281
**Important**: The deployment guidance that you generate MUST be consistent
282
with the guidance in the following resources:
283
- [Related Guidance](references/related-guidance.md)
284
- Relevant skills in
285
https://github.com/google/skills/tree/main/skills/cloud
286
287
- [ ] **Step 2**: Present the generated deployment guidance to the user and
288
obtain approval (the user MUST explicitly say "yes" or "I approve") before
289
proceeding to Phase 3.
290
291
**Important**: **STOP**, DON'T proceed to generate solution validation until
292
you have confirmed the deployment guidance with the user.
293
294
## Phase 3: Solution validation
295
296
### Task 3.1: Pre-deployment validation
297
298
- [ ] **Step 1**: Create a pre-deployment plan to statically validate the
299
generated solution and verify that it meets the workload requirements
300
without provisioning live resources:
301
- **Deployment dry-run**: Validate infrastructure syntax and preview the
302
resources that will be provisioned using dry-run commands (e.g.,
303
`terraform plan` or (where supported) `gcloud ... --dry-run`).
304
- **Architecture & policy analysis**: Perform static verification of
305
network routing topologies, firewall rules, and IAM enforcement against
306
best practices.
307
- [ ] **Step 2**: Present the static validation plan to the user, obtain
308
approval (the user MUST explicitly say "yes" or "I approve"), and execute the
309
dry-run commands.
310
- [ ] **Step 3**: Troubleshoot and fix any errors or policy discrepancies
311
identified during dry-run checks until validation succeeds.
312
- [ ] **Step 4**: Proceed to Task 3.2
313
314
### Task 3.2: Runtime validation (Post-deployment)
315
316
- [ ] **Step 1**: Ask the user whether they choose to deploy the infrastructure
317
now to perform live runtime verification, or skip directly to Phase 4.
318
- [ ] **Step 2**: **If the user chooses to deploy the infrastructure**:
319
- After the user deploys the infrastructure, generate runtime
320
verification commands (using tools like `curl`, `ping`, or `gcloud`)
321
and provide them to the user to execute, to test live endpoint
322
reachability, networking paths, and load balancer routing.
323
- Troubleshoot any deployment or runtime routing issues until checks pass.
324
- [ ] **Step 3**: Proceed to Phase 4.
325
326
## Phase 4: Solution packaging and presentation
327
328
- [ ] **Step 1**: Consolidate the final text artifacts that were generated in
329
Phase 2 into a single Markdown file named `solution-architecture-guide.md`,
330
based on the template in [Output Template](assets/output-template.md).
331
- [ ] **Step 2**: Request the user's permission to write the code files in the
332
user's workspace.
333
- [ ] **Step 3**: After the user gives permission, write the final code files in
334
the user's workspace.
335

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…