Log Correctionのロゴ

Log Correction

組織
ai-analyst-lab
log-correction

Record analyst mistakes, fixes, and reusable learnings so future analyses never repeat an error. Fires automatically when the user corrects work ("actually it's Y", "that's wrong") or teaches a rule ("always use X", "never include test users", "remember that our fiscal year starts in February"), and manually on "log a correction", "save this mistake", "record this lesson". Writes the .knowledge store per docs/KNOWLEDGE.md.

概要

公開者ai-analyst-lab
リポジトリai-analyst-plugin
スキル名log-correction
スター
34
フォーク
13
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    ai-analyst-labがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルLog CorrectionをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ai-analyst-lab/ai-analyst-plugin/tree/main/ai-analyst-plus/skills/log-correction
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ai-analyst-lab/ai-analyst-plugin.git /tmp/ai-analyst-plugin
mkdir -p .claude/skills
cp -r /tmp/ai-analyst-plugin/ai-analyst-plus/skills/log-correction .claude/skills/log-correction
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでLog Correctionを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にLog Correctionを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Log Correctionは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Skill: Log Correction

Purpose

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.

When to Use

  • Auto: the user corrects your work ("that's wrong", "actually it's...", "you used the wrong column") or teaches a reusable rule ("always use X", "never do Y", "remember that our fiscal year starts in February") without asking you to log anything
  • Manual: user says "log a correction", "save this mistake", "record this lesson", or similar
  • After discovering and fixing an error mid-analysis worth preserving

Auto Mode

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):

  • "that's wrong", "that's incorrect", "actually it's...", "it should be..."
  • "the column is X not Y", "you used the wrong...", "off by...", "double-counted", "that join is wrong", "missing a filter", "forgot to exclude..."

Learning signals (a reusable methodology or fact):

  • "always use...", "never use...", "next time...", "prefer X over Y"
  • "remember that...", "the convention here is...", "our team uses...", "going forward...", "don't forget to..."

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:

  1. Silent operation: no execution reports, no "I detected a correction signal", no file-path listings. One brief acknowledgment line, then the analysis.
  2. Never ask "should I log this?" Classify and log.
  3. Never block: if a read or write fails, skip capture and answer the user's question as if nothing happened. Do not retry or announce the failure.
  4. Never fabricate detail; use null for anything not stated by the user.

Manual Mode Instructions

Step 1: Gather Details

Extract from conversation context or ask the user:

  1. What was wrong? — One-sentence description of the error
  2. What is the correct answer? — The fix or corrected approach
  3. Which dataset/tables? — Dataset name and affected table(s)
  4. How severe? — critical (wrong numbers shared) | high (changes conclusions) | medium (directionally correct) | low (no impact)
  5. SQL before/after? — If the error involved a query, capture both versions

If any required field is unclear, ask the user. Do not guess severity.

Step 2: Categorize

IMPORTANT: Assign exactly ONE category from the following list. These are the only valid categories — do not create custom categories.

CategoryDescriptionExamples
sqlWrong query — bad join, missing filter, incorrect aggregation, wrong GROUP BY, missing WHERE clauseINNER JOIN instead of LEFT JOIN; forgot WHERE clause to filter test users; COUNT(*) instead of COUNT(DISTINCT); aggregation before filtering
metricWrong metric definition — numerator/denominator error, wrong time window, wrong columnUsed revenue_usd instead of order_total_usd for GMV; calculated DAU as total events instead of distinct users; wrong date range for YoY comparison
schemaWrong column or table reference — stale schema, misnamed field, wrong tableReferenced old_column_name after schema migration; queried staging.users instead of prod.users; assumed column existed but it doesn't
logicFlawed reasoning — Simpson's paradox missed, survivorship bias, wrong comparisonCompared current users to all-time users (survivorship bias); aggregated across segments hiding a reversal; compared apples to oranges
otherAnything that does not fit the aboveData 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.

Step 3: Write the Correction

  1. Read .knowledge/corrections/index.yaml (treat a missing or corrupt file per Rule 3: recreate from scratch)
  2. Derive next ID: if last_correction_id is null, use CORR-001; otherwise parse the numeric suffix, increment, and zero-pad to 3 digits
  3. Build the entry in exactly this format:
yaml
- 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 validation
  • logical — aggregation consistency, trend direction, progression rates < 100%
  • business-rules — metric plausibility, known data quality rules, domain constraints
  • Simpson's check — segment-first analysis to detect reversals
  • source tie-out — pandas vs DuckDB comparison on foundational metrics

Examples of prevented_by:

  • For wrong aggregation: "logical (progression rates should never exceed 100%)"
  • For missing filter: "business-rules (check for test account filtering in conversion metrics)"
  • For wrong column: "structural (column validation against schema)"
  1. Read .knowledge/corrections/log.yaml (missing or corrupt: recreate per Rule 3)
  2. Append the new entry to the corrections list
  3. Write the YAML back (write the full file in one go so a failed write cannot leave a half-written log)

Step 4: Update Index

  1. Read .knowledge/corrections/index.yaml (already loaded in Step 3)
  2. Increment total_corrections
  3. Increment the matching by_severity.{severity} counter
  4. Increment by_category.{category} (create the key if it does not exist)
  5. Set last_correction_id to the new ID
  6. Set last_updated to today's date
  7. Write the YAML back (full file in one go)

Step 5: Confirm

Report to the user:

Correction logged: {id}
  Severity: {severity} | Category: {category}
  Description: {description}
  Fix: {fix}

Future analyses will check for this pattern during validation.

Rules

  1. Never overwrite existing corrections -- always append
  2. Always read current state before writing (no blind overwrites)
  3. If log.yaml or index.yaml is missing or corrupt, create from scratch with schema_version 1
  4. SQL snippets in sql_before/sql_after should be trimmed to the relevant clause, not the entire multi-hundred-line query
  5. prevented_by should reference a specific validation layer from the list in Step 3. Be specific about what check should have caught this.
  6. ONLY use the 5 allowed categories (sql, metric, schema, logic, other). If the user suggests a different category, map it to the closest match.

Edge Cases

  • No SQL involved: Set sql_before and sql_after to null
  • Dataset unknown: Set dataset to "unknown" and note in description
  • Duplicate correction: Still log it -- repeated errors signal a systemic gap
  • Correction to a correction: Log as a new entry referencing the prior ID in description
  • User suggests custom category: Map to closest allowed category and confirm. Example: "filter_missing" → sql category with description noting the missing filter.

よくある質問

AIスキル「Log Correction」では何ができますか?

Record analyst mistakes, fixes, and reusable learnings so future analyses never repeat an error. Fires automatically when the user corrects work ("actually it's Y", "that's wrong") or teaches a rule ("always use X", "never include test users", "remember that our fiscal year starts in February"), and manually on "log a correction", "save this mistake", "record this lesson". Writes the .knowledge store per docs/KNOWLEDGE.md.

TypingMindでLog Correctionを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Log Correctionはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにLog Correctionをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ai-analyst-lab/ai-analyst-plugin/tree/main/ai-analyst-plus/skills/log-correctionを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Log Correctionを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Log Correctionは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもLog Correctionを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Log Correction」は無料ですか?

はい。ai-analyst-labがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