Skip to content
Back to skills

Stata Replication Workflow

ASecurity

Write, repair, refactor and run Stata research do-files. Trace actual failures to their source, apply verified readability improvements, and preserve the caller and research outputs.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 26, 2026
ai-agentsrustgonode

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add Plokies-2/stata-research-guard --skill stata-replication-workflow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Stata Replication Workflow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Stata Replication Workflow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/plokies-2-stata-replication-workflow/badge)](https://www.skillsdirectory.com/skills/plokies-2-stata-replication-workflow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: stata-replication-workflow
description: Write, repair, refactor and run Stata research do-files. Trace actual failures to their source, apply verified readability improvements, and preserve the caller and research outputs.
---

# Stata Research Workflow

Apply the relevant [writing rules](references/general-rules.md) while preserving results, presentation and the calling interface. Before editing, scan for execution or masked errors, wrong group scope in recursions, cumulative calculations or ranks, reversed coding or bounds, mismatched parallel calculations, undefined macros or references, positional lookups and returns from the wrong fit. Fix a bug even if results change when the code uniquely specifies the replacement. For an affected research or display value, cite its definition or consumer that establishes the intended replacement. If your evidence identifies a problem but leaves the intended value open, keep the behavior and propose a change.

Keep the code as written and propose a change when another interpretation is plausible or the edit changes one of these choices:

- **Caller contract.** Prepare test data and startup settings in the verification run. Propose adding or uncommenting `use ..., clear` or `profile.do`, changing directory or log scope, requiring a program option or forcing an ado path.
- **Research choices.** Propose changes to samples, denominators, aggregation units or statistics such as `(first)` to `(firstnm)`, missing values and timing, tie handling, cutoffs, baselines, weights and model specifications.
- **Storage and presentation.** Propose changing storage types, display formats, labels or wording, graph settings, row order, table columns, caller-visible names or return values, and existing `quietly`.

Write so the researcher can follow which observations enter each calculation, what it computes and where its result goes. Use the actual inputs, callers and output consumers to decide what to simplify. Keep distinct specifications, samples and inference visible, and protect source data and baselines.

Before finishing, check that the edit preserves the expected results and report how you checked, using a method that fits the project, such as running the original entry point, exercising the changed block or comparing saved results.

`scripts/stata-equivalence.cjs` is available for comparing original and edited runs in isolated copies. Use OS temporary space for verification copies and logs. Remove any verification files and directories created in the project before replying.

## References

- Use [command evidence](references/command-evidence.md) for material new or changed command interfaces. A minimal lookup for a known command is `{"request":"Read the changed estout output interface","selected_commands":["estout"]}`. For a paper example, read the [connected original code](references/paper-workflow-reading.md).
- See [execution and results](references/execution-and-results.md) for runner choice and saved results, [descriptive outputs](references/descriptive-outputs.md) for tables and figures, and the [worked examples](references/code-examples.md) for implementation choices.
- See [workflow taxonomy](references/workflow-taxonomy.md) for how to organize maintained do-files, [project workflows](references/project-workflows.md) for whole-project setup, and [codebook](references/codebook.md) and [README](references/readme-contract.md) for those deliverables.
- Use [stata-peer-audit](../stata-peer-audit/SKILL.md) for independent advice when requested or when another perspective could resolve a concrete question about data, sample, specification or results.

## Editing and hook feedback

Use a targeted edit for the maintained do-file. Keep a flagged repair only if it meets the bug rule above. Otherwise restore the behavior and propose the change.

The plugin's hook sends an edited-region reminder right after the first `.do` edit made with `apply_patch`, `Edit` or `Write` in a turn. If you made such an edit and no reminder arrived, the hooks did not run; Codex skips plugin hooks until they are trusted again after each plugin update. Say so in the final reply, ask the user to trust the stata-research-guard hooks (Codex: Settings → Hooks), and run `node hooks/stata-repeats.cjs` and `node hooks/stata-align.cjs` from the plugin root on the edited files yourself.

Read and follow the [reporting format](references/after-editing.md) for every final reply, including its required “Points to confirm” section (“확인할 점” in Korean) when no edit is needed.

Files in this skill

  • SKILL.md19.3 KB
  • agents/openai.yaml642 B
  • references/code-examples.md8.8 KB
  • references/codebook.md5.7 KB
  • references/command-evidence.md19.5 KB
  • references/execution-and-results.md4.6 KB
  • references/general-rules.md18.2 KB
  • references/paper-workflow-reading.md10.4 KB
  • references/project-workflows.md5.2 KB
  • references/readme-contract.md818 B
  • references/workflow-taxonomy.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.