/ai-analyst-plus:log-correctionfrom ai-analyst-plus
Records analyst mistakes, fixes, and reusable learnings into a knowledge store to prevent repeating errors. Auto-activates on corrections or teaching signals, and manually via 'log a correction'.
Ships in ai-analyst-plus. 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.
Record analyst mistakes, their fixes, and reusable learnings so future analyses
learn from past errors. Runs in two modes against the same store (defined in
docs/KNOWLEDGE.md): auto mode detects corrections and learnings in the
user's messages without being asked, and manual mode handles explicit
"log a correction" requests with full detail.
Watch every user message for these signals. When one fires, capture it immediately; the user never has to ask.
Correction signals (something you produced was wrong):
Learning signals (a reusable methodology or fact):
If both match, treat it as a correction. If neither matches, do nothing and say nothing about it.
On a correction signal: run Steps 1-5 below, but never interrogate the user. Infer severity, category, dataset, and tables from context; leave fields you cannot infer as null. Acknowledge in one line ("Got it, logged as CORR-008.") and then immediately continue with the user's underlying request; logging is never the whole response.
On a learning signal: append a bullet to .knowledge/learnings/index.md
under the closest category heading (Data Patterns, Query Techniques, Business
Context, Stakeholder Preferences, Visualization Insights, Methodology Notes),
formatted - {concise learning} (source: user feedback, {YYYY-MM-DD}).
Acknowledge in one line ("Noted for future analyses.") and continue with the
user's request.
Auto-mode rules:
Extract from conversation context or ask the user:
critical (wrong numbers shared) | high (changes conclusions) | medium (directionally correct) | low (no impact)If any required field is unclear, ask the user. Do not guess severity.
IMPORTANT: Assign exactly ONE category from the following list. These are the only valid categories — do not create custom categories.
| Category | Description | Examples |
|---|---|---|
sql | Wrong query — bad join, missing filter, incorrect aggregation, wrong GROUP BY, missing WHERE clause | INNER JOIN instead of LEFT JOIN; forgot WHERE clause to filter test users; COUNT(*) instead of COUNT(DISTINCT); aggregation before filtering |
metric | Wrong metric definition — numerator/denominator error, wrong time window, wrong column | Used revenue_usd instead of order_total_usd for GMV; calculated DAU as total events instead of distinct users; wrong date range for YoY comparison |
schema | Wrong column or table reference — stale schema, misnamed field, wrong table | Referenced old_column_name after schema migration; queried staging.users instead of prod.users; assumed column existed but it doesn't |
logic | Flawed reasoning — Simpson's paradox missed, survivorship bias, wrong comparison | Compared current users to all-time users (survivorship bias); aggregated across segments hiding a reversal; compared apples to oranges |
other | Anything that does not fit the above | Data interpretation error, visualization mistake, wrong stakeholder audience |
If the user mentions a category not in this list (e.g., "filter_missing", "metric_definition"), map it to the closest match from the allowed categories above and confirm with the user.
.knowledge/corrections/index.yaml (treat a missing or corrupt file per Rule 3: recreate from scratch)last_correction_id is null, use CORR-001; otherwise
parse the numeric suffix, increment, and zero-pad to 3 digits- id: "CORR-{N}"
date: "{YYYY-MM-DD}"
severity: "{severity}"
category: "{category}"
dataset: "{dataset_name}"
tables: ["{table1}", "{table2}"]
description: "{what was wrong}"
fix: "{what the correct approach is}"
sql_before: "{original query, if applicable, else null}"
sql_after: "{corrected query, if applicable, else null}"
prevented_by: "{which validation layer should have caught this}"
The prevented_by field should reference one of these validation layers:
structural — schema checks, PK validation, null checks, row count validationlogical — aggregation consistency, trend direction, progression rates < 100%business-rules — metric plausibility, known data quality rules, domain constraintsSimpson's check — segment-first analysis to detect reversalssource tie-out — pandas vs DuckDB comparison on foundational metricsExamples of prevented_by:
"logical (progression rates should never exceed 100%)""business-rules (check for test account filtering in conversion metrics)""structural (column validation against schema)".knowledge/corrections/log.yaml (missing or corrupt: recreate per Rule 3)corrections list.knowledge/corrections/index.yaml (already loaded in Step 3)total_correctionsby_severity.{severity} counterby_category.{category} (create the key if it does not exist)last_correction_id to the new IDlast_updated to today's dateReport to the user:
Correction logged: {id}
Severity: {severity} | Category: {category}
Description: {description}
Fix: {fix}
Future analyses will check for this pattern during validation.
log.yaml or index.yaml is missing or corrupt, create from scratch
with schema_version 1sql_before/sql_after should be trimmed to the relevant
clause, not the entire multi-hundred-line queryprevented_by should reference a specific validation layer from the list
in Step 3. Be specific about what check should have caught this.sql_before and sql_after to nulldataset to "unknown" and note in descriptionsql category with description noting the missing filter.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ai-analyst-lab/ai-analyst-plugin --plugin ai-analyst-plus47 skills in this plugin
/always-compareNever present a metric or number in isolation; anchor every number to a comparison (prior period, benchmark, or another segment) or state that none is available. Use every time you show a number: rates, counts, revenue, averages, query results, chart labels, summary stats. Trigger on output containing "the rate is", "we saw", "total", "average", "conversion", "revenue", "users", "sessions", "churn", "AOV", "NPS", or any figure pulled from data./analysis-designTurn a vague hunch or stakeholder request into a rigorous analysis plan via a staged pipeline (hypothesis sharpening, confound scan, V1, feedback, V2 redesign). Trigger on "I think X caused Y", "design an analysis for", "what's driving", "V2 after feedback", "stakeholder comments", "redesign the analysis". Vs question-framing (the lightweight framing gate before every analysis): use THIS only for a real hunch, confound scan, or V1 to V2 redesign./analyst-coreOperating rules for every data analysis. Apply for ANY data-analysis intent: "analyze", "investigate", "why did X change", "compare", "report on", "dashboard", "metrics", "funnel", "retention", "revenue", "conversion", "trend", "segment", "forecast", "how are we doing", "dig into", "break down", or any question about data, a metric, a CSV, or a table. Sets the method and routes to the other skills; load before any analytical question.Other plugins' skills for the same job