.claude/skills/semantic-validation/SKILL.md
# Skill: Semantic Validation ## Purpose Orchestrate the full 4-layer validation stack plus confidence scoring to produce a comprehensive data quality assessment for any analysis output. ## When to Use - After analysis agents produce findings (before Storytelling agent) - When the Validation agent runs its enhanced checks (Step 5a-5e) - When a user asks "how confident should I be in these results?" ## Invocation Applied automatically as part of the Validation agent workflow. Can also be invoke
npx skillsauth add ai-analyst-lab/ai-analyst .claude/skills/semantic-validationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Orchestrate the full 4-layer validation stack plus confidence scoring to produce a comprehensive data quality assessment for any analysis output.
Applied automatically as part of the Validation agent workflow. Can also be invoked standalone: "Validate the quality of this analysis."
Use helpers/structural_validator.py:
from helpers.structural_validator import (
validate_schema, validate_primary_key,
validate_referential_integrity, validate_completeness
)
# Check schema matches expected structure
schema_result = validate_schema(df, expected_columns, expected_types)
# Check primary key uniqueness
pk_result = validate_primary_key(df, key_columns)
# Check FK references exist in parent table
ri_result = validate_referential_integrity(child_df, parent_df, fk_column, pk_column)
# Check column completeness (null rates)
completeness_result = validate_completeness(df, thresholds={"warn": 0.05, "fail": 0.20})
Flag any FAIL results as BLOCKER — analysis built on broken data is invalid.
Use helpers/logical_validator.py:
from helpers.logical_validator import (
validate_aggregation_consistency, validate_trend_continuity,
validate_segment_exhaustiveness, validate_temporal_consistency
)
# Parts must sum to whole
agg_result = validate_aggregation_consistency(parts_df, total_value, tolerance=0.01)
# No discontinuities in time series
trend_result = validate_trend_continuity(ts_df, date_col, value_col, max_gap_days=7)
# Segments must cover the full population
seg_result = validate_segment_exhaustiveness(segment_df, total_count)
# Date ranges across tables must overlap
temporal_result = validate_temporal_consistency(tables_dict, date_columns)
WARN on logical inconsistencies — they suggest calculation errors.
Use helpers/business_rules.py:
from helpers.business_rules import (
validate_ranges, validate_rates, validate_yoy_change
)
# Check values fall within plausible ranges
range_result = validate_ranges(df, column, min_val, max_val)
# Check rates are 0-100% and denominators > 0
rate_result = validate_rates(numerator, denominator)
# Check YoY changes are plausible (not 10000%)
yoy_result = validate_yoy_change(current, previous, max_change_pct=500)
Flag implausible values as WARN — they may be correct but need explanation.
Use helpers/simpsons_paradox.py:
from helpers.simpsons_paradox import check_simpsons_paradox, scan_dimensions
# Check a specific aggregate vs segment breakdown
paradox = check_simpsons_paradox(df, metric_col, segment_col)
# Scan multiple dimensions for paradox risk
scan = scan_dimensions(df, metric_col, dimension_cols)
BLOCKER on confirmed paradox — the aggregate finding is misleading.
After all 4 layers complete, synthesize results into a confidence score:
from helpers.confidence_scoring import score_confidence, format_confidence_badge
# Collect all validation results
validation_results = {
"structural": [schema_result, pk_result, ri_result, completeness_result],
"logical": [agg_result, trend_result, seg_result, temporal_result],
"business_rules": [range_result, rate_result, yoy_result],
"simpsons_paradox": [paradox_result],
"sample_size": len(df)
}
score = score_confidence(validation_results)
badge = format_confidence_badge(score)
# score returns: {score: 0-100, grade: A-F, factors: {...}, flags: [...]}
# badge returns: "A (92/100)" or "C (58/100) — 2 warnings"
Pass the confidence score and badge to downstream agents:
| Layer | FAIL → | WARN → | |-------|--------|--------| | Structural | BLOCKER (halt analysis) | WARNING (proceed with caution) | | Logical | WARNING (check calculations) | INFO (note in report) | | Business Rules | WARNING (explain outliers) | INFO (note in report) | | Simpson's | BLOCKER (disaggregate) | WARNING (check segments) |
testing
# Skill: {{BLANK_1_SKILL_NAME}} ## Purpose {{BLANK_2_WHEN_TO_FIRE}} ## When to Use Fires automatically when the user asks Claude to do something that matches the trigger condition above. ## Instructions 1. Detect the trigger condition 2. Execute your guardrail check 3. If the check matters, print a clear, visible warning with "{{BLANK_3_SIGNATURE_PHRASE}}" as the first line 4. Continue with the analysis, incorporating the warning into the output ## Anti-Patterns - Do not fire when the condit
development
# Skill: Visualization Patterns ## Purpose Ensure every chart Claude Code produces follows high-quality design standards with named themes, consistent styling, and clear data communication. ## When to Use Apply this skill whenever generating a chart, graph, or data visualization. Always apply the active theme unless the user specifies otherwise. Default theme: `minimal`. ## Instructions ### Pre-flight: Load Learnings Before executing, check `.knowledge/learnings/index.md` for relevant entrie
development
# Skill: Triangulation / Sanity Check ## Purpose Cross-reference analytical findings against multiple data sources, external benchmarks, and common sense to catch errors before they become bad decisions. ## When to Use Apply this skill after every analysis, before presenting findings to stakeholders, and whenever a result seems surprising. If a finding would change a decision, it MUST be triangulated first. ## Instructions ### Triangulation Framework Every finding gets checked through four
data-ai
# Skill: Tracking Gap Identification ## Purpose Assess whether the data needed for an analysis actually exists, identify what's missing, and produce prioritized instrumentation requests for engineering when gaps are found. ## When to Use Apply this skill after the Data Explorer agent inventories available data, when an analysis requires data that might not exist, or when initial query results suggest incomplete tracking. Run before committing to an analysis approach. ## Instructions ### Gap