/desktop-avalonia:cross-platformfrom desktop-avalonia
Avalonia 桌面專案的跨平台慣例——Windows/macOS/Linux 相容的路徑處理、平台判斷、腳本語法與 null 裝置寫法。Use when 寫檔案路徑、判斷作業系統、寫 shell 腳本或 CI workflow、避免 Windows 專用指令、cross platform、path.combine、跨平台腳本。
Ships in desktop-avalonia. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
桌面應用常需同時支援 Windows、macOS、Linux。路徑、腳本、指令都要跨平台相容。
Path.Combine() 組合,不硬編碼分隔符(\ 或 /)。OperatingSystem.IsWindows() / OperatingSystem.IsMacOS() / OperatingSystem.IsLinux(),不靠字串比對環境變數。GetDefaultPaths())提供,建構函式接受覆寫參數,方便測試與客製。public static AppPaths GetDefaultPaths()
{
var baseDir = OperatingSystem.IsWindows()
? Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
: Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
return new AppPaths(
configFile: Path.Combine(baseDir, "MyApp", "config.json"));
}
腳本以 Git Bash / Unix 語法為準,路徑分隔符統一用 /,換行符用 LF(於 .editorconfig 統一)。
統一使用 /dev/null,不要用 Windows 的 nul:
command > /dev/null # 正確
command > /dev/null 2>&1 # 正確
command > nul # 錯誤(在 Git Bash 會實際建立一個名為 nul 的檔案)
| 避免 | 跨平台替代 |
|---|---|
dir | ls |
copy / move / del | cp / mv / rm |
type | cat |
set VAR= | export VAR= |
taskkill | 使用跨平台 SDK 方法處理程序 |
dotnet build / test / run / publish # 建置與執行皆跨平台
mkdir -p path # 建立目錄(含中間層)
發佈時同時產出各目標平台版本(如 win-x64、osx-arm64、linux-x64),依實際使用者環境挑選要涵蓋的 RID。發佈細節見 desktop-build-publish skill。
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/avalonia-mvvmAvalonia + CommunityToolkit.Mvvm 桌面專案的 MVVM 慣例——ViewModel 結構、ObservableProperty/RelayCommand、compiled bindings、設計時支援與 AXAML 特殊情境。Use when 撰寫或修改 Avalonia View/ViewModel、寫 AXAML binding、處理對話框回傳、DataGrid 命令綁定、avalonia mvvm、observableproperty、relaycommand。/desktop-build-publishAvalonia 桌面應用的建置與發佈——dotnet build 驗證、跨平台單一執行檔發佈(win/osx/linux RID)、macOS .app/.dmg 打包與輸出位置。Use when 使用者說「建置」「build」「編譯」「發佈」「publish」「打包」「產生執行檔」「single file」「self-contained」或要建立 Windows/macOS/Linux 可執行檔。Other plugins' skills for the same job
npx claudepluginhub kerryhuang/kerryhuang-plugins --plugin desktop-avalonia