Skip to content

Add claude CLI aliases for quick model selection#212

Merged
connerohnesorge merged 1 commit intomainfrom
add-claude-aliases
Mar 2, 2026
Merged

Add claude CLI aliases for quick model selection#212
connerohnesorge merged 1 commit intomainfrom
add-claude-aliases

Conversation

@connerohnesorge
Copy link
Copy Markdown
Owner

@connerohnesorge connerohnesorge commented Mar 2, 2026

Summary

  • Adds cldo, clds, cldk shell aliases for launching Claude Code with opus, sonnet, and haiku models
  • All aliases include --dangerously-skip-permissions for unattended usage

Test plan

  • Source .zshrc and verify cldo, clds, cldk aliases are available
  • Run each alias to confirm correct model is selected

🤖 Generated with Claude Code

Summary by CodeRabbit

Chores

  • Added convenient command-line shortcuts for quick access to different Claude model variants.

Adds cldo, clds, and cldk aliases for launching claude with
opus, sonnet, and haiku models respectively, all with
dangerously-skip-permissions flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 2, 2026

Walkthrough

The pull request adds three new zsh shell aliases to .zshrc that provide quick access to the Claude CLI with different model parameters: opus, sonnet, and haiku. Each alias includes the --dangerously-skip-permissions flag and forwards all arguments.

Changes

Cohort / File(s) Summary
Shell Aliases
.zshrc
Adds three new aliases for Claude CLI invocation: cldo (opus model), clds (sonnet model), and cldk (haiku model), each with --dangerously-skip-permissions flag.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding shell aliases for the Claude CLI to enable quick model selection. It is specific, clear, and directly reflects the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-claude-aliases

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.zshrc:
- Around line 56-58: The aliases cldo, clds, and cldk won’t forward runtime
arguments because zsh aliases do textual substitution and don’t accept
positional parameters; replace each alias with a shell function (e.g., define
cldo(), clds(), cldk()) that invokes the claude command with the appropriate
--model value and forwards all invocation arguments using "$@"; update the
existing alias lines to function definitions that call claude
--dangerously-skip-permissions --model=opus/sonnet/haiku respectively and pass
"$@" so arguments are forwarded correctly.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85b8fb9 and e90c275.

📒 Files selected for processing (1)
  • .zshrc

Comment thread .zshrc
Comment on lines +56 to +58
alias cldo="claude --dangerously-skip-permissions --model=opus $@"
alias clds="claude --dangerously-skip-permissions --model=sonnet $@"
alias cldk="claude --dangerously-skip-permissions --model=haiku $@"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

zsh alias $@ argument forwarding vs function

💡 Result:

In zsh, an alias is just textual substitution of the first word of a command line; it does not receive positional parameters, so $@ inside an alias does not mean “the alias’s arguments” (it either expands when the alias is defined or is treated literally, depending on quoting) and won’t forward what you type after the alias name. [1], [2], [3]

What to use instead: a function

Use a function when you need argument forwarding (or any real logic):

mycmd() {
  realcmd "$@"
}

"$@" expands to the arguments passed to the function call. [2]

When an alias “seems” to forward args

This works because the shell appends the extra words after the alias expansion:

alias ll='ls -l'
# `ll /tmp` becomes `ls -l /tmp`

But you still can’t inspect/rewrite/conditionally use those arguments from within an alias (no reliable $@ concept). [1]

If you tried something like this

alias ls='command -v lsd >/dev/null && lsd "$@" || ls "$@"'

That fails for the reason above: aliases aren’t functions, so they don’t have $@; make it a function (and usually do the detection once, at startup, if possible). [3]

Sources:
[1] Zsh Guide: aliases don’t take arguments; use functions (zsh.sourceforge.io) (zsh.sourceforge.io)
[2] Ask Different: use a function + "$@" to pass arguments (apple.stackexchange.com) (apple.stackexchange.com)
[3] Reddit explanation: “Aliases aren’t functions, they don’t have $@” (reddit.com) (reddit.com)

Citations:


Aliases won't forward invocation arguments; use functions instead.

These aliases attempt to forward arguments via $@, but in zsh, aliases perform only textual substitution and do not receive positional parameters. The $@ inside the alias text will not expand to the arguments passed when calling cldo, clds, or cldk.

Proposed fix
-alias cldo="claude --dangerously-skip-permissions --model=opus $@"
-alias clds="claude --dangerously-skip-permissions --model=sonnet $@"
-alias cldk="claude --dangerously-skip-permissions --model=haiku $@"
+cldo() { command claude --dangerously-skip-permissions --model=opus "$@"; }
+clds() { command claude --dangerously-skip-permissions --model=sonnet "$@"; }
+cldk() { command claude --dangerously-skip-permissions --model=haiku "$@"; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alias cldo="claude --dangerously-skip-permissions --model=opus $@"
alias clds="claude --dangerously-skip-permissions --model=sonnet $@"
alias cldk="claude --dangerously-skip-permissions --model=haiku $@"
cldo() { command claude --dangerously-skip-permissions --model=opus "$@"; }
clds() { command claude --dangerously-skip-permissions --model=sonnet "$@"; }
cldk() { command claude --dangerously-skip-permissions --model=haiku "$@"; }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 56 - 58, The aliases cldo, clds, and cldk won’t forward
runtime arguments because zsh aliases do textual substitution and don’t accept
positional parameters; replace each alias with a shell function (e.g., define
cldo(), clds(), cldk()) that invokes the claude command with the appropriate
--model value and forwards all invocation arguments using "$@"; update the
existing alias lines to function definitions that call claude
--dangerously-skip-permissions --model=opus/sonnet/haiku respectively and pass
"$@" so arguments are forwarded correctly.

@connerohnesorge connerohnesorge merged commit 578415b into main Mar 2, 2026
8 of 9 checks passed
@connerohnesorge connerohnesorge deleted the add-claude-aliases branch March 2, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant