| name | iterm2-layout |
| description | Configure iTerm2 workspace layouts with TOML. TRIGGERS - iTerm2 layout, workspace tabs, layout.toml, AutoLaunch. |
| allowed-tools | Bash, Read, Edit |
iTerm2 Layout Configuration
Configure iTerm2 workspace layouts with proper separation of concerns: private paths in TOML config, publishable code in Python script.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
When to Use This Skill
Use this skill when:
- Configuring iTerm2 workspace layouts
- Adding, removing, or modifying workspace tabs
- Setting up AutoLaunch scripts for iTerm2
- Configuring git worktree tab auto-discovery
Configuration Overview
File Locations
| File | Location | Purpose |
|---|
| Config (private) | ~/.config/iterm2/layout.toml | User's workspace paths |
| Script (public) | ~/scripts/iterm2/default-layout.py | Layout logic |
| Template | ~/scripts/iterm2/layout.example.toml | Example config |
Config File Format
[layout]
left_pane_ratio = 0.20
settle_time = 0.3
[commands]
left = "br --sort-by-type-dirs-first"
right = "zsh"
[worktrees]
[[tabs]]
name = "home"
dir = "~"
[[tabs]]
name = "projects"
dir = "~/projects"
[[tabs]]
dir = "~/Documents"
Setup Instructions
First-Time Setup
/usr/bin/env bash << 'CONFIG_EOF'
mkdir -p ~/.config/iterm2
cp ~/scripts/iterm2/layout.example.toml ~/.config/iterm2/layout.toml
CONFIG_EOF
Adding a New Tab
Add a [[tabs]] entry to ~/.config/iterm2/layout.toml:
[[tabs]]
name = "MyProject"
dir = "~/path/to/project"
Name field:
- If omitted, uses directory basename
- Custom names useful for abbreviations (e.g., "AF" instead of "alpha-forge")
Removing a Tab
Delete or comment out the [[tabs]] entry:
Configuration Schema
| Section | Key | Type | Default | Description |
|---|
[layout] | left_pane_ratio | float | 0.20 | Left pane width (0.0-1.0) |
[layout] | settle_time | float | 0.3 | Wait after cd (seconds) |
[commands] | left | string | br... | Left pane command |
[commands] | right | string | zsh | Right pane command |
[worktrees] | alpha_forge_root | string | null | Worktree root (optional) |
[worktrees] | worktree_pattern | string | *.worktree-* | Glob pattern |
[[tabs]] | dir | string | required | Directory path |
[[tabs]] | name | string | basename | Tab display name |
Troubleshooting
Error: "Layout configuration not found"
Symptom: Script Console shows error about missing config
Solution:
cp ~/scripts/iterm2/layout.example.toml ~/.config/iterm2/layout.toml
Error: "Invalid TOML syntax"
Symptom: Script Console shows TOML parse error
Solution:
- Check TOML syntax (quotes, brackets)
- Validate with:
python3 -c "import tomllib; tomllib.load(open('~/.config/iterm2/layout.toml', 'rb'))"
Tabs Not Appearing
Symptom: iTerm2 opens but no custom tabs created
Causes:
- No
[[tabs]] entries in config
- Config file in wrong location
- Script not in AutoLaunch
Solution:
ls -la ~/.config/iterm2/layout.toml
ls -la ~/Library/Application\ Support/iTerm2/Scripts/AutoLaunch/
Directory Does Not Exist Warning
Symptom: Tab skipped with warning in Script Console
Solution: Verify directory path exists or create it:
mkdir -p ~/path/to/missing/directory
Error Handling Behavior
The script uses "print + early return" pattern:
- Missing config: Logs instructions to Script Console, exits cleanly
- Invalid TOML: Logs parse error with details, exits cleanly
- Missing directory: Logs warning, skips tab, continues with others
Viewing errors: Scripts > Manage > Console in iTerm2
Git Worktree Detection (Optional)
Enable dynamic tab creation for git worktrees:
[worktrees]
main_repo_root = "~/projects/my-project"
worktree_pattern = "my-project.worktree-*"
How it works:
- Script globs for
~/projects/my-project.worktree-* directories
- Validates each against
git worktree list
- Generates acronym-based tab names (e.g.,
AF-ssv for sharpe-statistical-validation)
- Inserts worktree tabs after main project tab
References
Post-Execution Reflection
After this skill completes, check before closing:
- Did the command succeed? — If not, fix the instruction or error table that caused the failure.
- Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
- Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.
Only update if the issue is real and reproducible — not speculative.