skills/30-zirui-song-claude-skills/project-structure/SKILL.md
Project directory organization and script naming conventions for research
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research project-structureInstall 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.
This document outlines the standardized structure for research project code organization. Use this as a template for organizing future research projects.
Project Root/
├── Code/ # All analysis scripts
│ ├── [Numbered]_[Descriptive].py # Data processing scripts (Python)
│ ├── AN_[Number]_[Descriptive].py # Analysis scripts (Python)
│ ├── AN_[Number]_[Descriptive].do # Analysis scripts (Stata)
│ ├── LogFiles/ # Stata log files
│ └── README.md # Project documentation
├── Data/ # All data files
│ ├── Raw/ # Original, unprocessed data
│ ├── Intermediate/ # Partially processed data
│ └── Clean/ # Final, analysis-ready datasets
└── Results/ # Analysis outputs
├── Tables/ # Regression tables, summary stats
└── Figures/ # Plots, charts, visualizations
Format: [Number]_[DescriptiveName].py
Examples:
0_ExtractCreditAgreements.py1a_CleanCompAnnualCRSP.py1b_ProcessDealscanCompustat.py2_MergeAgreementsCompCRSP.py3a_ExtractLoanOfficerNames.py4a1_ExtractLoanTerms.py4b_CleanLoanOfficerPanel.pyNumbering Logic:
Python Analysis Scripts:
AN_[Number]_[DescriptiveName].pyAN_1a_DescribeSample.pyAN_1b_DescribeSample_NoLinkedin.pyAN_1c_DescribeSample_Dealscan_Aggregated.pyStata Analysis Scripts:
AN_[Number]_[DescriptiveName].doAN_2a_MainRegressions_ChatGPT.doAN_2b_MainRegressions_ChatGPT_NoLinkedin.doAN_2c_MainRegressions_Dealscan_NoLinkedin.doAN_2d_MainRegressions_Dealscan_NoLinkedin_Aggregated.doAN_2e_MainRegressions_Dealscan_Secured.doAN_2f_MainRegressions_Dealscan_Covenants.doAnalysis Numbering Logic:
Standard Structure:
"""
[Script Name]
[Brief Description]
[Detailed description of what the script does]
"""
import pandas as pd
import numpy as np
from pathlib import Path
# Other imports as needed
def get_project_root():
"""Automatically detect the project root directory."""
return Path(__file__).parent.absolute()
def [main_function]():
"""Main processing function."""
# Script logic here
pass
if __name__ == "__main__":
[main_function]()
Key Features:
get_project_root() function for path managementStandard Structure:
/***********
Globals for Paths
***********/
*** Change repodir and overleafdir paths for different users
global repodir "/path/to/project/root"
global datadir "$repodir/Data"
global rawdir "$datadir/Raw"
global cleandir "$datadir/Clean"
global tabdir "$repodir/Results/Tables"
global figdir "$repodir/Results/Figures"
global logdir "$repodir/Code/LogFiles"
* Start logging
log using "$logdir/[ScriptName].log", replace
/***********
[Analysis Section]
***********/
* Analysis code here
* Close log file
log close
Key Features:
Standard Structure:
"""
[Script Name]
[Brief Description]
This script [detailed description] based on the analysis
in [corresponding Stata do file]
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
def get_project_root():
"""Automatically detect the project root directory."""
return Path(__file__).parent.absolute()
def load_data():
"""Load the cleaned data."""
# Data loading logic
pass
def [analysis_function]():
"""Perform specific analysis."""
# Analysis logic
pass
def main():
"""Main analysis function."""
# Orchestrate all analyses
pass
if __name__ == "__main__":
main()
loan_officer_final_panel_chatgpt_cleaned.csvdealscan_merged_tranche_level.csvcomp_crspa_merged.csvRaw Data → Intermediate Processing → Clean Data → Analysis
(Scripts 0-4) (Scripts AN_1-AN_4)
Use descriptive suffixes for different versions:
_ChatGPT.py (uses ChatGPT-extracted data)_NoLinkedin.py (excludes LinkedIn variables)_Dealscan.py (uses Dealscan data)_Aggregated.py (uses aggregated data)get_project_root() for Python scriptsFor a new research project, create this structure:
NewProject/
├── Code/
│ ├── 0_ExtractRawData.py
│ ├── 1a_CleanDatasetA.py
│ ├── 1b_CleanDatasetB.py
│ ├── 2_MergeDatasets.py
│ ├── 3_ExtractFeatures.py
│ ├── 4_PrepareAnalysisData.py
│ ├── AN_1a_DescribeSample.py
│ ├── AN_2a_MainRegressions.do
│ ├── AN_2b_RobustnessTests.do
│ ├── LogFiles/
│ └── README.md
├── Data/
│ ├── Raw/
│ ├── Intermediate/
│ └── Clean/
└── Results/
├── Tables/
└── Figures/
This structure ensures:
tools
Autonomous multi-round research review loop using MiniMax API. Use when you want to use MiniMax instead of Codex MCP for external review. Trigger with "auto review loop minimax" or "minimax review".
tools
Autonomous research review loop using any OpenAI-compatible LLM API. Configure via llm-chat MCP server or environment variables. Trigger with "auto review loop llm" or "llm review".
tools
Autonomous multi-round research review loop using MiniMax API. Use when you want to use MiniMax instead of Codex MCP for external review. Trigger with "auto review loop minimax" or "minimax review".
tools
Autonomous research review loop using any OpenAI-compatible LLM API. Configure via llm-chat MCP server or environment variables. Trigger with "auto review loop llm" or "llm review".