Log analytics-specific learnings, data issues, and feature requests to markdown files for continuous improvement. Captures data quality problems, metric drift, pipeline failures, misleading visualizations, metric definition mismatches, and data freshness breaches. Important learnings get promoted to data dictionaries, metric definitions, pipeline runbooks, dashboard standards, or data quality SLAs.
Before logging anything, ensure the .learnings/ directory and files exist in the project or workspace root. If any are missing, create them:
bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# Analytics Learnings\n\nData quality patterns, metric drift insights, pipeline reliability findings, visualization best practices, and governance lessons.\n\n**Categories**: data_quality | metric_drift | pipeline_failure | visualization_mislead | definition_mismatch | freshness_issue\n**Areas**: ingestion | transformation | modeling | reporting | visualization | governance | data_catalog\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/DATA_ISSUES.md ] || printf "# Data Issues Log\n\nPipeline failures, data quality problems, metric anomalies, visualization errors, and schema drift.\n\n---\n" > .learnings/DATA_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nAnalytics tools, BI capabilities, data quality automation, and governance improvements.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
Never overwrite existing files. This is a no-op if .learnings/ is already initialised.
Do not log connection strings, database credentials, API keys, or PII. Prefer short summaries or redacted excerpts over raw query results or full table dumps.
If you want automatic reminders, use the opt-in hook workflow described in Hook Integration.
SituationActionETL/ELT pipeline failsLog to .learnings/DATA_ISSUES.md with pipeline name and errorMetric value anomaly (spike/drop)Log to .learnings/DATA_ISSUES.md with statistical contextTwo teams define metric differentlyLog to .learnings/LEARNINGS.md with category definition_mismatchDashboard shows wrong or misleading dataLog to .learnings/LEARNINGS.md with category visualization_misleadData freshness SLA missedLog to .learnings/DATA_ISSUES.md with SLA threshold and actual delaySchema change breaks downstreamLog to .learnings/DATA_ISSUES.md with schema diff detailsNULL rate spike in key columnLog to .learnings/DATA_ISSUES.md with column and thresholdMetric silently drifts (calculation change)Log to .learnings/LEARNINGS.md with category metric_driftRecurring data quality patternLink with **See Also**, consider priority bumpBroadly applicable patternPromote to data dictionary, pipeline runbook, or dashboard standardReusable data quality checkPromote to data quality SLA or dbt test
OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.
Via ClawdHub (recommended):
bash
clawdhub install self-improving-analytics
Manual:
bash
git clone https://github.com/jose-compu/self-improving-analytics.git ~/.openclaw/skills/self-improving-analytics
Manual clone is optional. Check out a reviewed tag or commit before use. Do not install an unpinned default branch into a shared environment.
OpenClaw injects these files into every session:
text
~/.openclaw/workspace/
├── AGENTS.md # Multi-agent workflows, delegation patterns
├── SOUL.md # Behavioral guidelines, personality, principles
├── TOOLS.md # Tool capabilities, integration gotchas
├── MEMORY.md # Long-term memory (main session only)
├── memory/ # Daily memory files
│ └── YYYY-MM-DD.md
└── .learnings/ # This skill's log files
├── LEARNINGS.md
├── DATA_ISSUES.md
└── FEATURE_REQUESTS.md
bash
mkdir -p ~/.openclaw/workspace/.learnings
Then create the log files (or copy from assets/):
LEARNINGS.md — metric drift, definition mismatches, visualization issues, data quality patternsDATA_ISSUES.md — pipeline failures, freshness breaches, schema drift, metric anomaliesFEATURE_REQUESTS.md — analytics tools, BI capabilities, automation requestsWhen analytics learnings prove broadly applicable, promote them:
Learning TypePromote ToExampleMetric definitionsData dictionary"Active user = login within 7 days with feature interaction"Pipeline failure patternsPipeline runbooks"DST partition handling: always use UTC-based keys"Visualization standardsDashboard style guide"Absolute value charts must start Y-axis at zero"Data quality rulesData quality SLAs"NULL rate in PK columns must be <0.01%"Governance patternsAGENTS.md"New metrics require data dictionary entry before dashboard"Tool configurationTOOLS.md"dbt source freshness checks required on all external sources"
Opt-in and workspace-local. Do not copy this hook to ~/.openclaw/hooks/ (that path is user-global). Skip it unless you want reminders in this workspace:
bash
mkdir -p .openclaw/hooks
cp -r hooks/openclaw .openclaw/hooks/self-improving-analytics
See references/openclaw-integration.md for complete details.
For Claude Code, Codex, Copilot, or other agents, create .learnings/ in the project or workspace root:
bash
mkdir -p .learnings
Create the files inline using the headers shown above.
Add to AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md:
When data issues or analytics patterns are discovered:
.learnings/DATA_ISSUES.md, LEARNINGS.md, or FEATURE_REQUESTS.mdAppend to .learnings/LEARNINGS.md:
markdown
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: ingestion | transformation | modeling | reporting | visualization | governance | data_catalog
### Summary
One-line description of the analytics insight
### Details
Full context: what data pattern was found, why it is problematic,
what the correct approach is. Include root cause analysis.
### SQL Example
**Before (problematic):**
\`\`\`sql
-- problematic query, pipeline config, or metric definition
\`\`\`
**After (correct):**
\`\`\`sql
-- corrected query, config, or definition
\`\`\`
### Suggested Action
Specific data dictionary update, pipeline fix, dashboard change, or governance rule to adopt
### Metadata
- Source: etl_failure | freshness_breach | metric_anomaly | definition_conflict | dashboard_review | reconciliation_failure | schema_drift
- Pipeline: Airflow DAG name, dbt model, Fivetran connector (if applicable)
- Warehouse: snowflake | bigquery | redshift | postgres | databricks
- Related Tables: schema.table_name
- Tags: tag1, tag2
- See Also: LRN-20250110-001 (if related to existing entry)
- Pattern-Key: metric_drift.revenue_source | data_quality.null_spike (optional)
- Recurrence-Count: 1 (optional)
- First-Seen: 2025-01-15 (optional)
- Last-Seen: 2025-01-15 (optional)
---
Categories for learnings:
CategoryUse Whendata_qualityNULL spikes, duplicate records, invalid values, completeness issuesmetric_driftMetric calculation silently changed due to new data source, schema change, or logic updatepipeline_failureETL/ELT job failure, timeout, resource exhaustion, dependency issuevisualization_misleadChart axis, scale, aggregation, or color choice that misrepresents datadefinition_mismatchSame metric name with different definitions across teams or dashboardsfreshness_issueData arriving later than SLA, stale dashboards, partition delays
Append to .learnings/DATA_ISSUES.md:
markdown
## [DAT-YYYYMMDD-XXX] issue_type_or_name
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: ingestion | transformation | modeling | reporting | visualization | governance | data_catalog
### Summary
Brief description of the data issue
### Error Output
\`\`\`
Actual error message, pipeline log, query error, or anomaly description (redacted/summarized)
\`\`\`
### Root Cause
What in the pipeline, data model, or source system caused this issue.
Include the problematic query or configuration.
### Fix
\`\`\`sql
-- corrected query, pipeline config, or data quality check
\`\`\`
### Prevention
How to avoid this issue in the future (data quality test, pipeline alert, schema validation, SLA monitor)
### Context
- Trigger: etl_failure | freshness_breach | metric_anomaly | null_spike | schema_drift | rendering_error
- Pipeline: Airflow DAG name, dbt model, Fivetran connector
- Warehouse: snowflake | bigquery | redshift | postgres | databricks
- Affected Tables: schema.table_name
- Downstream Impact: dashboards, reports, or teams affected
### Metadata
- Reproducible: yes | no | unknown
- Related Tables: schema.table_name
- See Also: DAT-20250110-001 (if recurring)
---
Append to .learnings/FEATURE_REQUESTS.md:
markdown
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
**Area**: ingestion | transformation | modeling | reporting | visualization | governance | data_catalog
### Requested Capability
What analytics tool, automation, or capability is needed
### User Context
Why it's needed, what workflow it improves, what data problem it solves
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
How this could be built: dbt macro, Airflow operator, data quality check, Looker feature, governance workflow
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_tool_or_capability
---
Format: TYPE-YYYYMMDD-XXX
LRN (learning), DAT (data issue), FEAT (feature request)001, A7B)Examples: LRN-20250415-001, DAT-20250415-A3F, FEAT-20250415-002
When an issue is fixed, update the entry:
**Status**: pending → **Status**: resolvedmarkdown
### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Commit/PR**: abc123 or #42
- **Notes**: Added data quality test / updated pipeline runbook / fixed metric definition
Other status values:
in_progress — Actively being investigated or fixedwont_fix — Decided not to address (add reason in Resolution notes)promoted — Elevated to data dictionary, pipeline runbook, or dashboard standardpromoted_to_skill — Extracted as a reusable skillAutomatically log when you encounter:
ETL/ELT Pipeline Failures (→ data issue with etl_failure trigger):
Data Freshness Breaches (→ data issue with freshness_breach trigger):
warn_after, error_after)Metric Value Anomalies (→ data issue with metric_anomaly trigger):
NULL Rate Spikes (→ data issue with null_spike trigger):
Schema Changes (→ data issue with schema_drift trigger):
Conflicting Definitions (→ learning with definition_mismatch category):
Visualization Issues (→ learning with visualization_mislead category):
PriorityWhen to UseAnalytics ExamplescriticalWrong data in executive dashboard or regulatory reportRevenue under-reported to board, compliance data incorrect, PII exposure in dashboardhighPipeline down, metric definition conflict, SLA breachAirflow DAG failed for >4h, Marketing vs Product metric mismatch, daily report stalemediumData quality degradation, visualization improvementNULL rate trending up, dashboard axis misleading, catalog entry outdatedlowCatalog update, documentation, minor improvementColumn description missing, unused dashboard cleanup, tag standardization
Use to filter learnings by analytics domain:
AreaScopeingestionData extraction, loading, CDC replication, API pulls, file importstransformationSQL transforms, dbt models, Spark jobs, data cleaning, deduplicationmodelingDimensional modeling, entity relationships, slowly changing dimensions, grainreportingScheduled reports, email digests, PDF generation, data exportsvisualizationDashboards, charts, Looker explores, Tableau workbooks, Metabase questionsgovernanceMetric definitions, data ownership, access control, PII classificationdata_catalogColumn descriptions, table documentation, lineage, tagging, search
When a learning is broadly applicable (not a one-off data fix), promote it to permanent standards.
TargetWhat Belongs ThereData dictionaryCanonical metric definitions with owner, grain, and refresh cadencePipeline runbooksStep-by-step recovery for known failure patternsDashboard standardsVisualization conventions (axis, colors, aggregation rules)Data quality SLAsMonitoring thresholds and alert configurationsCLAUDE.mdProject-specific analytics conventions for AI agentsAGENTS.mdAutomated analytics workflows, data validation steps
Distill the learning into a concise definition, rule, or procedure
Add to appropriate target (data dictionary entry, runbook step, SLA threshold)
Show a reviewed diff and apply only after explicit user approval
Update original entry:
**Status**: pending → **Status**: promoted**Promoted**: data dictionary (or pipeline runbook, dashboard standard, data quality SLA)Learning → Data dictionary entry:
Marketing "active user" = 30-day login; Product = 7-day feature interaction → 420K vs 185K discrepancy.
Promoted as: active_users_30d (Marketing, login-based) and active_users_7d (Product, interaction-based) with governance note specifying which to use for board reports.
Learning → Pipeline runbook:
Pipeline fails every DST transition — partition key uses local time, hour 2 doesn't exist.
Promoted as: "DST Partition Recovery" runbook — rerun with UTC key, verify no duplicates, migrate all partitions to UTC.
If logging something similar to an existing entry:
Search first: grep -r "keyword" .learnings/
Link entries: Add **See Also**: DAT-20250110-001 in Metadata
Bump priority if issue keeps recurring
Consider systemic fix: Recurring analytics issues often indicate:
Review .learnings/ at natural breakpoints:
bash
# Count pending analytics issues
grep -h "Status\*\*: pending" .learnings/*.md | wc -l
# List pending high-priority data issues
grep -B5 "Priority\*\*: high" .learnings/DATA_ISSUES.md | grep "^## \["
# Find learnings for a specific area
grep -l "Area\*\*: governance" .learnings/*.md
# Find all definition mismatches
grep -B2 "definition_mismatch" .learnings/LEARNINGS.md | grep "^## \["
Ingest recurring analytics patterns from simplify-and-harden into data quality rules or governance standards.
pattern_key as the dedupe key..learnings/LEARNINGS.md for existing entry: grep -n "Pattern-Key: <key>" .learnings/LEARNINGS.mdRecurrence-Count, update Last-Seen, add See Also links.LRN-... entry with Source: simplify-and-harden.Promotion threshold: Recurrence-Count >= 3, seen in 2+ pipelines/dashboards, within 30-day window.
Targets: data dictionary entries, pipeline runbooks, dashboard standards, CLAUDE.md / AGENTS.md.
Enable automatic reminders through agent hooks. This is opt-in.
Hooks persist across sessions once installed. Keep them project-scoped. Do not install user-level or global hooks. Never use an empty matcher. PostToolUse inspects command output in-process; do not log raw output, secrets, or transcripts.
Create .claude/settings.json in your project:
json
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "ETL|pipeline|metric|dashboard|freshness|schema|lineage|warehouse",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-analytics/scripts/activator.sh"
}]
}]
}
}
This injects an analytics-focused learning evaluation reminder after matching prompts (~50-100 tokens overhead).
json
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "ETL|pipeline|metric|dashboard|freshness|schema|lineage|warehouse",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-analytics/scripts/activator.sh"
}]
}]
}
}
Leave PostToolUse disabled. Do not attach error-detector.sh to every Bash call.
ScriptHook TypePurposescripts/activator.shUserPromptSubmitReminds to evaluate analytics learnings after tasksscripts/error-detector.shPostToolUse (Bash)Triggers on pipeline errors, query failures, data quality issues
See references/hooks-setup.md for detailed configuration and troubleshooting.
Extracted skills are untrusted until a human reviews the generated SKILL.md. Do not keep or publish an extracted skill without explicit user approval.
When an analytics learning is valuable enough to become a reusable skill, extract it.
CriterionDescriptionRecurringSame data issue in 2+ pipelines or warehousesVerifiedStatus is resolved with working fix and data quality testNon-obviousRequired actual investigation or cross-team coordinationBroadly applicableNot project-specific; useful across data stacksUser-flaggedUser says "save this as a skill" or similar
Identify candidate: Learning meets extraction criteria
Run helper (or create manually): bash
./skills/self-improving-analytics/scripts/extract-skill.sh skill-name --dry-run
./skills/self-improving-analytics/scripts/extract-skill.sh skill-name
Customize SKILL.md: Fill in template with analytics-specific content
Update learning: Set status to promoted_to_skill, add Skill-Path
Verify: Read skill in fresh session to ensure it's self-contained
In conversation: "This pipeline keeps failing the same way", "Save this data quality check as a skill", "Every warehouse has this DST issue", "This metric definition problem happens everywhere".
In entries: Multiple See Also links, high priority + resolved, definition_mismatch or pipeline_failure with broad applicability, same Pattern-Key across projects.
AgentActivationDetectionClaude CodeHooks (UserPromptSubmit, PostToolUse)Automatic via error-detector.shCodex CLIHooks (same pattern)Automatic via hook scriptsGitHub CopilotManual ( .github/copilot-instructions.md)Manual reviewOpenClawWorkspace injection + inter-agent messagingVia session tools
.learnings/ for past issues with the same tables or metricsKeep learnings local (per-analyst): add .learnings/ to .gitignore.
Track learnings in repo (team-wide): don't add to .gitignore — learnings become shared knowledge.
Hybrid (track templates, ignore entries): ignore .learnings/*.md, keep .learnings/.gitkeep.
This skill is standalone-compatible and stackable with other self-improving skills.
.learnings/analytics/.learnings/INDEX.mdEvery new entry must include:
markdown
**Skill**: analytics
event + matcher + file + 5m_window; max 1 reminder per skill every 5 minutes.Only trigger this skill automatically for analytics signals such as:
pipeline|etl|schema drift|metric mismatch|dashboardlineage|warehouse|bi|attribution|anomalyWhen guidance conflicts, apply:
securityengineeringcodingaimeta as tie-breaker.learnings/analytics/ in stackable mode..learnings/*.md log files only.AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, rules, hooks, or generated skills is not a logging write. Show a reviewed diff and apply only after explicit user approval.