원클릭으로
rrwrite-analyze-repository
Analyzes a GitHub repository or local directory to extract structure, files, and research context
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Analyzes a GitHub repository or local directory to extract structure, files, and research context
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | rrwrite-analyze-repository |
| description | Analyzes a GitHub repository or local directory to extract structure, files, and research context |
| arguments | [{"name":"repo_path","description":"GitHub URL or local repository path to analyze","required":true},{"name":"target_dir","description":"Output directory for analysis results","default":"manuscript"}] |
| allowed-tools | null |
| context | fork |
This skill analyzes a code repository (GitHub URL or local path) and generates a structured analysis document containing:
Check required arguments:
if [ -z "{repo_path}" ]; then
echo "Error: --repo-path is required"
echo ""
echo "Usage: /rrwrite-analyze-repository --repo-path <path-or-url> [--target-dir <dir>]"
echo ""
echo "Examples:"
echo " /rrwrite-analyze-repository --repo-path https://github.com/user/project"
echo " /rrwrite-analyze-repository --repo-path /path/to/local/repo --target-dir manuscript"
exit 1
fi
# Create target directory
mkdir -p "{target_dir}"
# Set output file path
OUTPUT_FILE="{target_dir}/repository_analysis.md"
echo ""
echo "============================================================"
echo "REPOSITORY ANALYSIS"
echo "============================================================"
echo ""
echo "Repository: {repo_path}"
echo "Output directory: {target_dir}"
echo "Output file: $OUTPUT_FILE"
echo ""
Check for existing analysis and run script:
# Check for existing analysis
SKIP_ANALYSIS=false
if [ -f "$OUTPUT_FILE" ]; then
echo "⚠ Warning: Analysis file already exists: $OUTPUT_FILE"
echo ""
read -p "Overwrite existing analysis? [y/N]: " response
if [[ ! "$response" =~ ^[Yy] ]]; then
echo "Using existing analysis file."
SKIP_ANALYSIS=true
fi
fi
# Run analysis script (unless skipped)
if [ "$SKIP_ANALYSIS" != "true" ]; then
echo "Analyzing repository structure..."
echo ""
python scripts/rrwrite-analyze-repo.py "{repo_path}" --output "$OUTPUT_FILE"
if [ $? -ne 0 ]; then
echo ""
echo "============================================================"
echo "ANALYSIS FAILED"
echo "============================================================"
echo ""
echo "Troubleshooting:"
echo " • For GitHub URLs: Ensure git is installed and URL is correct"
echo " - Test clone: git clone {repo_path} /tmp/test_clone"
echo " • For local paths: Verify the path exists and is accessible"
echo " - Test access: ls -la {repo_path}"
echo " • Check you have write permissions to {target_dir}"
echo " - Test write: touch {target_dir}/.test && rm {target_dir}/.test"
echo ""
echo "Common issues:"
echo " • Private repositories require authentication"
echo " • Network connectivity problems with GitHub"
echo " • Git not installed (install: brew install git)"
echo ""
exit 1
fi
echo ""
echo "✓ Analysis complete: $OUTPUT_FILE"
fi
Parse analysis file to extract file counts and research topics:
import sys
import re
from pathlib import Path
# Add scripts directory to path
sys.path.insert(0, str(Path('scripts').resolve()))
# Read analysis file
analysis_file = Path("{target_dir}/repository_analysis.md")
if not analysis_file.exists():
print(f"Error: Analysis file not found: {analysis_file}")
sys.exit(1)
content = analysis_file.read_text(encoding='utf-8')
# Extract file counts by counting file references in each section
data_section = re.search(r'### Data Files.*?(?=###|\Z)', content, re.DOTALL)
data_files = len(re.findall(r'- `[^`]+`', data_section.group())) if data_section else 0
script_section = re.search(r'### (Analysis Scripts|Scripts).*?(?=###|\Z)', content, re.DOTALL)
script_files = len(re.findall(r'- `[^`]+`', script_section.group())) if script_section else 0
figure_section = re.search(r'### Figures.*?(?=###|\Z)', content, re.DOTALL)
figure_files = len(re.findall(r'- `[^`]+`', figure_section.group())) if figure_section else 0
file_counts = {
"data": data_files,
"scripts": script_files,
"figures": figure_files
}
# Extract topics from "Inferred Research Context" section
topics_section = re.search(r'## Inferred Research Context.*?(?=##|\Z)', content, re.DOTALL)
topics = []
if topics_section:
# Look for bullet points or numbered items
topic_matches = re.findall(r'[-*\d.]+\s+(.+?)$', topics_section.group(), re.MULTILINE)
topics = [t.strip() for t in topic_matches if t.strip()]
# Check for empty repository
if sum(file_counts.values()) == 0:
print("\n⚠ Warning: Repository appears to be empty")
print(" No data, scripts, or figures detected")
print("\nAnalysis will continue with minimal information.")
print("\nExtracted metadata:")
print(f" Data files: {file_counts['data']}")
print(f" Scripts: {file_counts['scripts']}")
print(f" Figures: {file_counts['figures']}")
print(f" Topics detected: {len(topics)}")
# Store for next phase
globals()['file_counts'] = file_counts
globals()['topics'] = topics
globals()['analysis_file_path'] = str(analysis_file)
Update state manager with analysis results:
from rrwrite_state_manager import StateManager
# Initialize state manager (disable git for this operation)
manager = StateManager(output_dir="{target_dir}", enable_git=False)
# Update repository analysis stage
manager.update_repository_analysis(
analysis_file=analysis_file_path,
repo_path="{repo_path}",
file_counts=file_counts,
topics_detected=topics
)
print("✓ Workflow state updated")
Show completion summary and next steps:
echo ""
echo "============================================================"
echo "REPOSITORY ANALYSIS COMPLETE"
echo "============================================================"
echo ""
echo "Repository: {repo_path}"
echo "Output: {target_dir}/repository_analysis.md"
echo ""
echo "Summary:"
echo " • Data files: {file_counts[data]}"
echo " • Scripts: {file_counts[scripts]}"
echo " • Figures: {file_counts[figures]}"
echo " • Topics detected: {len(topics)}"
echo ""
echo "Next Steps:"
echo " 1. Review repository_analysis.md"
echo " 2. Generate manuscript outline:"
echo " /rrwrite-plan-manuscript --target-dir {target_dir} --journal <name>"
echo ""
echo " Or check workflow status:"
echo " python scripts/rrwrite-status.py --output-dir {target_dir}"
echo ""
echo "============================================================"
Generate publication-quality plots from data files or DataFrames
Assembles all manuscript sections into a complete manuscript with validation and metadata generation
Analyzes manuscript outline for journal suitability, recommends optimal journal, and fetches author guidelines
Performs adversarial critique of manuscripts, outlines, literature reviews, or other academic content against journal requirements and quality standards.
Analyzes the repository structure and generates a detailed manuscript outline based on target journal guidelines (Nature, PLOS, Bioinformatics).
Performs deep literature research on manuscript topics and generates a comprehensive one-page summary of background and related work with citations.