diff --git a/home.nix b/home.nix index a89fb1c..a2fb6f4 100644 --- a/home.nix +++ b/home.nix @@ -177,6 +177,46 @@ programs.neovim-kickstart.enable = true; # Claude Code configuration + home.file.".claude/CLAUDE.md" = { + text = '' + ## Commit Behavior + + After completing each logical unit of work, use the /commit skill to stage + and commit changes before proceeding to the next task. Do not batch unrelated + changes into a single commit. Do not wait to be asked. + ''; + force = true; + }; + + home.file.".claude/commands/commit.md" = { + text = '' + --- + description: Stage and commit changes as a conventional commit with one logical unit per commit + --- + + Review the current working tree with `git status` and `git diff --staged` and `git diff`. + + Then do the following: + + 1. Identify the smallest logical unit of change present. If multiple unrelated changes exist, only stage and commit one unit at a time — leave the rest unstaged. + + 2. Stage only the files (or hunks via `git add -p`) relevant to that logical unit. + + 3. Write a commit message following the Conventional Commits format: + (): + + Types: feat, fix, docs, style, refactor, perf, test, chore, ci + - scope is optional but use it when the change is clearly scoped to a module, package, or domain + - description: lowercase, imperative mood, no trailing period, max ~72 chars + - if the change warrants a body, add it after a blank line + + 4. Run `git commit` with that message. Never use `--no-verify`. + + 5. Report what was committed and what (if anything) remains uncommitted. + ''; + force = true; + }; + home.file.".claude/settings.json" = { text = builtins.toJSON { permissions = { @@ -184,9 +224,11 @@ "Edit" "Write" "Bash(git:*)" - ]; + "Bash(nix-shell:*)" + "Bash(nix eval:*)" + "Bash(nix flake check:*)" + ]; }; - customInstructions = "When working in a git repository, always use conventional commits format (e.g., feat:, fix:, docs:, style:, refactor:, test:, chore:) for commit messages. Do not include the Claude Code signature or Co-Authored-By line in commit messages."; alwaysThinkingEnabled = true; includeCoAuthoredBy = false; };