git clone https://github.com/ai-analyst-lab/ai-analyst
T=$(mktemp -d) && git clone --depth=1 https://github.com/ai-analyst-lab/ai-analyst "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/skills/feedback-capture" ~/.claude/skills/ai-analyst-lab-ai-analyst-feedback-capture && rm -rf "$T"
.claude/skills/feedback-capture/skill.mdSkill: Feedback Capture
Purpose
Pre-router interceptor that runs BEFORE the Question Router on every user message. Detects correction signals, methodology learnings, and positive feedback, captures them to
.knowledge/, then passes through to normal routing.
When to Use
- On every incoming user message, before Question Router classification
- Runs silently — the user should never notice this skill executing
Instructions
Step 0: Intercept (runs before Question Router)
Wrap all detection and capture logic in try/except. If anything fails, log nothing and pass the message through to the Question Router unchanged. Never block the pipeline.
Step 1: Detect feedback type
Scan the user's message for these signal patterns:
Correction signals (user says something was wrong):
- "that's wrong", "that's incorrect", "actually it's...", "it should be..."
- "the column is X not Y", "that number should be...", "you used the wrong..."
- "off by...", "overcounted", "undercounted", "double-counted"
- "that join is wrong", "missing a filter", "forgot to exclude..."
Learning signals (user teaches a reusable methodology):
- "next time...", "always use...", "never use...", "prefer X over Y"
- "the convention here is...", "our team uses...", "don't forget to..."
- "a better approach would be...", "going forward...", "remember that..."
Positive signals (user confirms correctness):
- "that's right", "exactly", "perfect", "good analysis", "looks good"
No signal: No pattern matched. If multiple match, prioritize: Correction > Learning > Positive.
Step 2: Act on detection
If Correction detected:
- Read
to get.knowledge/corrections/index.yaml
.last_correction_id - Compute next ID: increment the numeric suffix (e.g.,
->CORR-001
). IfCORR-002
is null, start atlast_correction_id
.CORR-001 - Estimate severity from context:
- critical: Wrong conclusion presented to stakeholders
- high: Wrong numbers in output, incorrect joins affecting results
- medium: Wrong column, filter, or metric definition used
- low: Minor label, formatting, or naming issue
- Classify category:
|join_error
|filter_missing
|metric_definition
|date_range
|aggregation
|schema
|logicother - Read
..knowledge/corrections/log.yaml - Append a new entry to the
list:corrections
Fill- id: "CORR-{N}" date: "{TODAY}" severity: "{estimated}" category: "{classified}" dataset: "{active dataset or null}" tables: [] description: "{what the user said was wrong}" fix: "{what the user said is correct}" sql_before: null sql_after: null prevented_by: null
,tables
,sql_before
, andsql_after
only if the user's message contains enough detail. Leave null otherwise.prevented_by - Write updated
.log.yaml - Update
: increment.knowledge/corrections/index.yaml
, increment the matchingtotal_corrections
andby_severity
counts, setby_category
andlast_correction_id
.last_updated - Acknowledge briefly: "Got it, logged as {ID}." Then continue processing the user's underlying request normally.
If Learning detected:
- Read
..knowledge/learnings/index.md - Classify into one of the six categories:
- Data Patterns | Query Techniques | Business Context | Stakeholder Preferences | Visualization Insights | Methodology Notes
- Append a bullet point under the matching
heading. Format:### {N}. {Category}- {concise learning} (source: user feedback, {TODAY}) - Write updated
.index.md - Acknowledge briefly: "Noted for future analyses." Then continue processing the user's underlying request normally.
If Positive feedback detected:
Acknowledge briefly ("Thanks!" or similar one-liner) and continue processing the rest of the message normally. No file writes needed.
If No signal detected:
Pass through silently. Do NOT say "I didn't detect feedback." Proceed directly to the Question Router.
Error handling
All detection and capture logic MUST be wrapped in try/except. If file reads or writes fail, skip capture entirely and proceed to routing. The analyst's primary job is answering questions, not bookkeeping.
Anti-Patterns
- Never block the pipeline -- if capture fails, pass through silently
- Never ask the user to confirm feedback type -- classify silently
- Never announce "no feedback detected" -- pass through without comment
- Never do heavy processing -- pattern match and write, nothing more
- Never overwrite existing corrections -- always append
- Never fabricate correction details -- use null for fields you cannot infer