stata-mcp: Skill for Claude Code

.claude/skills/stata/SKILL.md

stata is a skill for Claude Code from aliveranme/stata-mcp. It costs 281 tokens per session (8,336 once invoked), scanned A, original, MIT.

A Stata data-analysis and econometrics skill that writes Stata commands and do-files and runs them in a local Stata installation. Stata is software for statistics; a do-file is a script containing Stata commands.

In plain words
What is it for?
Loading and cleaning data, exploring variables, producing descriptive statistics and tables, running regressions and hypothesis tests, analysing panel or time-series data, using instrumental variables, evaluating policies with difference-in-differences, performing robustness checks, and exporting results.
Why use it?
It supports repeatable analysis while keeping data loaded in a persistent Stata session, and helps avoid common mistakes such as using unknown variable names or producing unnecessarily large output.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is aliveranme/stata-mcp's own configuration. It tells Claude Code how to work on stata-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything stata-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to aliveranme/stata-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/aliveranme/stata-mcp/master/.claude/skills/stata/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/aliveranme/stata-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for stata

README.md
[![agentmods](https://agentmods.dev/badge/skills/aliveranme/stata-mcp/stata/github.svg)](https://agentmods.dev/skills/aliveranme/stata-mcp/stata)
Your own site
<a href="https://agentmods.dev/skills/aliveranme/stata-mcp/stata"><img src="https://agentmods.dev/badge/skills/aliveranme/stata-mcp/stata/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for stata

Your own site · 80×15
<a href="https://agentmods.dev/skills/aliveranme/stata-mcp/stata"><img src="https://agentmods.dev/badge/skills/aliveranme/stata-mcp/stata.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 281 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,336 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00281 $0.08336
Opus 5 $0.00140 $0.04168
Sonnet 5 $0.00056 $0.01667
Haiku 4.5 $0.00028 $0.00834

Measured 10d ago against content hash 4207419188fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

stata scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/stata/SKILL.md · 486 lines

How it starts

The opening of the file, as written. The whole thing — 486 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Stata 数据分析与计量经济学编程

概述

此 Skill 指导你撰写正确的 Stata 命令和 do 文件,并通过 MCP Server (stata) 在本地 StataNow 19 MP 环境中实时执行。你可以独立完成数据加载、清洗、分析、 结果输出全流程。

MCP Server 信息:

  • 名称:stata,75 个工具覆盖数据管理/生成、数据清洗、探索、估计、后估计、图形导出、文件资源回传、包管理与帮助、会话生命周期、长任务控制;stata_run + stata_help 覆盖全部内置命令
  • Stata 版本:StataNow 19 / Stata 18+(取决于安装的版本)
  • 连接方式:本地 stdio,通过 pystata 直接调用 DLL
  • 会话持久:Stata 在服务器启动时初始化一次,所有命令共享同一会话。 数据加载后会一直保留在内存中,直到被 clear 或替换
  • 协议版本:MCP initialize 协商支持 2024-11-05 ~ 2025-11-25(未知版本回退最新); serverInfo.version 反映项目版本(当前 1.0.10),不是 fastmcp 框架版本

核心原则

每次分析前

  1. 先了解数据 — 使用 stata_describestata_codebook 查看变量信息
  2. 变量名大小写敏感mpgMPG 是不同的变量
  3. 路径用正斜杠D:/data/file.dta,不要用反斜杠
  4. 带空格的路径用双引号包裹use "D:/my data/file.dta", clear
  5. 检查返回值 — 用 stata_display 查看 r(mean)e(N)e(r2)
  6. 限制输出大小 — 永远不要执行 list 而不限制观测数(见下方「输出大小控制」)

命令执行策略

  • 单次查询 → 使用专用工具(stata_summarizestata_tabulate 等,输出紧凑)
  • 多步骤流程 → 使用 stata_run,用 \n 连接多条命令
  • 已有 .do 文件 → 使用 stata_run_do_file
  • 每次 stata_run 应包含逻辑完整的一组命令,避免零碎调用
  • 多命令链首错即停:链中某条命令报错(变量名拼错、数据未加载、语法错)会中止 后续命令并指出第一条错误 —— 这是刻意行为(对齐 Stata do 文件语义),防止后续 命令在上一个错误状态上继续跑、覆盖磁盘数据。需要「跳过失败继续」时用 capture 包裹期望失败的命令。报错后先看第一条错误信息定位问题,再修正重跑,不要盲目重发整条链

输出大小控制(重要!)

始终在产生输出的命令中限制范围,避免生成几万字符的原始输出(硬上限 120K, 超出部分真的被丢弃,翻页也找不回):

命令 不推荐(输出过大) 推荐(限制输出)
list list — 输出全部 74 条,40K 字符 list in 1/10 — 只显示前 10 条
summarize 无限制 — 通常安全 summarize varlist if condition
tabulate 无限制 — 通常安全 tabulate var in 1/100
browse 不可用(GUI 命令) 改用 list in 1/N
describe 永远安全

分页工作流

1. stata_list(n=10)         → 先看前 10 条了解数据结构
2. stata_summarize()         → 用描述统计看整体
3. stata_list(in_range="1/l") → 确实需要全部数据时,会自动分页
4. stata_more(page=2)        → 翻页浏览

经验法则

  • 观测数 < 50:list 全部输出通常 OK
  • 观测数 50-500:list in 1/20 预览 + summarize + codebook 了解全貌
  • 观测数 > 500:只用 summarizetabulatecodebook,避免用 list
  • 回归/检验命令的输出通常不会过大,无需限制

Read the full file on GitHub · 486 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 486 lines · 281 tokens per session scan A 4207419188fe

Subscribe to this mod's changes

stata is a skill published in the GitHub repository aliveranme/stata-mcp (0 stars, last pushed 10d ago), licensed MIT. It adds 281 tokens to every session and 8,336 once invoked, about $0.0014 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

instrument-data-to-allotrope

Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV. Use this skill when scientists need to standardize instrument data for LIMS systems, data lakes, or downstream analysis. Supports auto-detection of instrument types. Outputs include full…

anthropics/knowledge-work-plugins · 123 tokens

matlab

Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 42 tokens

exploratory-data-analysis

Perform bounded, local exploratory analysis of explicitly supported scientific files. Use for redacted CSV/TSV/JSON profiles; optional NumPy, HDF5, FASTA/FASTQ, and basic image metadata inspection; missingness/leakage audits; outlier and transformation sensitivity; and rigorous EDA report scaffolds. Other domain…

K-Dense-AI/scientific-agent-skills · 83 tokens

phylogenetics

Build and analyze phylogenetic trees using MAFFT (multiple alignment), IQ-TREE 2 (maximum likelihood), and FastTree (fast NJ/ML). Visualize with ETE3 or FigTree. For evolutionary analysis, microbial genomics, viral phylodynamics, protein family analysis, and molecular clock studies.

K-Dense-AI/scientific-agent-skills · 68 tokens

research-engineer

An uncompromising Academic Research Engineer. Operates with absolute scientific rigor, objective criticism, and zero flair. Focuses on theoretical correctness, formal verification, and optimal implementation across any required technology.

davila7/claude-code-templates · 43 tokens

mapping-to-snomed

Maps clinical concept spans extracted by OpenMed to SNOMED CT concepts through a USER-SUPPLIED terminology server (the user's own Ontoserver, Snowstorm, or UMLS/UTS), never a bundled vocabulary. Use when the user wants to code findings, disorders, procedures, body structures, or substances to SNOMED CT, run an ECL…

maziyarpanahi/openmed · 205 tokens