Sharing configuration files and AppleScripts over a few macOS computers

I have a few computers, still prefer desktop with big screens and only use my MacBook Air if I have to travel around. I hope Apple will one day make this a system feature so I can log into any Mac anywhere, but until then, I use iCloud to share my key config files, so I don't need to edit them many times on each machine. (If you edit the files often and want to have better version management, you can use git to do it too, will need to manually do a git pull, not easy to setup webhook for home computers. I just needed something quick and easy with iCloud.)

I do this with .finicky.js, .ssh/config and .zshrc. And I also sync all my AppleScripts.

# Create iCloud dotfiles directory
mkdir -p ~/Library/Mobile\ Documents/com~apple~CloudDocs/dotfiles

# Backup existing .zshrc if needed
cp ~/.zshrc ~/.zshrc.backup

# Move .zshrc to iCloud
mv ~/.zshrc ~/Library/Mobile\ Documents/com~apple~CloudDocs/dotfiles/

# Create symlink (use -sf to overwrite if exists)
ln -sf ~/Library/Mobile\ Documents/com~apple~CloudDocs/dotfiles/.zshrc ~/.zshrc

# Reload shell
source ~/.zshrc

# Backup existing Scripts folder
cp -r ~/Library/Scripts ~/Library/Scripts.backup

# Move entire Scripts folder to your iCloud configs
mv ~/Library/Scripts ~/Library/Mobile\ Documents/com~apple~CloudDocs/configs/

# Create folder symlink (replace existing)
rm -rf ~/Library/Scripts
ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs/configs/Scripts ~/Library/Scripts

# Hide symlink in Finder (optional, like Desktop/Documents)
chflags -h hidden ~/Library/Scripts