skills/43-wentorai-research-plugins/skills/tools/code-exec/overleaf-cli-guide/SKILL.md
Sync and manage Overleaf LaTeX projects from the command line
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research overleaf-cli-guideInstall 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.
Sync, manage, and automate Overleaf LaTeX projects from the command line. Work in your preferred local editor while keeping Overleaf as the collaboration and compilation hub for your research team.
Overleaf is the dominant online LaTeX editor in academia, used by millions of researchers for collaborative paper writing. However, many researchers prefer local editors (VS Code, Neovim, Emacs) for their superior editing capabilities, version control integration, and ability to run custom scripts. The Overleaf CLI bridge enables a hybrid workflow: edit locally with full tooling, then sync changes to Overleaf for collaboration and compilation.
This skill covers three approaches to Overleaf CLI integration: Overleaf's built-in Git bridge (available on paid plans), the open-source overleaf-sync tool (works with free plans), and direct API interaction. Each approach has different trade-offs in terms of cost, features, and reliability.
Beyond simple sync, this guide covers automation workflows that are particularly valuable for research: automated bibliography updates from reference managers, figure regeneration from data analysis scripts, CI-based PDF compilation, and multi-author merge conflict resolution.
Overleaf Server Pro and paid plans include a Git bridge that exposes each project as a Git repository.
# Clone your Overleaf project (requires paid plan)
git clone https://git.overleaf.com/YOUR_PROJECT_ID my-paper
cd my-paper
# The remote is already configured
git remote -v
# origin https://git.overleaf.com/YOUR_PROJECT_ID (fetch)
# origin https://git.overleaf.com/YOUR_PROJECT_ID (push)
# Pull latest changes from collaborators
git pull origin master
# Edit locally in your preferred editor
vim main.tex
# Push changes back to Overleaf
git add -A
git commit -m "Revise methodology section"
git push origin master
When collaborators edit the same section simultaneously:
git pull origin master
# If conflicts occur:
# 1. Open conflicted files
# 2. Resolve LaTeX merge conflicts (look for <<<<<<< markers)
# 3. Verify the document compiles
git add -A
git commit -m "Resolve merge conflict in results section"
git push origin master
For free Overleaf accounts without Git bridge access:
# Install
pip install overleaf-sync
# Login (stores credentials securely)
ols login
# List your projects
ols list
# Download a project
ols download "My Research Paper" --path ./my-paper
# Upload local changes
ols upload ./my-paper --project "My Research Paper"
# Two-way sync (pull then push)
ols sync ./my-paper --project "My Research Paper"
#!/bin/bash
# sync-overleaf.sh - Run periodically or before/after editing sessions
PROJECT_DIR="$1"
PROJECT_NAME="$2"
echo "Pulling latest from Overleaf..."
ols download "$PROJECT_NAME" --path "$PROJECT_DIR" --skip-existing
echo "Compiling locally to verify..."
cd "$PROJECT_DIR"
latexmk -pdf -interaction=nonstopmode main.tex
if [ $? -eq 0 ]; then
echo "Compilation successful. Pushing to Overleaf..."
ols upload "$PROJECT_DIR" --project "$PROJECT_NAME"
else
echo "Compilation failed. Fix errors before syncing."
exit 1
fi
import subprocess
from pathlib import Path
def sync_bibliography(zotero_lib_id, bib_file, project_dir):
"""Export Zotero library and sync to Overleaf project."""
# Export from Zotero using Better BibTeX
subprocess.run([
"curl", "-s",
f"http://localhost:23119/better-bibtex/export/library?/"
f"{zotero_lib_id}/library.biblatex",
"-o", str(Path(project_dir) / bib_file)
])
print(f"Updated {bib_file} from Zotero library {zotero_lib_id}")
import subprocess
from pathlib import Path
def regenerate_figures(scripts_dir, figures_dir):
"""Run all figure generation scripts and update outputs."""
scripts = sorted(Path(scripts_dir).glob("fig_*.py"))
for script in scripts:
print(f"Running {script.name}...")
subprocess.run(["python", str(script)], cwd=figures_dir)
print(f"Regenerated {len(scripts)} figures in {figures_dir}")
# .github/workflows/compile-paper.yml
name: Compile LaTeX Paper
on:
push:
branches: [main]
paths: ['**.tex', '**.bib', '**.sty']
jobs:
compile:
runs-on: ubuntu-latest
container:
image: texlive/texlive:latest
steps:
- uses: actions/checkout@v4
- name: Compile PDF
run: |
latexmk -pdf -interaction=nonstopmode main.tex
- name: Upload PDF
uses: actions/upload-artifact@v4
with:
name: paper-pdf
path: main.pdf
- name: Check for warnings
run: |
grep -i "warning" main.log | grep -v "Font" || true
Recommended directory structure for CLI-managed Overleaf projects:
my-paper/
main.tex # Main document
sections/
01-introduction.tex
02-related-work.tex
03-methodology.tex
04-results.tex
05-discussion.tex
06-conclusion.tex
figures/
fig1-architecture.pdf
fig2-results.pdf
tables/
tab1-comparison.tex
references.bib
custom.sty # Custom LaTeX macros
scripts/ # Not synced to Overleaf
fig_architecture.py
fig_results.py
sync.sh
.gitignore
# LaTeX build artifacts
*.aux
*.bbl
*.blg
*.fdb_latexmk
*.fls
*.log
*.out
*.synctex.gz
*.toc
# Local scripts (don't sync to Overleaf)
scripts/
# OS files
.DS_Store
Install the "LaTeX Workshop" extension and configure local compilation:
{
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": ["-pdf", "-interaction=nonstopmode", "%DOC%"]
}
]
}
-- init.lua
vim.g.vimtex_compiler_method = 'latexmk'
vim.g.vimtex_view_method = 'skim' -- macOS
| Issue | Solution |
|-------|----------|
| Git push rejected | Pull first, resolve conflicts, then push |
| Sync tool authentication error | Re-run login, check 2FA settings |
| Compilation differs locally vs Overleaf | Match TeX Live versions; Overleaf uses TeX Live 2024 |
| Binary files (images) cause large diffs | Use .gitattributes to mark as binary |
| Overleaf rate limiting | Add delays between API calls, use Git bridge if available |
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.