Claude Skill

x-analytics-import

Use when X Analytics CSV exports must be inspected, validated, normalized, imported, or compared through a repeatable private-by-default workflow.

LLM Mart · 0 points · 14 views 0 listing impressions 0 install-command copies
Download asimons81-hermes-field-kit-skills_x-analytics-import-367f8a3.zip · 32 KB

Install

skills CLI npx skills add https://github.com/asimons81/hermes-field-kit/tree/main/skills/x-analytics-import
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install asimons81-hermes-field-kit@llmmart
Git git clone https://github.com/asimons81/hermes-field-kit.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole asimons81/hermes-field-kit collection as a plugin from our marketplace. Git is the plain clone.

README

X Analytics Import

A field-tested Hermes skill for validating, normalizing, importing, and comparing X Analytics CSV exports.

Why it exists

X exports contain practical traps: duplicate browser filenames, rolling content windows, partial current days, multi-section video files, changing headers, heuristic post types, and metrics with different scopes. This skill turns that work into a deterministic local pipeline instead of a one-off spreadsheet ritual.

The public bundle was derived from a repeatedly used private workflow. It contains no real exports, account history, personal lane rules, private paths, source hashes, credentials, or unpublished strategy.

What it does

  • Detects overview, content, and video schemas
  • Validates columns, dates, numeric cells, duplicates, and coverage
  • Normalizes rows into versioned snapshots
  • Detects likely partial current days
  • Classifies post type with method and confidence
  • Applies optional deterministic lane rules
  • Calculates robust statistics and IQR outliers
  • Prevents duplicate imports with SHA-256 manifests
  • Compares snapshots on matched dates and post IDs
  • Generates local analysis and public-safe methodology reports

Requirements

  • Python 3.11 or newer
  • No third-party Python packages
  • Local X Analytics CSV exports

Install

Install through Hermes Field Kit as a tap using the command supported by your Hermes version, or copy skills/x-analytics-import into your local Hermes skills directory. Start a new Hermes session after installation because skill discovery may be cached.

Manual install from a clone:

cp -R skills/x-analytics-import ~/.hermes/skills/

PowerShell:

$destination = Join-Path $env:LOCALAPPDATA "hermes\skills"
New-Item -ItemType Directory -Force $destination | Out-Null
Copy-Item -Recurse "skills\x-analytics-import" $destination

First run

The first completed import establishes the baseline:

inspect -> validate-only -> dry-run -> full-import

Then run the same source set once with incremental-import. The expected result is already_imported, proving idempotency.

See First baseline.

Later runs

Every new export set follows:

inspect -> validate-only -> dry-run -> incremental-import -> compare-snapshots

Compare against the immediately previous completed snapshot using overlapping dates and matched post IDs. See Recurring refresh.

Configuration

The importer works without a config file. With no lane rules, posts fall into Unclassified.

To customize behavior, copy config.example.json to a private local path and edit that copy. Do not put personal rules or private thresholds into a public repository.

Inputs

  • Account overview CSV
  • Content analytics CSV
  • Optional video overview CSV

Current X video exports may contain a daily overview table followed by a separate Your videos table. The importer reads the daily overview section and stops at the next section boundary.

Outputs

Write modes create:

<output-dir>/
├── manifests/
├── snapshots/
└── reports/

Reports include validation, reconciliation, classification, local analysis, and a public-safe methodology summary. Raw CSVs are never copied.

Privacy

Raw rows, normalized rows, post text, post links, source paths, hashes, lane findings, and revenue fields are sensitive by default. The public-safe report excludes exact analytics and content.

The tool never uploads data, calls a network service, updates Git, or publishes results.

Limitations

  • Post type is heuristic unless the export gains an authoritative type column.
  • Lane quality depends on user-defined rules.
  • Content and overview metrics have different scopes and are not forced into false equality.
  • A public-safe report is a disclosure aid, not automatic publication permission.
  • The importer does not download exports from X.

Testing

python -B -m unittest discover -s skills/x-analytics-import/tests -v
python scripts/validate.py
python -m unittest discover -s tests -v

All importer fixtures are synthetic.

Version history

