Zellij
Make terminal work persistent, recoverable, and easy to resume.
Documentation Baseline
- Last checked against local
zellij 0.44.3and official Zellij docs on 2026-07-02. - Config keys in
references/config-and-layouts.mdwere checked againstzellij 0.46.0on 2026-11-20 withzellij setup --dump-config. - Zellij configuration and layouts use KDL.
- Current config discovery order is
--config-dir,ZELLIJ_CONFIG_DIR,$HOME/.config/zellij, platform default, then system config. - Generate current config with
zellij setup --dump-config; validate config paths and syntax withzellij setup --check. - Generate shell snippets with
zellij setup --generate-auto-start <shell>and completions withzellij setup --generate-completion <shell>. - Layouts can be applied at startup with
zellij --layout <path-or-name>. Inside an existing session, the same command adds the layout as new tab(s). - Layouts in the config layout directory can be referenced by bare name, for example
zellij --layout coding. - To force a new session with a layout, use
zellij --session <name> --new-session-with-layout <path-or-name>. - For a create-or-attach path, use
zellij attach --create <session-name>when no special first-run layout is required; when a first-run layout is required, test the exact create path againstzellij --helpandzellij attach --help.
Config, Layouts and Autostart
For the config keys that change behaviour (default mode, theme pinning, simplified UI, mouse options), the auto-enter rules file, project-local autostart through a mise hook, the yazi working-directory pane, scroll-wheel behaviour in stacked panes and the ChromeOS contrast profile, read references/config-and-layouts.md. Two points to keep in mind:
default_mode "locked"passes every key to the pane. A session that seems to ignore keys is often locked;Ctrl gunlocks in the operator's key map.- Pinning
themeturns off automatic light and dark switching. Settheme_darkandtheme_lightinstead if the terminal's palette should decide.
What This Skill Produces
- A working zellij setup plan for the current shell and machine.
- A repeatable session model (naming, attach/detach, cleanup).
- A workflow pattern for panes/tabs that reduces context loss.
- Recovery steps for common failures (stale sessions, orphan panes, bad layout state).
- A default setup profile using guarded auto-start for interactive shells.
Scope
- Workspace-scoped skill at
.claude/skills/zellij. - Before recommending new startup wiring, inspect any global Zellij shell integration already present, typically under
~/.config/zellijand the shell's drop-in directory.
When To Use
Use this skill when the request includes any of these intents:
- "set up zellij"
- "help me use zellij"
- "manage terminal sessions"
- "recover my terminal workspace"
- "replace tmux/screen workflow"
- "make terminal work persistent"
Inputs To Clarify
Before changing startup files or killing sessions, confirm:
- Shell:
bash,zsh,fish, or other. - Scope: one project only, or all projects.
- Style: keyboard-first defaults, tmux-like mode, or minimal learning curve.
- Persistence expectation: temporary session vs long-lived named sessions.
Workflow
1. Establish Baseline
- Confirm zellij exists on PATH by running
command -v zellij. - If zellij is missing, stop and provide install instructions for the host OS.
- Check whether already inside zellij via
$ZELLIJ. - If already inside, avoid nesting. Prefer creating tabs/panes in the current session.
Completion check:
- zellij is installed.
- nested-session risk is identified.
2. Configure Safe Startup Behaviour
- Run
zellij setup --helpand prefer the generated shell-specific snippet fromzellij setup --generate-auto-start <shell>when appropriate. - Add startup integration only after user confirmation.
- Default to guarded auto-start for interactive shells, unless an existing global policy is already present.
- Keep a documented bypass path (eg env flag or direct shell launch).
Default guard pattern:
- Only auto-start in interactive shells.
- Skip when already inside zellij (
$ZELLIJis set). - Respect explicit opt-out env var (eg
ZELLIJ_AUTO_START=0). - Skip cleanly when no controlling terminal is available.
- Avoid auto-starting from editor-hosted terminals unless the user explicitly wants that.
A workable shape, if the user wants auto-start wired globally:
- A guarded hook in the shell's drop-in directory, sourced for interactive shells only
- The decision logic in a separate script the hook calls, so it can be tested on its own
- A rules file mapping directory patterns to session name and layout
- Shared layouts in the config layout directory, referenced by bare name
- A dry-run flag on the decision script, so the choice can be inspected without launching anything
A reasonable default policy: $HOME gets a plain terminal layout and a stable session name, git roots get a coding layout, and ordinary directories do not auto-enter unless the project opts in with a checked-in layout file.
Completion check:
- shell startup change is explicit and reversible.
- user has a bypass path.
3. Standardise Session Lifecycle
Use named sessions for each project or objective.
- List sessions:
zellij list-sessions. - Start/attach by name:
zellij attach --create <session-name>. - If the first-run session needs a layout, create it with
zellij --session <session-name> --new-session-with-layout <layout>, then attach normally on later runs. - Detach (do not kill) when pausing work.
- For deliberate cleanup, kill only targeted sessions with
zellij kill-session <session-name>.
Naming convention:
<repo>-main<repo>-review<repo>-ops
Completion check:
- at least one named session exists.
- user can detach and reattach without losing context.
4. Apply Pane/Tab Operating Pattern
Use tabs for domains and panes for parallel commands.
Recommended tab structure:
editor: primary coding and file navigationtests: continuous test/lint loopslogs: runtime output and diagnosticsops: git, release, maintenance commands
Recommended pane pattern per tab:
- top/left pane: main active command
- secondary pane: watcher or logs
- optional floating pane: short-lived inspection task
Completion check:
- at least 2 tabs with clear purpose.
- no pane left with unknown purpose.
5. Drive Sessions Through CLI Actions When Needed
Use targeted automation when interactive control is slow:
zellij action list-panes --jsonzellij action list-tabs --jsonzellij action current-tab-info --jsonzellij action new-pane -- <command>zellij action new-tab --name <name>zellij action go-to-tab-name --create <name>zellij action dump-layoutzellij action dump-screen --full --path <file>zellij action override-layout <layout>zellij action rename-session <new-name>zellij action save-sessionzellij action detach
Use actions for repeatability, especially in scripts or agent workflows.
Completion check:
- at least one action command successfully used for session control.
6. Recovery Playbook
If a terminal disconnects or state becomes unclear:
- List sessions and identify expected target.
- Reattach to the named session first with
zellij attach <session-name>. - If the layout is degraded, recreate missing tabs and re-run long-lived commands.
- If a session is truly stale, terminate only that session and recreate.
- Save state after major layout rebuild with
zellij action save-session. - For read-only inspection without taking control, use
zellij watch <session-name>.
Completion check:
- user can recover to a known-good session in under 2 minutes.
Decision Points
- If user wants zero startup risk: do not modify shell startup, use manual
zellijlaunch. - Default preference: guarded auto-start in interactive shells with a clear bypass.
- If user wants tmux-like ergonomics: switch mode/profile after confirming preferred keybindings.
- If user runs many repos concurrently: require strict session naming and tab discipline.
- If user mostly runs one repo: keep one stable session and rotate tabs, not sessions.
Quality Criteria
A zellij setup is complete only if all are true:
- User can open, detach, and reattach a named session.
- Session names are predictable.
- Tabs are role-based (not generic "Tab #n").
- Recovery path is documented and tested once.
- Startup behaviour is explicit, minimal, and reversible.
Agent Response Contract
When invoked, produce:
- Current state summary (installed, shell, in-session, session inventory).
- Exact commands to run now (minimal set).
- Expected outcomes after each command.
- Quick rollback instructions for any startup-file change.
- Final verification checklist.
Maintenance
- Re-check official docs and local
zellij --helpbefore updating command syntax, especially for startup, layout, session, and action commands. - After changing global config, run
zellij setup --check, plus the dry-run flag on any auto-start decision script, before relying on the result. - Review the skill after Zellij upgrades or at least quarterly if it is actively used.
Example Prompts
- "Set up zellij safely for zsh with reversible startup config."
- "Create a reliable zellij session model for this repository."
- "I got disconnected, recover my zellij workspace quickly."
- "Convert my ad-hoc terminal usage into a stable zellij workflow."
- "Start a project's zellij session when I enter the directory, through mise."
- "The mouse wheel does nothing in my agent pane. Why?"
- "Half the zellij interface is unreadable in my ChromeOS terminal."