docs(aliases): restructure to use dedicated alias.ps1 file

Move all PowerShell functions to ~/Documents/PowerShell/alias.ps1
and source it from $PROFILE, keeping the profile clean and aliases
easy to manage independently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 20:46:40 +07:00
co-authored by Claude Sonnet 4.6
parent d030c37a15
commit 4491fdbd93
+26 -43
View File
@@ -1,8 +1,10 @@
# My Claude Code Aliases
## zclaude (Windows PowerShell)
## Aliases File: `~\Documents\PowerShell\alias.ps1`
Launches Claude with the Z.ai API endpoint and custom model settings.
Keep all Claude aliases in a dedicated file, sourced from `$PROFILE`.
### `~\Documents\PowerShell\alias.ps1`
```powershell
function zclaude {
@@ -14,20 +16,32 @@ function zclaude {
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="GLM-5"
claude
}
# Skip permission prompts
function x { claude --dangerously-skip-permissions }
# Fast Haiku model
function h { claude --model claude-haiku-4-5-20251001 }
# Load diagrams from current project
function cdi {
$diagrams = Get-Content .ai\diagrams\*.md -Raw -ErrorAction SilentlyContinue
if ($diagrams) { claude --append-system-prompt $diagrams } else { claude }
}
```
## How to Install
1. Open your PowerShell profile:
1. Create the aliases file (Claude will write this for you, or paste manually):
```powershell
notepad $PROFILE
```
If the file doesn't exist, create it first:
```powershell
New-Item -Path $PROFILE -ItemType File -Force
New-Item -Path "$HOME\Documents\PowerShell\alias.ps1" -ItemType File -Force
```
2. Paste the function above at the bottom of the file and save.
2. Add one line to your `$PROFILE` to source it:
```powershell
. "$HOME\Documents\PowerShell\alias.ps1"
```
Open profile with: `notepad $PROFILE`
3. Reload your profile:
```powershell
@@ -38,37 +52,6 @@ function zclaude {
## Notes
- Environment variables set this way are scoped to the current session only - they won't leak to other terminals.
- To also load your Mermaid diagrams, extend the function:
```powershell
function zclaude {
$env:ANTHROPIC_AUTH_TOKEN="your-api-key"
$env:ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
$env:API_TIMEOUT_MS="3000000"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="GLM-5"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="GLM-5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="GLM-5"
$diagrams = Get-Content .ai\diagrams\*.md -Raw -ErrorAction SilentlyContinue
if ($diagrams) {
claude --append-system-prompt $diagrams
} else {
claude
}
}
```
## Other Useful Aliases (Optional)
```powershell
# Skip permission prompts
function x { claude --dangerously-skip-permissions }
# Fast Haiku model
function h { claude --model claude-haiku-4-5-20251001 }
# Load diagrams
function cdi {
$diagrams = Get-Content .ai\diagrams\*.md -Raw
claude --append-system-prompt $diagrams
}
```
- Environment variables set inside functions are scoped to the current session only.
- Edit `alias.ps1` anytime to add new aliases - no need to touch `$PROFILE` again.
- You can version control `alias.ps1` separately from your profile.