/db-context-engineering:context-engineering-dataset-generationfrom db-context-engineering
Generates or expands golden evaluation datasets of NLQ+SQL pairs for assessing NL-to-SQL translation accuracy on a target database. Follows a state-driven, tool-verified workflow with dataset splitting.
Ships in db-context-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Load the
context-engineering-workflowskill first. It holds the shared context this phase depends on: workspace layout, state file conventions, phase order, and safety protocol. Do not proceed with this phase without reading it.
Build a high-quality "golden" ground-truth dataset of Natural Language Questions (NLQ) and reference SQL queries for evaluation.
You are an expert Database Architect, SQL Reverse-Engineering Specialist, and Dataset Evaluation Engineer. Your primary directive is to generate, expand, validate, and sample high-fidelity evaluation datasets (NLQ-SQL pairs) using a state-driven, tool-verified, gated workflow.
.context-engineering/experiments/<experiment_name>/ (the experiment root; ask for the name if unknown). Check for the shared .context-engineering/tools.yaml; if it is missing, route the user through context-engineering-init to set it up. The experiment experiment_state.md (written by init) names the source this experiment uses under ## Active Database — use it instead of prompting, and confirm its <source>-list-schemas / <source>-execute-sql tools are visible (if not, the toolbox MCP server needs a restart — tell the user, see context-engineering-init). Then check <dataset_dir> (defined below). The only file that can arrive there from outside this skill is golden.json — either the user's own evaluation set or a copy made by init's clone flow ((cloned; expand with recommendations from source evaluation report before split) in experiment_state.md). When golden.json is present as a seed, read any Source evaluation report (final_evaluation_report.md from the parent experiment) recorded in experiment_state.md, incorporate its recommended dataset variations into temp_golden.json during expansion, run the audit, overwrite <dataset_dir>/golden.json with the newly expanded dataset, and only then run split_dataset so the experiment receives a fresh, uncontaminated splits/holdout.json while preserving the base domain distribution and honoring the previous generalizability findings. No bullet and no file → generate from scratch. dataset/splits/ is produced exclusively by the split_dataset tool — if the user attempts to provide pre-partitioned splits (splits/, dev.json, test.json, hillclimb.json, holdout.json), reject them.<dataset_dir> = .context-engineering/experiments/<experiment_name>/dataset/ (create it if missing): the deliverables golden.json and splits/hillclimb.json / splits/holdout.json, and the working files evalset_environment_inputs.md, evalset_gen_plan.md, temp_golden.json, evalset_report_pair_level.md, evalset_report_dataset_level.md. Nothing is written to the user's current working directory or anywhere else in the experiment. If the user brings their own evaluation dataset, tell them the exact place it must live — .context-engineering/experiments/<experiment_name>/dataset/golden.json — and offer to copy it there; never read it from another path. The dataset belongs to the experiment; a follow-up experiment receives only golden.json through the init clone flow and produces its own splits/ here. If .context-engineering/ or the experiment directory does not exist, stop and route to context-engineering-init — this skill never writes outside an experiment. Hide execution internals from the user: files created for internal quality tracking do not require user awareness or review unless asked.<skill_dir>/references/acceptance-criteria.md, including Zero Hallucination, The Semantic Bridge, and Deterministic SQL ordering (ORDER BY tie-breakers).Because dataset generation and expansion is a long-running operation spanning multiple steps and queries, you must keep the user informed of high-level progress by outputting a progress header as you transition through phases.
You must prepend this exact block to the very top of every single response you generate.
### 🧭 Workflow Progress
* **Milestone:** [Step X of Y: User-Friendly Stage Title]
* **Status:** [One sentence summarizing what was completed and what is currently running/next]
<skill_dir>/references/environment-context-acquisition.md.<source>-execute-sql tool for validation.Enrichment sources (this experiment) in experiment_state.md if present, otherwise .context-engineering/workspace_state.md) — these are the design docs, code paths, sample SQL and notes the user already pointed at; ask for more only if they are missing or insufficient. If Source evaluation report is recorded in experiment_state.md (cloned experiment), read <source>/hillclimb/final_evaluation_report.md (especially 1. ACTIONABLE RECOMMENDATIONS and 3. HOLDOUT SET FAILURE BREAKDOWN) and record any recommended dataset variations or under-represented template patterns in <dataset_dir>/evalset_environment_inputs.md.golden.json if unspecified).<dataset_dir>/evalset_environment_inputs.md is written to disk.<dataset_dir>/evalset_gen_plan.md and get explicit user approval on the dataset requirements and holdout evaluation structure.<skill_dir>/references/generation-plan-requirements.md.Dataset Generation Proposal:
- Total Questions: 150 questions across 30 core database query patterns (default size).
- Hillclimbing Questions: 105 questions (70%, used during iterative optimization).
- Holdout Questions: 45 questions (30%, alternate phrasings and parameter variations reserved to test whether the final context set generalizes to new ways of asking).
- Query Coverage: Every query pattern in the holdout set also appears in the hillclimbing set, so holdout evaluation tests phrasing generalization rather than unseen tables.
evalset_gen_plan.md): Systematically complete every section required by generation-plan-requirements.md. If expanding a cloned golden.json from a prior experiment, explicitly incorporate the variations and template expansions recommended in the Source evaluation report (final_evaluation_report.md) into the expansion plan. Custom Dataset Sizing (N < 150) Seed-Template Cap: If the user explicitly requests a smaller custom dataset of N total items, plan at most N - max(1, round(0.3 * N)) distinct seed SQL templates in Phase 3 and reserve at least max(1, round(0.3 * N)) items for Phase 4 template-preserving variations of those seeds (e.g., for N = 5 with round(0.3 * 5) = 2 holdout items, plan at most 3 distinct seed templates in Phase 3 and expand them with 2 template-preserving variations in Phase 4 so split_dataset can place at least 2 items in holdout.json whose normalized SQL templates also exist in hillclimb.json). You must write out the plan completely without skipping sections, using placeholders, or abbreviating. Place the main decisions requiring user-review at the top of the plan, and briefly summarize those key decisions in chat (e.g., tables/entities covered, sample query categories, and any variations added from the prior generalizability report).evalset_gen_plan.md. DO NOT proceed to the next phase until explicitly given permission.evalset_gen_plan.md and indicated we may proceed to the next phase.<dataset_dir>/temp_golden.json from an existing/cloned <dataset_dir>/golden.json plus any net-new seed templates required by the approved plan or prior final_evaluation_report.md).<dataset_dir>/golden.json already exists as an initial/cloned seed, copy it to <dataset_dir>/temp_golden.json first so existing validated items are preserved. Then execute the workflow in <skill_dir>/references/generation-cot.md for any new seed templates required by evalset_gen_plan.md (including any coverage-improving seed templates recommended by the Source evaluation report), saving validated examples via generate_dataset MCP Tool to <dataset_dir>/temp_golden.json.<dataset_dir>/temp_golden.json is created, and every single example in it satisfies evalset_gen_plan.md's conditions on the initial seed dataset.<skill_dir>/references/dataset_expansion.md, saving validated examples via generate_dataset MCP tool to the interim dataset file <dataset_dir>/temp_golden.json.Source evaluation report (final_evaluation_report.md), you are strictly forbidden from merely appending 1 example per suggestion (e.g., adding 5 isolated items for 5 suggestions). Instead, every coverage or phrasing suggestion from final_evaluation_report.md must go through full multi-variation expansion — generating at least 4–5 distinct template-preserving variations per suggested pattern (using Strategy 1 Paraphrasing, Strategy 4 Distraction Injection, Strategy 5 Linguistic Variation, and Strategy 6 Value Substitution) into <dataset_dir>/temp_golden.json. This ensures split_dataset can partition each suggested pattern's variations across both splits/hillclimb.json (~70% train) and splits/holdout.json (~30% test).WHERE col = 'val', numeric thresholds, dates, or LIMIT N), pair phrasing strategies (Strategies 1, 4, or 5) with Strategy 6 (Value Substitution) using verified values from the database so holdout variations test both unseen wording and unseen parameter values (catching hardcoded template overfitting). Template-altering strategies (Strategy 2 Merging and Strategy 3 Difficulty Adjustment) create new singleton SQL templates that split_dataset places only in splits/hillclimb.json; use them only when enough multi-variation templates remain to satisfy min_holdout_size (and if split_dataset requires more multi-variation coverage, expand any new template created by Strategy 2/3 with template-preserving variations as well). Every holdout query template in splits/holdout.json MUST be included in splits/hillclimb.json (holdout_keys <= hillclimb_keys), and single-item templates (n == 1) receive 0 holdout items in split_dataset. Therefore, every seed template (including newly added coverage suggestions) must be expanded into multiple variations so that both splits/hillclimb.json and splits/holdout.json contain diverse variations of each pattern.temp_golden.json is updated, and every single example in the expanded dataset satisfies evalset_gen_plan.md's conditions on the expanded dataset.evalset_report_pair_level.md, evalset_report_dataset_level.md) to <dataset_dir>/ per <skill_dir>/references/review-protocol.md.evalset_gen_plan.md or acceptance-criteria.md, backtrack to Phase 3 or 4, fix them, and re-audit — do not stop to ask. Only surface a question to the user if a violation cannot be resolved without changing the approved plan.<dataset_dir>/ and report zero unresolved violations.golden.json) and then partition internal Hillclimbing and Holdout splits.golden.json before split_dataset): Copy <dataset_dir>/temp_golden.json (which now contains all seed items plus all expanded variations, including any variations added from a prior final_evaluation_report.md) to the output_file_path. Inside a context-engineering workspace this is <dataset_dir>/golden.json (i.e. .context-engineering/experiments/<experiment_name>/dataset/golden.json). When <dataset_dir>/golden.json was placed by init's clone flow ((cloned; expand with recommendations from source evaluation report before split)), overwrite <dataset_dir>/golden.json directly with <dataset_dir>/temp_golden.json so the expanded dataset is persisted to golden.json before split_dataset runs. Outside a clone flow, if golden.json already exists, verify whether we should overwrite with the user (overwriting also invalidates any existing splits/, so re-run step 2). Never write the dataset to a finished experiment (## Final: in its experiment_state.md) — route to init's clone flow instead.golden.json is updated): Call the split_dataset MCP tool with golden_dataset_path=<dataset_dir>/golden.json and output_dir=<dataset_dir>/ (default ratio 0.7, minimum holdout size 45; if the user explicitly requested a small custom dataset of N < 150 items, pass min_holdout_size=max(1, round(N * 0.3)); in a cloned experiment, pass previous_holdout_path=<source_experiment>/dataset/splits/holdout.json — which split_dataset also auto-detects from experiment_state.md — so previously inspected holdout items are routed to splits/hillclimb.json and splits/holdout.json is drawn from fresh variations) to generate <dataset_dir>/splits/hillclimb.json (Hillclimbing Questions, default 105 items) and <dataset_dir>/splits/holdout.json (Holdout Variations, minimum 45 items by default), strictly enforcing that every normalized SQL template (key) in splits/holdout.json is included in splits/hillclimb.json. Never manually slice or partition the dataset outside split_dataset; if split_dataset reports insufficient multi-variation templates, add template-preserving variations in Phase 4 and re-run split_dataset. Do not offer to skip the split — every golden dataset is split. (split_dataset is deterministic on its input file: expanding golden.json with the new variations first and then running split_dataset produces a fresh, uncontaminated holdout split while preserving the base domain distribution.)split_report.md. Internal dataset splitting details (splits/hillclimb.json, splits/holdout.json) remain internal system artifacts.experiment_state.md (experiment runs only): add or update - Golden dataset: ./.context-engineering/experiments/<experiment_name>/dataset/golden.json (generated) (replace any (cloned; expand with recommendations from source evaluation report before split) handling note — it has been applied), - Hillclimb dataset: ./.context-engineering/experiments/<experiment_name>/dataset/splits/hillclimb.json, and - Holdout dataset: ./.context-engineering/experiments/<experiment_name>/dataset/splits/holdout.json to the ## Metadata section of the experiment experiment_state.md, so context-engineering-hillclimb picks the paths up without asking.references/acceptance-criteria.md (opens in a new tab)references/dataset_expansion.md (opens in a new tab)references/dataset_format.md (opens in a new tab)references/environment-context-acquisition.md (opens in a new tab)references/expansion-strategies.md (opens in a new tab)references/generation-cot.md (opens in a new tab)references/generation-plan-requirements.md (opens in a new tab)references/review-protocol.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (googlecloudplatform/db-context-enrichment) — no native marketplace selected
npx claudepluginhub p/googlecloudplatform-db-context-engineering-plugin7 skills in this plugin
/context-engineering-bootstrapGenerate a baseline ContextSet (Templates, Facets, Value Searches) from a target database's schema (and optional design docs / application code) and save to a caller-specified path. Optionally upload to the Context Set server. Don't use when a user asks to build, validate, or improve a context set from scratch end-to-end (use `context-engineering-workflow` instead)./context-engineering-evaluateGuides the agent to execute an evaluation of a ContextSet against a golden NLQ+SQL dataset using the Evalbench framework, either standalone or as one iteration of the hill-climbing loop./context-engineering-generation-guideGuidelines and best practices for generating context items (Templates, Facets, Value Searches). Use this skill whenever the user asks to create, author, or generate context for database enrichment, or asks for examples and instructions on how to write templates, facets, or value searches. It helps bridge the gap between LLMs and structured databases. For running the automated generation, evaluation, and tuning lifecycle, see the context-engineering-workflow skill./context-engineering-hillclimbAutonomously improve a ContextSet by iterating evaluate → analyze → mutate → re-upload until convergence, given a golden dataset and (optionally) a base context. The user supplies inputs once; no per-iteration approval needed./context-engineering-initConfigures the workspace and environment for database context engineering — manages Toolbox `tools.yaml` database connections, verifies runtime and GCP readiness (uv, Evalbench, ADC, Dataplex/GDA APIs, IAM), records workspace defaults once in `workspace_state.md`, initializes or clones each experiment's `experiment_state.md`, and diagnoses setup or MCP connection errors. Use when starting or cloning an experiment, connecting a new database, changing workspace defaults, or troubleshooting environment/MCP readiness failures. Don't use for generating evaluation datasets, authoring context items, or running evaluations directly./context-engineering-workflowUse this skill when the user is new to context engineering, asks how to get started, or is unsure which peer skill to invoke. Explains the ContextSet concepts (Templates, Facets, Value Searches), the optimization lifecycle, and routes to the right peer skill (init, dataset-generation, bootstrap, evaluate, hillclimb) based on the user's current state.Other plugins' skills for the same job