1.0.0

  • Initial public release
  • Baseline and recurring import workflows
  • Idempotent manifests and snapshots
  • Schema validation, partial-day detection, reconciliation, classification, robust statistics, comparison, and privacy guards

Skill manifest

X Analytics Import

Overview

Use this skill to turn X Analytics CSV exports into validated, normalized, private local snapshots. The deterministic engine is scripts/x_analytics_import.py; it uses only the Python standard library and has no network, browser, Git, or publishing side effects.

The operating rule is simple:

first run: inspect -> validate-only -> dry-run -> full-import
later runs: inspect -> validate-only -> dry-run -> incremental-import -> compare

Read references/operations.md only when command detail or recovery guidance is needed.

When to Use

Use this skill when:

  • Overview, content, or video analytics CSVs are available locally.
  • A first normalized baseline must be established.
  • New exports must be added without duplicating prior imports.
  • Two snapshots must be compared using matched coverage.
  • Lane rules changed and historical posts must be reclassified.

Do not use this skill when:

  • The exports still need to be downloaded from X.
  • The task is to post, reply, follow, message, or modify an X account.
  • The data comes from GA4, Search Console, or another analytics product.
  • The user wants raw exports copied into Git or published.

Safety Contract

  1. Treat raw exports, normalized rows, post text, post links, source hashes, revenue fields, and lane results as sensitive.
  2. Select exact files by path, date coverage, and modification time. Never trust alphabetical glob order.
  3. Run inspect, validate-only, and dry-run before every write mode.
  4. Store outputs outside repositories, normally under ~/.hermes/data/x-analytics-import.
  5. Never copy, rename, overwrite, stage, commit, or publish raw CSVs.
  6. Never use --force unless the user explicitly requests an identical re-import.
  7. A successful import does not authorize updates to notes, dashboards, websites, or Git.

Modes

Mode Purpose Writes
inspect Detect export type, schema, hash, rows, and coverage No
validate-only Run structural and semantic checks No
dry-run Execute the complete pipeline without artifacts No
full-import Create the first baseline or deliberate rebuild Yes
incremental-import Add a new source set only when hashes differ Yes
compare-snapshots Compare matched dates and post IDs No
rebuild-classification Reapply lane rules without reparsing CSVs Yes

Workflow

1. Identify the exact export set

Expected file families:

account_overview_analytics*.csv
account_analytics_content_<start>_<end>.csv
video_overview_analytics*.csv

Video is optional. Confirm the files belong to the intended export run. Chrome suffixes such as (1) are not chronology.

Completion criterion: every selected file has an exact path, plausible coverage, and no stale duplicate has been substituted.

2. Choose the run type

  • No completed manifest exists: follow First baseline.
  • A completed manifest exists and the exports are newer: follow Recurring refresh.
  • The same source hashes already exist: stop at already_imported.

Completion criterion: the agent can name the prior import ID or state that no baseline exists.

3. First baseline

Run, in order:

inspect
validate-only
dry-run
full-import

Use the same exact file paths for all four stages. Stop before full-import when validation fails, reconciliation fails, or file pairing is doubtful.

After full-import, verify:

  • A completed manifest and normalized snapshot exist.
  • Validation, reconciliation, classification, analysis, and public-safe reports exist.
  • Manifest hashes match the selected inputs.
  • Date coverage and partial-day status are recorded.
  • Re-running the same files with incremental-import returns already_imported.

Completion criterion: one verified baseline exists and duplicate protection is proven.

4. Recurring refresh

Run, in order:

inspect
validate-only
dry-run
incremental-import
compare-snapshots

Use incremental-import for ordinary future runs. If it returns already_imported, do not force a duplicate and do not create a comparison.

Compare the new snapshot against the previous completed snapshot. Use the original baseline only for a separate long-range view.

Comparison rules:

  • Use overlapping overview dates.
  • Use matched post IDs for post-level deltas.
  • Report new and removed post IDs separately.
  • Do not subtract whole rolling-window totals when coverage differs.

Completion criterion: a new import is either safely rejected as duplicate or written once and compared on matched coverage.

5. Interpret the result

Use medians, p25, p75, p90, sample sizes, and IQR outliers. Separate originals, replies, quotes, reposts, and unknown types. Treat CSV-only post type as heuristic. Preserve Uncertain lane results rather than forcing a winner.

