sepinetam/mcp-for-stata/diagnostic-dofile
Claude Code and agent skill by sepinetam/mcp-for-stata
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when the user needs to inspect, audit, or diagnose the safety of a Stata do-file. Typical scenarios include: uncertainty about whether a .do file is safe; receiving a complete do-file from an unofficial source (not the Stata website, not a well-known academic institution or professor's official site); asking to check a batch of do-files; or requesting a read-only security/risk/portability diagnostic report. The skill does not modify the original file; it only emits a JSON report. Note that this is not a mandatory step for every do-file; run it only when a security review is warranted.
Install
npx vskill@latest install sepinetam/mcp-for-stata/diagnostic-dofileSKILL.md
Diagnostic do-file
This skill inspects a Stata do-file without changing the original file and outputs a JSON diagnostic report. The underlying script reuses stata_mcp.utils.parse_dofile and stata_mcp.guard.blacklist, so it handles Stata command abbreviations, prefixes (capture / quietly), macro expansion, block comments, #delimit ;, and other common constructs.
When to use
Recommended situations:
- You receive a complete do-file from an unknown or unofficial source, especially one downloaded from outside the Stata website or well-known academic/professor sites.
- The code arrives as an email attachment, cloud-drive link, forum post, or chat message, and you want to verify that it contains no dangerous commands or data-overwrite risks.
- Before taking over or reproducing someone else's project, you want to audit the key do-files.
- You explicitly want a read-only diagnostic report covering security, portability, encoding, and other dimensions.
This skill is not required every time you write a do-file. For analysis code you wrote yourself, understand, and trust, you can run it directly without generating a diagnostic report each time.
How to run
Save the report to a file:
Current checks
1. File metadata
- File path, size, and modification time.
- UTC timestamp when the report was generated.
- SHA-256 hash of the file.
2. Encoding and format
- UTF-8 or UTF-8 with BOM.
- Non-UTF-8 encodings such as GBK/GB2312.
- Line ending: LF, CRLF, or mixed.
- Empty file or comment-only file.
3. Dangerous commands
Based on src/stata_mcp/guard/blacklist.py:
- Shell / system commands:
!,!!,shell,xshell,winexec,unixcmd. - File deletion:
erase,rm,rmdir. - External code execution:
do,run,include. - Embedded runtimes:
python,mata,java,plugin. - Package-management commands:
ssc,net,github,adoupdate,update. - Working-directory changes:
cd,chdir.
4. Data-overwrite risks
use xxx.dtafollowed bysave xxx.dta, replacepointing to the same file.- Memory-clearing operations such as
clear all/drop _all.
5. Output-file overwrite
graph export xxx, replace.export xxx, replace.- Commands with
replacesuch asoutreg2,esttab,estout,putexcel,putdocx,putpdf,logout,texdoc. log using xxx.log, replace.saveold xxx, replace.
6. External commands / user-written packages
- Recognizes common external commands such as
reghdfe,estout,outreg2,esttab,coefplot,ivreg2,rdrobust. - Reports them so the caller can run Stata
help <command>to verify installation.
7. Paths and portability
- Absolute paths such as
/Users/...orC:\.... webuseor network URLs for loading data.cd/chdirworking-directory changes.
8. Macro and parsing risks
- Unresolved macro variables (global macros, local macro expressions, etc.).
- Unclosed block comments, quotes, or program blocks that may affect parsing reliability.
Report format
The report is a JSON object with the following structure:
Notes
- The script only reads the original file and never modifies the do-file content.
- Findings are for reference only; the final execution decision is yours.
- For Stata-MCP, dangerous commands are automatically blocked by the security guard during
stata_do. To disable the guard, configure~/.statamcp/config.toml, but this is not recommended.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/stata-toolbox/skills/diagnostic-dofile/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sepinetam/mcp-for-stata/diagnostic-dofile)