Imported from yurgenlira/dotfiles (
AGENTS.md). Install upstream withnpx skills add yurgenlira/dotfiles. Copyright stays with the author.
AI Agents Working Guidelines for This Project
Welcome, AI Agent! When you are assigned tasks on this dotfiles project, please strictly adhere to the following guidelines to ensure consistency, scalability, and maintainability.
1. Project Architecture (Ansible)
This repository uses a Data-Driven Ansible setup.
Do NOT create a new Ansible role for every new application. Instead, use the centrally managed lists in ansible/group_vars/all.yml and the universal common role.
How to add new software:
- Open
ansible/group_vars/all.yml. - If the software requires a custom APT repository, add it to the
external_repositorieslist. Remember to define thekey_url,repostring, andkeyringdestination. Thecommonrole will automatically download the GPG key, de-armor it, and configure the apt source. - Add the package name to the
workstation_packageslist.
Exceptions: Only create dedicated roles for software that requires complex configuration files, multi-step templating, or entirely different package managers (e.g., Snap, Flatpak) that cannot be handled by standard definitions.
2. Secrets Management
- We use Bitwarden CLI (
bw) andageencryption viachezmoi. - Never commit unencrypted sensitive information, API keys, or private SSH keys.
- SSH Keys: Read from Bitwarden Secure Notes via explicit
run_once_scripts, or pulled via normalbitwardenchezmoi templates. - If you need to add encrypted files to the repo, rely on
chezmoi add --encrypt <file>.
3. Tool Calling Conventions
When modifying files:
- Always prefer the most precise editing tools available (
replace_file_contentormulti_replace_file_content). Ensure you define exactStartLineandEndLinefor safe patches. - Avoid
run_commandwithecho "text" >> fileorsed. Use native replacement tools. - Don't build separate workflows if
chezmoi applyoransible-playbookalready covers the domain.
4. Local Testing & Linting
- Ensure you update
tests/test-packages.shwhenever you add a new binary or package togroup_vars/all.yml. - Before suggesting massive Ansible changes, ensure they pass
ansible-lint. You can runansible-lintby activating the.venvin the repository root (e.g.,source .venv/bin/activate && ansible-lint ansible/site.yml). - Ansible Lint Rules to Remember:
- Pipes in Shell tasks (
risky-shell-pipe): Whenever using a pipe|in anansible.builtin.shelltask, you must prepend it withset -o pipefailand specifyexecutable: /bin/bash. - YAML Truthy values (
yaml[truthy]): Always use standard YAML booleanstrueorfalse(lowercase). Do not useyesorno. - Dependencies: Custom modules (like
community.general.dconf) require their collections to be installed (ansible-galaxy collection install -r ansible/requirements.yml) before linting will pass.
- Pipes in Shell tasks (
- Integration tests are available via
bash tests/run-all.sh.
5. Idempotence
Scripts must be strictly idempotent:
- Ansible tasks are idempotent by design. Follow best practices.
- If writing a
run_once_script for chezmoi, use standard bash guard clauses (if ! command -v tool; then ... fior checking for file existence).
Thank you for helping maintain a clean, scalable, and secure dotfiles environment!
