skills/ds-verify/SKILL.md
This skill should be used when the user asks to 'verify analysis results', 'check reproducibility', 'validate data science output', or 'confirm completion'.
npx skillsauth add edwinhu/workflows ds-verifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Announce: "Using ds-verify (Phase 5) to confirm reproducibility and completion."
| Level | Remaining Context | Action | |-------|------------------|--------| | Normal | >35% | Proceed normally | | Warning | 25-35% | Complete current review cycle, then trigger ds-handoff | | Critical | ≤25% | Immediately trigger ds-handoff — do not start new review cycles |
Final verification with reproducibility checks and user acceptance interview.
<EXTREMELY-IMPORTANT> ## The Iron Law of DS VerificationNO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION. This is not negotiable.
Load shared enforcement first.
Auto-load all constraints matching applies-to: ds-verify:
!uv run python3 ${CLAUDE_SKILL_DIR}/../../scripts/load-constraints.py ds-verify
You MUST have these constraints loaded before proceeding. No claiming you "remember" them.
Before claiming analysis is complete, you MUST:
This applies even when:
About to claim COMPLETE without a fresh re-run this session → STOP (you ship unverified results that waste the user's time). </EXTREMELY-IMPORTANT>
Before running runtime DQ checks, run the static analysis constraint check suite:
bash "${CLAUDE_SKILL_DIR}/../../scripts/check-all-ds.sh" "$(pwd)"
This runs all DS constraint check scripts (determinism, join audits, idempotency, error handling, schema contracts, standard errors, visualization integrity).
If any check FAILS: Report the failures in LEARNINGS.md. These are code quality issues in the analysis scripts that must be fixed before proceeding. Dispatch a fix subagent if needed.
This re-run is defense-in-depth. The same
check-all-ds.shfloor is hook-enforced one phase upstream at ds-validate (mechanical-floor-gate.py, FLOOR=ds). ds-verify deliberately carries no hook for it: its only fan-out is a single fresh-Agent reproducibility check, and gating Agent here would deadlock againstds-no-main-chat-code-guard(a failing floor could not be fixed — fixes require an Agent).
If all checks PASS: Proceed to runtime DQ checks.
Checkpoint type: decision (user confirms results — cannot auto-advance)
Before making ANY completion claim, follow this flowchart.
This flowchart IS the specification. If prose elsewhere and this diagram disagree, the diagram wins.
┌──────────────────────────────┐
│ 1. RE-RUN (fresh, not cached) │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 2. CHECK vs success criteria │
└──────────────┬───────────────┘
pass? │
┌───── no ──┴── yes ─────┐
▼ ▼
┌─────────────────┐ ┌──────────────────────────┐
│ NEEDS WORK → │ │ 3. REPRODUCE │
│ log + dispatch │ │ (same inputs→same outputs)│
│ fix subagent │ └────────────┬─────────────┘
└────────┬────────┘ match? │
│ ┌──── no ──────┴── yes ───┐
│ ▼ ▼
│ ┌─────────────────┐ ┌─────────────────────────┐
│ │ NEEDS WORK → │ │ 4. ASK — user │
│ │ non-determinism │ │ acceptance interview │
│ │ is a defect │ └───────────┬─────────────┘
│ └────────┬────────┘ accept? │
│ │ ┌── no/partial ────┴── yes ──┐
│ │ ▼ ▼
│ │ ┌──────────────────┐ ┌────────────────────┐
└───────────┴─▶│ loop: ds-fix / │ │ 5. CLAIM COMPLETE │
│ ds-implement, │ │ (only after 1-4) │
│ then re-verify │ └────────────────────┘
└──────────────────┘
Skipping any step is not verification. Reaching step 5 without passing 1-4 is a false completion claim.
When presenting verification results to the user in the acceptance interview, generate diagnostic plots to support the decision:
| Verification Check | Diagnostic to Generate | |-------------------|----------------------| | Reproducibility comparison | Overlay plot of Run 1 vs Run 2 key outputs | | Data integrity | Pipeline waterfall chart (input rows → cleaning → joins → final) | | Distribution sanity | Histogram/density plots of key variables with expected ranges annotated | | Model performance | ROC curve, residual plot, or coefficient comparison (as appropriate) |
Format: Inline plots in notebooks, or saved to scratch/diagnostics/ for script-based workflows. Present alongside the acceptance interview questions.
Trace to Requirements: For each success criterion, reference its requirement ID (e.g., "DATA-01: Panel has 50K+ firm-years — VERIFIED with df.shape output"). End-to-end traceability from SPEC.md through PLAN.md through VALIDATION.md through verification.
CRITICAL: Before claiming completion, conduct user interview.
AskUserQuestion:
question: "Were there specific methodology requirements I should have followed?"
options:
- label: "Yes, replicating existing analysis"
description: "Results should match a reference"
- label: "Yes, required methodology"
description: "Specific methods were mandated"
- label: "No constraints"
description: "Methodology was flexible"
If replicating:
AskUserQuestion:
question: "Do these results answer your original question?"
options:
- label: "Yes, fully"
description: "Analysis addresses the core question"
- label: "Partially"
description: "Some aspects addressed, others missing"
- label: "No"
description: "Does not answer the question"
If "Partially" or "No":
/ds-implement to address gapsAskUserQuestion:
question: "Are the outputs in the format you need?"
options:
- label: "Yes"
description: "Format is correct"
- label: "Need adjustments"
description: "Format needs modification"
AskUserQuestion:
question: "Do you have any concerns about the methodology or results?"
options:
- label: "No concerns"
description: "Comfortable with approach and results"
- label: "Minor concerns"
description: "Would like clarification on some points"
- label: "Major concerns"
description: "Significant issues need addressing"
MANDATORY: Demonstrate reproducibility before completion.
<EXTREMELY-IMPORTANT> ## Independent Verification RequiredYou MUST NOT verify your own work. Spawn a fresh Task agent for reproducibility.
The implementer shares biases and sunk-cost attachment. A fresh subagent sees only the spec and outputs — it verifies without context pollution.
If you're about to re-run the analysis yourself, STOP. Dispatch a Task agent. </EXTREMELY-IMPORTANT>
Dispatch a fresh Task agent to run the reproducibility check:
All paths below are relative to this skill's base directory.
Agent(subagent_type="general-purpose",
allowed_tools=["Read", "Glob", "Grep", "Bash(read-only)"],
prompt="""
# Reproducibility Verification
**Tool Restrictions:** The verifier is READ-ONLY. It re-runs analyses and checks output but MUST NOT modify notebooks, scripts, or code. It MUST NOT use Write or Edit.
Verify this analysis produces consistent results from a fresh run.
## Context
- Read .planning/SPEC.md for objectives and success criteria
- Read .planning/PLAN.md for expected outputs
- Read .planning/LEARNINGS.md for pipeline documentation
## Shared Checks
Read the shared check definitions:
Read `${CLAUDE_SKILL_DIR}/../../skills/ds-implement/references/ds-checks.md` and follow its instructions.
Run checks: DQ1-DQ4, DQ6, COV, M1, R1
## Reproducibility Protocol
### For scripts:
```python
# Run 1
result1 = run_analysis(seed=42)
hash1 = hash(str(result1))
# Run 2
result2 = run_analysis(seed=42)
hash2 = hash(str(result2))
# Verify
assert hash1 == hash2, "Results not reproducible!"
print(f"Reproducibility confirmed: {hash1} == {hash2}")
jupyter nbconvert --execute --inplace notebook.ipynb
papermill notebook.ipynb output.ipynb -p seed 42
Report:
**Post-subagent boundary (C5):** After verification agent returns, read its report only. Do NOT read source code, notebooks, or data files yourself. If FAIL, dispatch a fresh investigation subagent.
**If Task agent reports FAIL:** Dispatch a fresh Task agent to investigate the discrepancy. Do NOT investigate yourself — that violates the post-subagent boundary (C5 from ds-common-constraints.md).
## Claims Requiring Evidence
| Claim | Required Evidence |
|-------|-------------------|
| "Analysis complete" | All success criteria verified |
| "Results reproducible" | Same output from fresh run |
| "Matches reference" | Comparison showing match |
| "Data quality handled" | Documented cleaning steps |
| "Methodology appropriate" | Assumptions checked |
## Insufficient Evidence
These do NOT count as verification:
- Previous run results (must be fresh)
- "Should be reproducible" (demonstrate it)
- Visual inspection only (quantify where possible)
- Single run (need reproducibility check)
- Skipped user acceptance (must ask)
## Required Output Structure
```markdown
## Verification Report: [Analysis Name]
### Technical Verification
#### Outputs Generated
- [ ] Output 1: [location] - verified [date/time]
- [ ] Output 2: [location] - verified [date/time]
#### Reproducibility Check
- Run 1 hash: [value]
- Run 2 hash: [value]
- Match: YES/NO
#### Environment
- Python: [version]
- Key packages: [list with versions]
- Random seed: [value]
### User Acceptance
#### Replication Check
- Constraint: [none/replicating/required methodology]
- Reference: [if applicable]
- Match status: [if applicable]
#### User Responses
- Results address question: [yes/partial/no]
- Output format acceptable: [yes/needs adjustment]
- Methodology concerns: [none/minor/major]
### Verdict
**COMPLETE** or **NEEDS WORK**
[If COMPLETE]
- All technical checks passed
- User accepted results
- Reproducibility demonstrated
[If NEEDS WORK]
- [List items requiring attention]
- Recommended next steps
Maximum 3 verification cycles. If issues persist after 3 rounds, escalate to user with summary of blocking issues.
Chaining instruction (if NEEDS WORK). Discover and load ds-implement:
Read ${CLAUDE_SKILL_DIR}/../../skills/ds-implement/SKILL.md and follow its instructions.
Then fix the identified issues and re-run verification.
Only claim COMPLETE when ALL are true:
Both technical and user acceptance must pass. No shortcuts.
When user confirms all criteria are met:
Announce: "DS workflow complete. All 5 phases passed."
The /ds workflow is now finished. Offer to:
.planning/ files/dsdevelopment
Build the meeting-level proxy-voting × ownership panel on the WRDS SGE grid — ISS N-PX fund votes reduced to (item × block) direction cells, joined to institutional and mutual-fund ownership. Use when working with risk.voteanalysis_npx, N-PX fund-level votes, ISS→CRSP fund linking, index/passive/active voting blocks, or a proxy-voting panel that needs ownership attached.
development
Use when "CRSP CIZ", "CRSP v2", "CRSP flat file format 2.0", "crsp.dsf_v2 / msf_v2", "StkDlySecurityData", "StkMthSecurityData", "StkSecurityInfoHist", "stocknames_v2", "DlyRet / MthRet / DlyPrc / MthPrc", "SHRCD or EXCHCD equivalent in new CRSP", "SIZ to CIZ migration", "CRSP data after 2024", "CRSP delisting returns", "CRSP cumulative adjustment factors", "CRSP index INDNO / INDFAM", or any CRSP stock/index query where the legacy SIZ column names no longer exist.
development
Use when linking or deduping datasets by entity name rather than a shared key — 'fuzzy match', 'fuzzy name matching', 'entity resolution', 'record linkage', 'match company/person names', 'dedupe entity names', 'name-based join', 'bridge identifiers' (CIK ↔ permno ↔ gvkey ↔ wficn ↔ EIN ↔ personid), or any use of char n-gram TF-IDF, cosine similarity on names, `sparse_dot_topn`, or RapidFuzz at scale.
development
Use when building a publication-quality table in Python — 'regression table', 'results table', 'summary statistics table', 'etable', 'coefplot', 'great_tables', 'GT', 'gt table', 'format a table for the paper', 'export table to LaTeX/HTML', significance stars, spanners, or column formatting for a table headed into a paper, slide deck, or notebook.