Exclude detected partial dates from default statistics. State confidence and source coverage. Do not claim causation from correlation.

Completion criterion: every recommendation includes evidence, sample size, confidence, and outlier context.

6. Report without leaking data

Return operational status first:

  • selected filenames
  • import status and import ID
  • validation and reconciliation status
  • partial-day status
  • artifact paths
  • idempotency result
  • warnings requiring attention

Exact metrics, post content, source hashes, revenue, and strategy findings remain local unless the user explicitly requests them.

Completion criterion: the response is useful without exposing sensitive values by default.

Command Pattern

python "<skill-dir>/scripts/x_analytics_import.py" <mode>   --overview "<overview.csv>"   --content "<content.csv>"   --video "<video.csv>"   --config "<local-config.json>"   --output-dir "<private-output-dir>"   --json

Omit --video or --config when unused. Copy references/config.example.json to a private local path before customizing lane rules.

Snapshot comparison:

python "<skill-dir>/scripts/x_analytics_import.py" compare-snapshots   --snapshot-a "<older.json>"   --snapshot-b "<newer.json>"   --json

Failure Gates

Stop before a write mode when:

  • Required columns are missing.
  • Dates or numeric values are malformed.
  • Duplicate post IDs are present.
  • Content extends beyond overview coverage.
  • Files appear to come from different export runs.
  • The output path is inside a repository.

Warnings such as an X filename window starting before the first actual content row may be acceptable when actual row coverage and end dates align. Explain the warning rather than silently discarding it.

Common Pitfalls

  1. Using full-import every time. Use it once for the baseline; use incremental-import afterward.
  2. Selecting the alphabetically last download. Inspect exact paths, timestamps, hashes, and coverage.
  3. Assuming the newest day is complete. Use recorded partial-day detection.
  4. Comparing unlike windows. Compare overlapping dates and matched post IDs.
  5. Treating content metrics as daily account totals. Content rows are keyed by publish date and are not directly comparable to daily overview totals.
  6. Forcing lane or post-type certainty. Preserve uncertainty and confidence labels.
  7. Publishing the local analysis report. Use the public-safe report as the disclosure starting point.
  8. Using real exports as fixtures. Tests must remain synthetic.

Verification Checklist

  • The exact overview and content paths are recorded
  • Video is included only when compatible and current
  • inspect, validate-only, and dry-run completed first
  • Baseline uses full-import; later runs use incremental-import
  • Validation has no errors
  • Reconciliation has no unresolved failure
  • Output is outside every repository
  • Manifest hashes match the selected sources
  • Partial-day status is recorded
  • Duplicate re-import returns already_imported
  • Comparisons use matched coverage
  • Public-safe output excludes sensitive values
  • Raw CSVs were not copied, staged, committed, or published
