A GitHub template for research projects. Create a project from it as described in
Start a project: rename-package.sh then turns this README into the
project's own, titled after the package and without the template notes.
The simulations behind a paper: a Julia package with the models, Slurm jobs that run on the group's cluster, and the scripts that turn their data into figures. The manuscript lives elsewhere (for example on Overleaf, in its own VS Code window); copy final figures into it by hand.
simulations/ Julia package MyPaperPackage: src/ (models), test/, run/ (Slurm jobs), out/ (logs)
analysis/ plotting environment: plots.example.jl, output/ (generated figures)
data/ simulation results (contents gitignored): written by jobs, pulled with ./sync-data.sh
docs/ notes in Markdown, shared with the group
resources/ papers and other big or private files (contents gitignored)
sync-data.sh, .conf data transfer between the cluster and laptops
.claude/CLAUDE.md rules for Claude Code (and other assistants, through .github/)
.devcontainer/ optional private dev container (Podman): Julia and Git, no SSH, no host files
Needs Julia 1.10 or later, Git, and passwordless SSH to the cluster.
-
On GitHub, Use this template → Create a new repository (private), and clone it.
-
Rename the package and commit. The script replaces
MyPaperPackageeverywhere, gives the package a fresh UUID (each package needs its own, or Julia mixes them up between projects), titles this README after the package, removes its template notes (this section included), and deletes itself:./rename-package.sh TwistedBilayer && git add -A && git commit -m "Rename package"
-
Continue with Set up.
-
Install both environments and commit the resulting
Manifest.tomlfiles, which record the exact package versions:julia --project=simulations -e 'using Pkg; Pkg.instantiate()' julia --project=analysis -e 'using Pkg; Pkg.instantiate()'
Julia 1.11 and later find the package from
analysis/by themselves (a[sources]entry). On Julia 1.10, link it once before instantiating, and commitanalysis/Manifest.toml:cd analysis && julia --project=. -e 'using Pkg; Pkg.develop(path="../simulations")'. -
Point
sync-data.confat the repository's clone on the cluster, and commit it:REMOTE=mycluster # an SSH alias everyone defines in ~/.ssh/config REMOTE_PATH=myproject/data # data/ of the clone on the cluster (relative to home)
The alias is the only thing the repository knows about the cluster; user names stay in each person's
~/.ssh/config:Host mycluster HostName login.cluster.example.org User alice
git clone git@github.com:GROUP/PROJECT.git && cd PROJECT
julia --project=simulations -e 'using Pkg; Pkg.instantiate()'
julia --project=analysis -e 'using Pkg; Pkg.instantiate()'
./sync-data.sh # pull the data from the cluster| Command | Does |
|---|---|
./sync-data.sh |
Pulls new and changed files from the cluster into data/; never deletes anything |
./sync-data.sh -n |
Dry run: shows what would be copied |
./sync-data.sh --push |
Copies local files to the cluster, after asking (rarely needed) |
Personal settings (for example a different local folder, or a clone elsewhere on the cluster) go in
sync-data.local.conf, which is gitignored.
On Windows, run the script in WSL. Recent macOS versions ship a reduced rsync; if the script complains,
brew install rsync.
- Model code belongs in
simulations/src/; job and plotting scripts only call package functions. After changing the package, run its tests:julia --project=simulations -e 'using Pkg; Pkg.test()'. - Figures. Copy
analysis/plots.example.jltoplots.jland adapt it. Each figure is a builder function (data as positional arguments, looks as keywords), saved toanalysis/output/at journal-column size with LaTeX fonts.loaddatawarns if the data came from uncommitted code. - In VS Code, the Julia REPL starts in the
analysisenvironment; switch in the status bar.
VS Code can run the project in a container that sees only this repository: Julia and Git, with no SSH
client, no SSH agent, and no access to the rest of your files. Git reaches GitHub over HTTPS (also for
git@github.com: remotes), so commit, pull and push work; sync-data.sh needs SSH and runs on the host
(or see SSH from the container).
-
Linux with rootless Podman. The container options are Podman's (Fedora and Bazzite ship it).
-
VS Code installed natively (for example from the distribution or Homebrew, not Flatpak), with the Dev Containers extension.
-
Julia installed with juliaup on the host. The container runs the host's Julia versions, read-only, and refuses to start without juliaup.
-
User ID 1000 (
id -u), which the image assumes. With another ID, add"USER_UID"and"USER_GID"next toWITH_SSHin the build arguments of.devcontainer/devcontainer.json. -
A repository on GitHub, and a fine-grained token for this repository only (Contents: read and write).
-
These VS Code user settings, once per computer:
VS Code also forwards your SSH agent into containers when one is running. The container has no ssh
and hides the agent from its terminals, but for a strict setup start VS Code without it:
env -u SSH_AUTH_SOCK code ..
Run Dev Containers: Reopen in Container. The first time, in its terminal, set your Git identity and enter the token as the password on the first push:
git config --global user.name "Your Name" && git config --global user.email you@example.org
git push # user name, then the token; stored for laterJulia comes from your host's juliaup: the container runs the same versions (julia +1.10), and you add
or update them on the host (juliaup add, juliaup up). The container keeps its own Julia depot
(~/.julia: packages, artifacts, compiled code), apart from the host's. The depot, your Git identity and
the token live in a Podman volume, the container's home folder, which survives rebuilds; delete it with
podman volume rm to start over. Starting the container relabels the host's ~/.juliaup and
~/.julia/juliaup for SELinux so that containers can read them; host Julia works as before.
To reach the cluster from the container with your host key, for example to run ./sync-data.sh, lend
it your SSH agent. The key never enters the container, but while VS Code runs this way, any program in
the container can use the agent.
-
On the host, load the key into the agent (
ssh-add), close VS Code, and start it with an SSH client in the container:DEVCONTAINER_SSH=true code .. Run Dev Containers: Rebuild Container. -
Once, give the container the cluster alias in
~/.ssh/config(theHost myclusterblock above). -
In a container terminal, point SSH to the agent that VS Code forwards; it stays hidden elsewhere:
export SSH_AUTH_SOCK=$(ls -t /tmp/vscode-ssh-auth-*.sock | head -1) ssh mycluster true && ./sync-data.sh
To end it, close that terminal. To remove the SSH client too, start VS Code with
env -u SSH_AUTH_SOCK code . and rebuild the container.
Once per person, clone the repository into your home folder, at the path set in REMOTE_PATH. Jobs write
their results to the clone's own data/ folder, which the clone already contains:
git clone git@github.com:GROUP/PROJECT.git myproject && cd myprojectTo run a computation, copy simulations/run/job.example.jl under a new name (say bands.jl) and adapt it.
Commit the code, then submit from the repository root:
sbatch simulations/run/bands.jlThe job installs and precompiles anything new once (so after a git pull there is nothing else to do),
starts one Julia worker per Slurm task, and writes data/bands.fig1.jld2, saving each case as soon as it is
ready. The file includes meta: the Git commit, whether the code had uncommitted changes, Julia version,
date, node, worker count and job ID, so every figure can be traced to the code that made it. Slurm logs go to
simulations/out/; they are only for monitoring and can be deleted.
At publication, archive the final data (for example on Zenodo) and cite its DOI in the paper.
Claude Code follows .claude/CLAUDE.md. It never touches data/ or pushes data to the cluster, never submits jobs
or starts long computations unless asked, commits only when asked, and proposes a plan before changes across
many files. Personal preferences go in a gitignored CLAUDE.local.md.
| Symptom | Fix |
|---|---|
| Job stops with “Run from the repository root” | cd to the repository root, then sbatch simulations/run/yourjob.jl |
| Job runs but no log appears | simulations/out/ is missing, so Slurm drops the log: git checkout simulations/out |
sync-data.sh can't reach the cluster |
Connect the VPN; check that ssh mycluster logs in without a password |
| “Package MyPaperPackage not found” | Run the instantiate commands; on Julia 1.10, link the package as in Set up, step 1 |
| A figure warns its data came from uncommitted code | Commit the code and rerun the job before the figure goes into the paper |