home / skills / jinfanzheng / kode-sdk-csharp / data-files

This skill routes uploaded files by type to specialized processors for data-analysis, data-viz, or data-base, enabling seamless delegation.

npx playbooks add skill jinfanzheng/kode-sdk-csharp --skill data-files

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.2 KB
---
name: data-files
description: File router that routes uploaded files to appropriate analysis skills. CSV/Excel/JSON → data-analysis, Images → data-viz, PDF/HTML → data-base.
---

## Mental Model

Files are **routed by type to specialized processors**. This skill is the router - detection and delegation, not processing itself.

## File Routing

| Extension | Routes To | For What |
|-----------|-----------|----------|
| `.csv`, `.xlsx`, `.json` | data-analysis | Statistics, aggregation, patterns |
| `.png`, `.jpg`, `.gif` | data-viz | Chart recognition, visualization |
| `.pdf`, `.html` | data-base | Text extraction, scraping |

## Anti-Patterns (NEVER)

- Don't accept non-ASCII filenames (require rename)
- Don't process unsupported file types
- Don't bypass file size limits (50MB default)

## Upload Flow

1. User uploads file via Web UI
2. Detect type by extension/MIME
3. Inject metadata into message: `[File: name.csv (id) - Type: CSV, Skill: data-analysis]`
4. Activate appropriate skill
5. Return results to user

## Critical Constraints

**Filenames MUST be ASCII-only** (no Chinese/non-ASCII):
- ✅ Good: `data.csv`, `report_2025.xlsx`
- ❌ Bad: `数据.csv`, `報表.pdf`

If non-ASCII filename detected, ask user to rename before processing.

Overview

This skill routes uploaded files to the right analysis skill based on file type. It performs detection, enforces filename and size rules, injects routing metadata, and activates the target processor — it does not perform the actual analysis. The router is lightweight, deterministic, and designed to integrate with event-driven agent runtimes.

How this skill works

When a user uploads a file, the router detects type by extension and MIME and validates constraints (ASCII-only filename, size limit). It maps common extensions (.csv, .xlsx, .json → data-analysis; .png, .jpg, .gif → data-viz; .pdf, .html → data-base), injects a routing metadata message, and triggers the appropriate downstream skill. If validation fails, it returns a clear prompt to the user to fix the issue before retry.

When to use it

  • You need to delegate files to specialized processors rather than handling analysis inside the router
  • Multiple analysis skills exist and files must be dispatched reliably by type
  • You want automatic metadata injection to track file origin and routing decisions
  • You require centralized enforcement of filename and file-size policies
  • You want a simple event-driven handoff into data-analysis, data-viz, or data-base skills

Best practices

  • Require ASCII-only filenames and prompt users to rename non-ASCII files before upload
  • Enforce a file-size cap (default 50MB) and inform users when files exceed the limit
  • Rely on both extension and MIME type for detection to reduce false routing
  • Keep routing logic thin; let specialized skills handle parsing and heavy processing
  • Log injected metadata for traceability: file name, id, detected type, and target skill

Example use cases

  • User uploads sales.csv — router validates name and size, tags it, and activates data-analysis for aggregations
  • Marketing uploads campaign.jpg — router identifies an image and forwards it to data-viz for chart or image-based visualization
  • Researcher uploads report.pdf — router routes to data-base for text extraction and indexing
  • Batch ingest process streams various files; router ensures each file lands in the correct processing pipeline
  • UI flow enforces renaming when a filename contains non-ASCII characters before allowing processing

FAQ

What happens with non-ASCII filenames?

The router rejects them and prompts the user to rename the file using ASCII characters before re-uploading.

Can I change the file-size limit?

Yes. The router uses a configurable limit (default 50MB); change the setting to fit your deployment constraints.

How are routing decisions recorded?

Each routed message includes injected metadata like [File: name (id) - Type: CSV, Skill: data-analysis] for traceability.