agentleFS
afelipegafelipeg/Anthropic-Skills-for-enterprise-marketing-os/skills/data-intake-normalizer/SKILL.md

data-intake-normalizer

Skill1 starsChanged 7 months agoMITView on GitHub

Global data intake, validation, and normalization layer for ALL skills in the Agency Growth OS. ALWAYS trigger before any science or analytics skill when input arrives as CSV, XLSX, XLS, TSV, or JSON. Detects target skill from file structure, maps client columns to OS schema, coerces types, handles encoding issues, imputes nulls, and produces a validation report (OK / WARN / BLOCK). Also generates standardized input templates (XLSX) for any OS skill on demand. Trigger when user says: "aquí está el archivo", "te paso el CSV", "valida este Excel", "necesito la plantilla para", "el archivo no carga", "dame el template de", or uploads any data file before running a science skill. BLOCK execution of downstream skill if critical columns are missing.

The file

Files
SKILL.md

Data Intake Normalizer

Pre-requisito global. Corre antes de cualquier science skill cuando el input es un archivo del cliente. Produce data_normalized.csv + validation_report.json. Si el reporte tiene nivel BLOCK → no ejecutar el skill downstream.


Cuándo activar

Cliente sube CSV/XLSX/XLS/TSV/JSON
        ↓
data-intake-normalizer  ← SIEMPRE primero
        ↓
validation_report.json
  OK   → ejecutar skill downstream con data_normalized.csv
  WARN → mostrar advertencias, ejecutar con caveats
  BLOCK → mostrar errores, solicitar corrección, ofrecer template

También activa cuando el usuario pide:

  • "Dame la plantilla para [skill]"
  • "¿Qué formato necesita el archivo?"
  • "El script falla con mi CSV"

Schemas por skill — columnas requeridas / opcionales

Lee references/schemas.md para el schema completo de cada skill. Resumen ejecutivo:

Skill destinoColumnas requeridasColumnas opcionales clave
customer-segmentation-clusteringcustomer_id, transaction_date, amountcategory, brand, channel
customer-lifetime-valuecustomer_id, period, revenue, costretention_flag, channel, cohort
survival-analysis-marketingcustomer_id, event_date, censoreddiscount, emails_sent, segment
response-uplift-modelingcustomer_id, treatment, responsescore, segment, spend, ltv
market-basket-analysistransaction_id, item_idamount, category, timestamp
price-demand-optimizationprice, quantityperiod, competitor_price, promotion
recommender-systemsuser_id, item_id, ratingtimestamp, context, category
mmm-modelingdate, kpi + ≥1 spend_[channel]price_index, promo, seasonality
audience-segmentation-briefcustomer_id, segment, ltvchannel, rfm_score, persona
media-routing-plannerchannel, spend, impressions, conversionscpm, cpa, roas, period
weekly-control-towerdate, kpi, actual, targetchannel, campaign, segment
measurement-incrementalitydate, group (test/control), kpispend, impressions, conversions
crm-journey-architectcustomer_id, event, timestampchannel, segment, value
scope-auditTexto libre (RFP/SOW) — no normalización—
margin-simulationfee, fte_cost, vendor_cost, hourssegment, client, period

Workflow

Step 1 — Detectar archivo

python scripts/schema_detector.py \
    --file /mnt/user-data/uploads/[filename] \
    --output results/detection.json

Output: { target_skill, confidence, detected_columns, file_info }

Step 2 — Mapear columnas

python scripts/column_mapper.py \
    --file /mnt/user-data/uploads/[filename] \
    --target-skill [skill_name] \
    --output results/column_map.json

Output: { mappings: { client_col → os_col }, unmapped, missing_required }

Step 3 — Normalizar tipos + encoding

python scripts/type_coercer.py \
    --file /mnt/user-data/uploads/[filename] \
    --column-map results/column_map.json \
    --output results/data_typed.csv

Handles: fechas (≥15 formatos), montos (comas, símbolos), encodings (UTF-8/latin-1/CP1252/UTF-16)

Step 4 — Manejar nulos

python scripts/null_handler.py \
    --file results/data_typed.csv \
    --target-skill [skill_name] \
    --output results/data_normalized.csv

Estrategias por columna: drop / median / mode / forward-fill / flag

Step 5 — Reporte de validación

python scripts/validation_report.py \
    --normalized results/data_normalized.csv \
    --target-skill [skill_name] \
    --column-map results/column_map.json \
    --output results/validation_report.json

Step 6 — Mostrar resultado al usuario

[show_widget] validation dashboard — siempre antes de ejecutar skill downstream

Generar plantilla (modo alternativo)

python scripts/template_generator.py \
    --skill [skill_name] \
    --output /mnt/user-data/outputs/template_[skill_name].xlsx

Niveles de validación

NivelCondiciónAcción
OKTodas las columnas requeridas presentes, tipos correctos, nulos < 5%Ejecutar skill downstream
WARNColumnas opcionales faltantes, nulos 5–20%, mapeo fuzzy aplicadoEjecutar con caveats visibles
BLOCKColumnas requeridas faltantes, nulos > 20% en columna crítica, encoding irrecuperableDetener. Mostrar errores. Ofrecer plantilla.

Output format — Visualization First

Dashboard panels (ver references/intake_dashboard_template.html):

  1. Status banner — OK / WARN / BLOCK con color
  2. File info — filas, columnas, encoding, tamaño, skill detectado
  3. Column mapping table — cliente col → OS col, con status por columna
  4. Issues list — errores y advertencias con descripción accionable
  5. Preview — primeras 5 filas del archivo normalizado
  6. Next step — botón sendPrompt() al skill downstream si OK/WARN

Marketer Insights Layer

Siempre incluir después del dashboard:

  • Qué columnas se renombraron automáticamente y por qué
  • Qué nulos se imputaron con qué estrategia
  • Cuántas filas quedaron disponibles vs total original
  • Si hay BLOCK: mensaje claro + "Descarga la plantilla correcta" + botón

Reglas de orquestación (OS rules)

Rule #19: ALWAYS run data-intake-normalizer before any science skill
          when input is CSV/XLSX. BLOCK if validation_report = BLOCK.
Rule #20: If client provides data in Google Drive → use Google Drive MCP
          read directly (no upload needed), still run normalization.
Rule #21: If normalization fails 2+ times on same file → offer template
          download for that specific skill automatically.

Reference files

  • references/schemas.md — Schema completo por skill (columnas, tipos, constraints)
  • references/type_rules.md — Reglas de coerción por tipo de dato
  • references/null_strategies.md — Estrategia de imputación por columna y skill
  • references/intake_dashboard_template.html — Dashboard HTML; inject SKILL_DATA_JSON
  • templates/ — Plantillas XLSX pre-generadas por skill (generadas con template_generator.py)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.