Files (hermes-field-kit)
  • examples
    • first-baseline.md 834 B
      Loading…
    • recurring-refresh.md 868 B
      Loading…
    • validation-failure.md 523 B
      Loading…
  • references
    • config.example.json 1.1 KB
      Loading…
    • export-formats.md 1.4 KB
      Loading…
    • operations.md 3.5 KB
      Loading…
    • privacy.md 1.3 KB
      Loading…
  • scripts
    • x_analytics_import.py 64.5 KB
      Loading…
  • tests
    • fixtures
      • content-valid.csv 1.4 KB · in bundle
      • duplicate-post-ids.csv 450 B · in bundle
      • malformed-values.csv 214 B · in bundle
      • missing-columns.csv 41 B · in bundle
      • overview-aliases.csv 140 B · in bundle
      • overview-valid.csv 799 B · in bundle
      • unknown-columns.csv 225 B · in bundle
      • video-valid.csv 392 B · in bundle
    • cases.json 2.5 KB
      Loading…
    • test_x_analytics_import.py 13.7 KB
      Loading…
  • README.md 4.4 KB
    # X Analytics Import
    
    A field-tested Hermes skill for validating, normalizing, importing, and comparing X Analytics CSV exports.
    
    ## Why it exists
    
    X exports contain practical traps: duplicate browser filenames, rolling content windows, partial current days, multi-section video files, changing headers, heuristic post types, and metrics with different scopes. This skill turns that work into a deterministic local pipeline instead of a one-off spreadsheet ritual.
    
    The public bundle was derived from a repeatedly used private workflow. It contains no real exports, account history, personal lane rules, private paths, source hashes, credentials, or unpublished strategy.
    
    ## What it does
    
    - Detects overview, content, and video schemas
    - Validates columns, dates, numeric cells, duplicates, and coverage
    - Normalizes rows into versioned snapshots
    - Detects likely partial current days
    - Classifies post type with method and confidence
    - Applies optional deterministic lane rules
    - Calculates robust statistics and IQR outliers
    - Prevents duplicate imports with SHA-256 manifests
    - Compares snapshots on matched dates and post IDs
    - Generates local analysis and public-safe methodology reports
    
    ## Requirements
    
    - Python 3.11 or newer
    - No third-party Python packages
    - Local X Analytics CSV exports
    
    ## Install
    
    Install through Hermes Field Kit as a tap using the command supported by your Hermes version, or copy `skills/x-analytics-import` into your local Hermes skills directory. Start a new Hermes session after installation because skill discovery may be cached.
    
    Manual install from a clone:
    
    ```bash
    cp -R skills/x-analytics-import ~/.hermes/skills/
    ```
    
    PowerShell:
    
    ```powershell
    $destination = Join-Path $env:LOCALAPPDATA "hermes\skills"
    New-Item -ItemType Directory -Force $destination | Out-Null
    Copy-Item -Recurse "skills\x-analytics-import" $destination
    ```
    
    ## First run
    
    The first completed import establishes the baseline:
    
    ```text
    inspect -> validate-only -> dry-run -> full-import
    ```
    
    Then run the same source set once with `incremental-import`. The expected result is `already_imported`, proving idempotency.
    
    See [First baseline](examples/first-baseline.md).
    
    ## Later runs
    
    Every new export set follows:
    
    ```text
    inspect -> validate-only -> dry-run -> incremental-import -> compare-snapshots
    ```
    
    Compare against the immediately previous completed snapshot using overlapping dates and matched post IDs. See [Recurring refresh](examples/recurring-refresh.md).
    
    ## Configuration
    
    The importer works without a config file. With no lane rules, posts fall into `Unclassified`.
    
    To customize behavior, copy [config.example.json](references/config.example.json) to a private local path and edit that copy. Do not put personal rules or private thresholds into a public repository.
    
    ## Inputs
    
    - Account overview CSV
    - Content analytics CSV
    - Optional video overview CSV
    
    Current X video exports may contain a daily overview table followed by a separate `Your videos` table. The importer reads the daily overview section and stops at the next section boundary.
    
    ## Outputs
    
    Write modes create:
    
    ```text
    <output-dir>/
    ├── manifests/
    ├── snapshots/
    └── reports/
    ```
    
    Reports include validation, reconciliation, classification, local analysis, and a public-safe methodology summary. Raw CSVs are never copied.
    
    ## Privacy
    
    Raw rows, normalized rows, post text, post links, source paths, hashes, lane findings, and revenue fields are sensitive by default. The public-safe report excludes exact analytics and content.
    
    The tool never uploads data, calls a network service, updates Git, or publishes results.
    
    ## Limitations
    
    - Post type is heuristic unless the export gains an authoritative type column.
    - Lane quality depends on user-defined rules.
    - Content and overview metrics have different scopes and are not forced into false equality.
    - A public-safe report is a disclosure aid, not automatic publication permission.
    - The importer does not download exports from X.
    
    ## Testing
    
    ```bash
    python -B -m unittest discover -s skills/x-analytics-import/tests -v
    python scripts/validate.py
    python -m unittest discover -s tests -v
    ```
    
    All importer fixtures are synthetic.
    
    ## Version history
    
    ### 1.0.0
    
    - Initial public release
    - Baseline and recurring import workflows
    - Idempotent manifests and snapshots
    - Schema validation, partial-day detection, reconciliation, classification, robust statistics, comparison, and privacy guards
    
  • SKILL.md 8.4 KB
    ---
    name: x-analytics-import
    description: Use when X Analytics CSV exports must be inspected, validated, normalized, imported, or compared through a repeatable private-by-default workflow.
    version: 1.0.0
    author: Tony Simons
    license: Apache-2.0
    platforms: [linux, macos, windows]
    metadata:
      hermes:
        category: data-analysis
        tags: [x, analytics, csv, validation, statistics, privacy]
        related_skills: []
    ---
    
    # X Analytics Import
    
    ## Overview
    
    Use this skill to turn X Analytics CSV exports into validated, normalized, private local snapshots. The deterministic engine is `scripts/x_analytics_import.py`; it uses only the Python standard library and has no network, browser, Git, or publishing side effects.
    
    The operating rule is simple:
    
    ```text
    first run: inspect -> validate-only -> dry-run -> full-import
    later runs: inspect -> validate-only -> dry-run -> incremental-import -> compare
    ```
    
    Read `references/operations.md` only when command detail or recovery guidance is needed.
    
    ## When to Use
    
    Use this skill when:
    
    - Overview, content, or video analytics CSVs are available locally.
    - A first normalized baseline must be established.
    - New exports must be added without duplicating prior imports.
    - Two snapshots must be compared using matched coverage.
    - Lane rules changed and historical posts must be reclassified.
    
    Do not use this skill when:
    
    - The exports still need to be downloaded from X.
    - The task is to post, reply, follow, message, or modify an X account.
    - The data comes from GA4, Search Console, or another analytics product.
    - The user wants raw exports copied into Git or published.
    
    ## Safety Contract
    
    1. Treat raw exports, normalized rows, post text, post links, source hashes, revenue fields, and lane results as sensitive.
    2. Select exact files by path, date coverage, and modification time. Never trust alphabetical glob order.
    3. Run `inspect`, `validate-only`, and `dry-run` before every write mode.
    4. Store outputs outside repositories, normally under `~/.hermes/data/x-analytics-import`.
    5. Never copy, rename, overwrite, stage, commit, or publish raw CSVs.
    6. Never use `--force` unless the user explicitly requests an identical re-import.
    7. A successful import does not authorize updates to notes, dashboards, websites, or Git.
    
    ## Modes
    
    | Mode | Purpose | Writes |
    |---|---|---:|
    | `inspect` | Detect export type, schema, hash, rows, and coverage | No |
    | `validate-only` | Run structural and semantic checks | No |
    | `dry-run` | Execute the complete pipeline without artifacts | No |
    | `full-import` | Create the first baseline or deliberate rebuild | Yes |
    | `incremental-import` | Add a new source set only when hashes differ | Yes |
    | `compare-snapshots` | Compare matched dates and post IDs | No |
    | `rebuild-classification` | Reapply lane rules without reparsing CSVs | Yes |
    
    ## Workflow
    
    ### 1. Identify the exact export set
    
    Expected file families:
    
    ```text
    account_overview_analytics*.csv
    account_analytics_content_<start>_<end>.csv
    video_overview_analytics*.csv
    ```
    
    Video is optional. Confirm the files belong to the intended export run. Chrome suffixes such as `(1)` are not chronology.
    
    Completion criterion: every selected file has an exact path, plausible coverage, and no stale duplicate has been substituted.
    
    ### 2. Choose the run type
    
    - No completed manifest exists: follow **First baseline**.
    - A completed manifest exists and the exports are newer: follow **Recurring refresh**.
    - The same source hashes already exist: stop at `already_imported`.
    
    Completion criterion: the agent can name the prior import ID or state that no baseline exists.
    
    ### 3. First baseline
    
    Run, in order:
    
    ```text
    inspect
    validate-only
    dry-run
    full-import
    ```
    
    Use the same exact file paths for all four stages. Stop before `full-import` when validation fails, reconciliation fails, or file pairing is doubtful.
    
    After `full-import`, verify:
    
    - A completed manifest and normalized snapshot exist.
    - Validation, reconciliation, classification, analysis, and public-safe reports exist.
    - Manifest hashes match the selected inputs.
    - Date coverage and partial-day status are recorded.
    - Re-running the same files with `incremental-import` returns `already_imported`.
    
    Completion criterion: one verified baseline exists and duplicate protection is proven.
    
    ### 4. Recurring refresh
    
    Run, in order:
    
    ```text
    inspect
    validate-only
    dry-run
    incremental-import
    compare-snapshots
    ```
    
    Use `incremental-import` for ordinary future runs. If it returns `already_imported`, do not force a duplicate and do not create a comparison.
    
    Compare the new snapshot against the previous completed snapshot. Use the original baseline only for a separate long-range view.
    
    Comparison rules:
    
    - Use overlapping overview dates.
    - Use matched post IDs for post-level deltas.
    - Report new and removed post IDs separately.
    - Do not subtract whole rolling-window totals when coverage differs.
    
    Completion criterion: a new import is either safely rejected as duplicate or written once and compared on matched coverage.
    
    ### 5. Interpret the result
    
    Use medians, p25, p75, p90, sample sizes, and IQR outliers. Separate originals, replies, quotes, reposts, and unknown types. Treat CSV-only post type as heuristic. Preserve `Uncertain` lane results rather than forcing a winner.
    
    Exclude detected partial dates from default statistics. State confidence and source coverage. Do not claim causation from correlation.
    
    Completion criterion: every recommendation includes evidence, sample size, confidence, and outlier context.
    
    ### 6. Report without leaking data
    
    Return operational status first:
    
    - selected filenames
    - import status and import ID
    - validation and reconciliation status
    - partial-day status
    - artifact paths
    - idempotency result
    - warnings requiring attention
    
    Exact metrics, post content, source hashes, revenue, and strategy findings remain local unless the user explicitly requests them.
    
    Completion criterion: the response is useful without exposing sensitive values by default.
    
    ## Command Pattern
    
    ```bash
    python "<skill-dir>/scripts/x_analytics_import.py" <mode>   --overview "<overview.csv>"   --content "<content.csv>"   --video "<video.csv>"   --config "<local-config.json>"   --output-dir "<private-output-dir>"   --json
    ```
    
    Omit `--video` or `--config` when unused. Copy `references/config.example.json` to a private local path before customizing lane rules.
    
    Snapshot comparison:
    
    ```bash
    python "<skill-dir>/scripts/x_analytics_import.py" compare-snapshots   --snapshot-a "<older.json>"   --snapshot-b "<newer.json>"   --json
    ```
    
    ## Failure Gates
    
    Stop before a write mode when:
    
    - Required columns are missing.
    - Dates or numeric values are malformed.
    - Duplicate post IDs are present.
    - Content extends beyond overview coverage.
    - Files appear to come from different export runs.
    - The output path is inside a repository.
    
    Warnings such as an X filename window starting before the first actual content row may be acceptable when actual row coverage and end dates align. Explain the warning rather than silently discarding it.
    
    ## Common Pitfalls
    
    1. **Using `full-import` every time.** Use it once for the baseline; use `incremental-import` afterward.
    2. **Selecting the alphabetically last download.** Inspect exact paths, timestamps, hashes, and coverage.
    3. **Assuming the newest day is complete.** Use recorded partial-day detection.
    4. **Comparing unlike windows.** Compare overlapping dates and matched post IDs.
    5. **Treating content metrics as daily account totals.** Content rows are keyed by publish date and are not directly comparable to daily overview totals.
    6. **Forcing lane or post-type certainty.** Preserve uncertainty and confidence labels.
    7. **Publishing the local analysis report.** Use the public-safe report as the disclosure starting point.
    8. **Using real exports as fixtures.** Tests must remain synthetic.
    
    ## Verification Checklist
    
    - [ ] The exact overview and content paths are recorded
    - [ ] Video is included only when compatible and current
    - [ ] `inspect`, `validate-only`, and `dry-run` completed first
    - [ ] Baseline uses `full-import`; later runs use `incremental-import`
    - [ ] Validation has no errors
    - [ ] Reconciliation has no unresolved failure
    - [ ] Output is outside every repository
    - [ ] Manifest hashes match the selected sources
    - [ ] Partial-day status is recorded
    - [ ] Duplicate re-import returns `already_imported`
    - [ ] Comparisons use matched coverage
    - [ ] Public-safe output excludes sensitive values
    - [ ] Raw CSVs were not copied, staged, committed, or published
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.