/synthetic-data:evaluate-qualityfrom synthetic-data
Run fidelity, utility, and privacy diagnostics on a synthetic dataset against the real source, generating a markdown report.
Ships in synthetic-data. 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.
None: SKILL.md is the whole skill.
Run comprehensive diagnostics on a synthetic dataset against a real source dataset. Generates fidelity (how well statistics match), utility (usefulness for ML tasks), and privacy (leakage risk) reports. Outputs a markdown summary in reports/<timestamp>/.
tabular or text./synthetic-data-workspace/reports/)text evaluation (for unstructured records)Dependencies: uv run --with sdmetrics --with pandas script.py.
Run fidelity and diagnostic reports:
import pandas as pd
from sdmetrics.reports.single_table import QualityReport, DiagnosticReport
from datetime import datetime
import os
def evaluate_tabular(real_path, synth_path, output_dir):
real_data = pd.read_csv(real_path)
synth_data = pd.read_csv(synth_path)
print(f"Real data shape: {real_data.shape}")
print(f"Synthetic data shape: {synth_data.shape}")
# Quality report (fidelity metrics)
quality_report = QualityReport()
quality_report.generate(real_data, synth_data)
# Diagnostic report (column properties, relationships)
diag_report = DiagnosticReport()
diag_report.generate(real_data, synth_data)
# Save reports as HTML
os.makedirs(output_dir, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
quality_report.save_html(f'{output_dir}/quality_report_{timestamp}.html')
diag_report.save_html(f'{output_dir}/diagnostic_report_{timestamp}.html')
# Extract summary scores
quality_score = quality_report.get_score()
diag_score = diag_report.get_score()
print(f"\nQuality score: {quality_score:.3f}")
print(f"Diagnostic score: {diag_score:.3f}")
return quality_report, diag_report
if __name__ == '__main__':
evaluate_tabular('real_data.csv', 'synthetic_data.csv', './reports')
Generate a markdown summary:
def generate_tabular_report(real_path, synth_path, output_dir, report_name="eval_report.md"):
real_data = pd.read_csv(real_path)
synth_data = pd.read_csv(synth_path)
quality_report = QualityReport()
quality_report.generate(real_data, synth_data)
quality_score = quality_report.get_score()
# Basic statistics comparison
report_md = f"""# Synthetic Data Evaluation Report
This measures how well synthetic data statistics match real data.
| Column | Real Mean | Synth Mean | Real Std | Synth Std |
|---|---|---|---|---|
| """ |
for col in real_data.select_dtypes(include=['number']).columns:
real_mean = real_data[col].mean()
synth_mean = synth_data[col].mean()
real_std = real_data[col].std()
synth_std = synth_data[col].std()
report_md += f"| {col} | {real_mean:.3f} | {synth_mean:.3f} | {real_std:.3f} | {synth_std:.3f} |\n"
report_md += f"""
Compare Pearson correlations between real and synthetic data.
Real data correlation matrix:
{real_data.corr().to_string()}
Synthetic data correlation matrix:
{synth_data.corr().to_string()}
If score < 0.7: Consider refitting with different model/hyperparameters
If score > 0.9: Good fidelity; verify utility on downstream tasks
Always conduct domain-specific validation before production use """
with open(f'{output_dir}/{report_name}', 'w') as f:
f.write(report_md)
print(f"Report saved to {output_dir}/{report_name}")
Dependencies: uv run --with sentence-transformers --with umap-learn --with scikit-learn --with matplotlib script.py (embedding models run on CPU or a GPU box; for large sets use a hosted embedding API rather than a laptop). For quick wording-overlap and near-duplicate numbers on text, check-diversity is enough.
Run embedding distribution and leakage checks:
import json
import numpy as np
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity
import matplotlib.pyplot as plt
def evaluate_text(real_path, synth_path, output_dir):
model = SentenceTransformer('all-MiniLM-L6-v2')
# Load records
with open(real_path) as f:
real_records = [json.loads(line) for line in f]
with open(synth_path) as f:
synth_records = [json.loads(line) for line in f]
# Concatenate all fields for embedding
real_texts = [' '.join(str(v) for v in r.values()) for r in real_records]
synth_texts = [' '.join(str(v) for v in r.values()) for r in synth_records]
# Embed
real_embeddings = model.encode(real_texts, convert_to_numpy=True)
synth_embeddings = model.encode(synth_texts, convert_to_numpy=True)
# Nearest-neighbour leakage check
similarities = cosine_similarity(synth_embeddings, real_embeddings)
max_sims = np.max(similarities, axis=1)
mean_sim = np.mean(max_sims)
report_md = f"""# Synthetic Text Evaluation Report
Measures how closely synthetic records match nearest real records by embedding similarity.
Interpretation:
Flagged records (similarity > 0.8): """
for i, sim in enumerate(max_sims):
if sim > 0.8:
real_idx = np.argmax(similarities[i])
report_md += f"- Synth[{i}] ↔ Real[{real_idx}]: {sim:.3f}\n"
# N-gram diversity
from collections import Counter
import re
def extract_ngrams(texts, n=3):
all_ngrams = Counter()
for text in texts:
tokens = re.findall(r'\w+', text.lower())
for i in range(len(tokens) - n + 1):
ngram = tuple(tokens[i:i+n])
all_ngrams[ngram] += 1
return all_ngrams
real_ngrams = extract_ngrams(real_texts, n=3)
synth_ngrams = extract_ngrams(synth_texts, n=3)
report_md += f"""
If leakage scores > 0.7: Consider re-running synthesis with stricter transformation rules
If diversity low: May need more varied personas or longer generation
Validate semantic quality by manual spot-check of a few records """
with open(f'{output_dir}/text_eval_{datetime.now().strftime("%Y%m%d_%H%M%S")}.md', 'w') as f:
f.write(report_md)
print(f"Report saved")
return {"mean_similarity": mean_sim, "n_gram_diversity": len(synth_ngrams)}
reports/<timestamp>/What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
13 skills in this plugin
/check-diversityMeasure how repetitive a generated text set is (trigram Jaccard, top-word share, per-model breakdown) and remove near-duplicates. Use on "is this too samey", "dedupe the generated data", "diversity check", "check the pilot before scaling"./complementary-pluginsList and install plugins that complement synthetic-data: custom-model-planning, data-annotation. Use on "related plugins"./generate-text-dataGenerate varied, non-repetitive synthetic text in bulk (support tickets, reviews, notes, personas, scenarios, fake messages, training pairs) with any LLM route, using the seed-then-write recipe with model rotation, dedupe and diversity checks. Use on "synthetic data", "generate examples", "make training data", "fake records", "it's too repetitive", or when a generated set looks samey./instruction-and-eval-dataGenerate synthetic instruction/response pairs, fine-tuning examples, and eval inputs (test prompts, edge cases, adversarial or ambiguous requests) for AI models. Use on "make training pairs", "instruction dataset", "generate eval prompts", "test cases for my model", "fine-tuning data"./real-to-synth-llmTransform real text records into synthetic counterparts that preserve semantics while changing specifics, with any LLM route./replace-piiAnonymise a real dataset by replacing PII columns with realistic Faker values, preserving structure and referential integrity.synthetic-data@danielrosehill is listed by danielrosehill/claude-code-plugins — review the source before installing
npx claudepluginhub danielrosehill/claude-code-plugins --plugin synthetic-data