# Datacheck

> Use when starting work with a new data file, before any analysis or visualization. Also use when encountering parsing errors, unexpected values, or when the user says "check this data" or "what's in this file".

- **Type:** Skill
- **Install:** `agentstack add skill-letitbk-claude-academic-setup-datacheck`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [letitbk](https://agentstack.voostack.com/s/letitbk)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [letitbk](https://github.com/letitbk)
- **Source:** https://github.com/letitbk/claude-academic-setup/tree/main/skills/datacheck

## Install

```sh
agentstack add skill-letitbk-claude-academic-setup-datacheck
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Data Check

Inspect and validate a data file before analysis. Report findings with suggested fixes. Do not auto-fix.

## When to Use

- Before any analysis or visualization on a new data file
- When parsing errors or unexpected values appear
- When switching to a different dataset mid-session
- User says "check", "inspect", "what's in this", "profile" a data file

## When NOT to Use

- File has already been checked in this session and nothing changed
- User just wants to read a specific value (use Read tool directly)

## Workflow

### Step 1: Raw File Inspection

**Before loading into R/Stata**, check the raw file:

```bash
file                           # encoding detection
head -c 500  | cat -v          # hidden chars: ^M (CR), BOM, non-UTF8
wc -l                          # row count sanity check
head -3                        # peek at delimiter and header
```

Flag these issues:
| Symptom | Meaning |
|---------|---------|
| `^M` at line ends | Classic Mac `\r` or Windows `\r\n` line endings |
| `\xEF\xBB\xBF` at start | UTF-8 BOM marker |
| Only 1 line from `wc -l` | Entire file on one line (wrong line endings) |
| Mixed delimiters | Inconsistent separator characters |

### Step 2: Load and Summarize

**R-first.** Use Stata only when the file is `.dta` and project context is Stata-based.

**For CSV files:**
```r
df 50 unique levels)
3. **Flag**: Numeric columns stored as character (likely parsing issue), zero-variance columns, duplicate rows

### Step 6: Report Summary

Present a concise summary with three sections:

**Clean:** Variables ready for analysis (no issues)

**Needs attention:** Variables with potential coded missings, encoding issues, or type problems. Include suggested fix code but do NOT execute.

```r
# SUGGESTED FIX for income_cat coded missings:
df$income_cat[df$income_cat %in% c(97, 98, 99)] <- NA
```

**Notes:** Observations about the data structure (survey weights detected, panel structure, etc.)

## Quick Reference

| File type | Load with | Extra checks |
|-----------|-----------|-------------|
| `.csv` | `read.csv()` | encoding, delimiter, line endings |
| `.tsv` | `read.delim()` | encoding, line endings |
| `.dta` | `haven::read_dta()` | value labels, variable labels, weights, extended missings |
| `.rds` | `readRDS()` | just structure check |

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Loading .dta without haven | Always `library(haven); read_dta()`, never `foreign::read.dta()` |
| Ignoring labelled class | Report label mappings; suggest `as_factor()` or manual recode |
| Assuming 99 = missing | Check if 99 is in the real data range first |
| Skipping raw byte check | ALWAYS run `file` and `cat -v` before loading. Mac CR issues are silent killers |
| Auto-fixing without asking | Report + suggest. Never auto-recode missing values |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [letitbk](https://github.com/letitbk)
- **Source:** [letitbk/claude-academic-setup](https://github.com/letitbk/claude-academic-setup)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-letitbk-claude-academic-setup-datacheck
- Seller: https://agentstack.voostack.com/s/letitbk
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
