← ClaudeAtlas

generate-editorconfig-by-techstacklisted

依專案技術棧與 .NET 框架版本,從範本過濾出對應的 .editorconfig 段落並補齊,保留既有自訂偏好。
CloudyWing/ai-dotfiles · ★ 0 · Code & Development · score 76
Install: claude install-skill CloudyWing/ai-dotfiles
# 產生或補齊 .editorconfig ## 範本來源 本 Skill 的規則內容以 `~/.ai-agents/templates/.editorconfig` 為單一來源。修改建議規則時,**只改範本檔,不改 SKILL.md**。SKILL.md 僅描述執行流程與過濾邏輯。 範本檔位於使用者家目錄下的 `.ai-agents/` 專案。執行時若找不到範本檔,告知使用者後流程終止,不自行重建內容。 ### 範本的 Profile 機制 範本含 `# @profile: <name>` 段落標記,由本 Skill 依技術棧過濾: | Profile | 適用情境 | 過濾規則 | | --- | --- | --- | | 未標記 | 所有技術棧通用 | 一律保留 | | `csharp-modern` | C# 8+ / .NET Core / .NET 5+ | `<TargetFramework>` 為 `net5+` / `netcoreapp*` / `net8.0-*` 等現代框架時保留;`net4x` 時整段移除 | | `dotnet-framework` | .NET Framework 4.x | `<TargetFramework>` 為 `net4x` 時保留;現代 .NET 時整段移除 | 非 .NET 技術棧執行時,所有 `.NET / C#` 相關段落(含未標記的 `[*.{cs,vb}]`、`[*.cs]` 與兩個 profile 段)一律跳過。 ## 執行步驟 ### 1. 偵測技術棧與框架版本 掃描專案根目錄: | 偵測依據 | 識別結果 | | --- | --- | | `*.csproj`、`*.sln`、`*.slnx` | C# / .NET 專案 | | `package.json` | Node.js / 前端 | | `*.py`、`pyproject.toml` | Python | | `go.mod` | Go | | `Dockerfile` | Docker | | `*.ps1` | PowerShell | 偵測到 .NET 專案時,**必須**進一步讀取 `*.csproj` 的 `<TargetFramework>` 或 `<TargetFrameworks>` 欄位,判定屬於: - **.NET Framework**(`net4x`,如 `net472`、`net48`)→ 套用 `dotnet-framework` profile - **Modern .NET**(`net5.0` 以上、`netcoreapp*`、`net8.0-windows` 等)→ 套用 `csharp-modern` profile - **多目標**(`<TargetFrameworks>` 同時含 Framework 與 Modern)→ 兩個 profile 都套用,由 IDE 依檔案副檔名與 pattern 解析 若 solution 內多個專案目標框架不一致,以**最舊**的為準(最保守,避免新設定漏給舊專案)。 ### 2. 讀取範本 讀取 `~/.ai-agents/templates/.editorconfig`,解析三類段落: - **通用段落**:未標記的 `[*]`、`[*.md]`、`[*.{json,...}]`、`[*.py]`、`[*.ps1]`、`[*.{csv,bat,cmd}]`、`[*.{cs,vb}]`、`[*.c