Adopt Spec

zernie/vigiles/skills/adopt-spec

作者 zernie1d562c69566f無授權條款15 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫今天更新

Adopt a typed .spec.ts for an existing hand-written CLAUDE.md — start from the file you already have, non-destructively

僅含說明AI & Agents
AI 產生的概覽

將現有的手寫 CLAUDE.md 轉換為使用 vigiles 規範函式庫的型別化 CLAUDE.md.spec.ts。

功能
此技能引導代理為現有的手寫 CLAUDE.md 或 AGENTS.md 採用型別化規範檔。它會將 Markdown 解析為命令、關鍵檔案、規則與散文段落,把每條規則歸類為 enforce() 或 guidance(),並產生保留原始內容的 CLAUDE.md.spec.ts。接著它會驗證規範能否編譯回原檔,並在寫入前提供轉換摘要。
適用情境
當儲存庫已有手寫的 CLAUDE.md 或 AGENTS.md,而使用者希望在不重寫檔案的前提下取得型別安全、可驗證的指示時使用。也適用於使用者詢問移轉至 vigiles 規範,或將規範編譯與檢查加入 CI 的情境。
執行需求
需要 vigiles npm 套件(建議列為 devDependency),以及 Node.js 與 npm/npx,用來執行 vigiles compile 和 vigiles lint。此技能不附帶指令碼,僅為說明文件。選用的 CI 設定涉及 GitHub Actions。

Start a typed CLAUDE.md.spec.ts from an existing hand-written CLAUDE.md (or AGENTS.md). This is the non-destructive adoption path — you keep your existing instruction file as the starting point and get type safety going forward.

Adoption rules

Adoption is the safe, faithful on-ramp — never an upgrade in disguise. These are non-negotiable:

  • Faithful. Preserve every rule, command, key file, and prose section as-is. Invent nothing — the spec must compile back to ~the user's existing file.
  • Non-destructive. Never edit the original CLAUDE.md / AGENTS.md. Only write the new .spec.ts. Never auto-compile over the file — switching it to spec-managed is a separate, explicit step the user runs with a diff to review.
  • Don't escalate enforcement. Keep guidance() as guidance(). Upgrading to enforce() has a cost (config/plugins, possible false positives) and is a separate opt-in step — the strengthen skill. Adoption is not turning on strict / workflow gating.
  • Reversible. vigiles eject <file> hands the file back as plain hand-owned markdown anytime — it's never a one-way door. Tell the user this.
  • Ask before writing. Present the generated spec and a conversion summary first; write only on the user's yes.
  • A lighter touch exists. For no spec at all, inline <!-- vigiles:enforce ... --> comments are verified by vigiles lint with the same engine.

Instructions

Step 1: Read the Existing File

Read the target instruction file (default: CLAUDE.md in the repo root). If the user specified a path, use that.

Also check if vigiles is installed: look for vigiles in package.json devDependencies. If not, suggest:

bash
npm install -D vigiles

Step 2: Parse the Structure

Identify these sections in the markdown:

  • Commands — lines like `npm run build` — description or - `command` — description
  • Key files — lines like `src/foo.ts` — description listing important files
  • Rules — ### headings with **Enforced by:** or **Guidance only** annotations
  • Prose sections — everything else (positioning, architecture, principles, etc.)

For each rule, classify it:

  • Has **Enforced by:** \linter/rule`→enforce("linter/rule", "why")`
  • Has **Enforced by:** \code-review`or similar non-linter →guidance("...")`
  • Has **Guidance only** → guidance("...")
  • Has no annotation → mark as TODO for the user to classify

Step 3: Generate the Spec File

Create CLAUDE.md.spec.ts (or the appropriate name based on the source file) with this structure:

typescript
import {  claude,  enforce,  guidance,  file,  cmd,  ref,  instructions,} from "vigiles/spec";
export default claude({  sections: {    // Prose sections here  },
  keyFiles: {    // Key files here. A path maps to ONE LINE saying what the file is for —    // aim for 120 characters, never exceed ~200. The entry is a pointer, not a    // summary: how the file works belongs in its own header comment, which is    // read when someone opens it. This file is loaded on every request, so a    // paragraph here is paid for every turn. Prune a stale neighbour whenever    // you add one; `vigiles audit` prints the running total as    // `Always-loaded instructions`.  },
  commands: {    // Commands here  },
  rules: {    // Rules here  },});

Important guidelines:

  • Use file() refs in sections where file paths appear in backticks — this enables stale reference detection
  • Use cmd() refs for any npm run commands mentioned in sections
  • Convert **Enforced by:** \code-review`rules toguidance()` — code review is not a mechanical enforcement
  • For rules with no annotation, add a // TODO: classify as enforce() or guidance() comment
  • Keep rule IDs as kebab-case versions of the heading text
  • Preserve the **Why:** text as the second argument to enforce() or guidance()
  • If sections reference other files or skills, use ref() for cross-references

Step 4: Verify the Spec Compiles

Run:

bash
npm run buildnpx vigiles compile CLAUDE.md.spec.ts

Compare the compiled output against the original file. Key differences are expected (formatting, section ordering), but all rules, commands, key files, and prose content should be preserved.

Step 5: Present the Result

Show the user:

  1. The generated spec file
  2. How many rules were converted (enforce vs guidance vs TODO)
  3. How many file/cmd refs were added for stale reference detection
  4. The command to compile: npx vigiles compile
  5. The command to verify: npx vigiles lint

Ask if they want you to write the file. If yes, also suggest adding to .gitignore or updating CI to run vigiles compile and vigiles lint.

Step 6: Optional — Set Up CI

If the user wants CI integration, suggest adding to their GitHub Actions workflow:

yaml
- name: Compile specs  run: npx vigiles compile- name: Verify references + integrity  run: npx vigiles lint

Or using the vigiles GitHub Action:

yaml
- uses: zernie/vigiles@v1  with:    command: lint

來源與署名

來源:zernie/vigiles位於skills/adopt-spec提交1d562c6

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 zernie/vigiles 的技能

Linter Docs

zernie

Deep linter reference for authoring or debugging a vigiles enforce() rule — plugin tables, AST selectors, type-aware rules, auto-fix, and edge cases for ESLint, Ruff, Pylint, RuboCop, Stylelint, and Clippy. Use when you need the exact rule name or config for a specific linter, not for running a linter. (JVM/Go linters — detekt, ktlint, Checkstyle, golangci-lint — and Cedar have no deep-dive file yet; their reference lives in docs/linter-support.md.)

待分類15今天更新

Debug My Harness

zernie

透過讀取本機 .vigiles/runs.jsonl 飛行記錄帳本來診斷代理框架的異常行為。

AI & Agents15今天更新

Review Docs

zernie

Review the README or a documentation page from several real reader points of view at once. Fans out one parallel reviewer per audience — Claude Code newcomer, power user, plugin/skill author, skeptical senior engineer, non-running decision-maker — each scoring it x/5 and naming concrete, line-level fixes. Use when asked to review, critique, grade, or "get to N/5" the README or any front-door doc, or to check how a doc reads for real users. Not for code review (use /code-review for that).

待分類15今天更新

Pr To Lint Rule

zernie

把反覆出現的散文式程式碼審查規則合成為自訂 lint 規則,並由獨立健全性測試把關,未通過就棄用。

Software Development15今天更新

Enforce Rules Format

zernie

驗證專案指令檔案中的規則是否具備正確的強制分類,並修正缺少的分類。

AI & Agents15今天更新

Deep Research

zernie

Use when the user asks to research a topic in depth, map a competitive/market landscape, run a multi-source investigation, or "fan out" parallel research agents — anything where many findings must be gathered and then NOT lost. Enforces durable, detail-preserving research (write full findings to disk; keep a full appendix beside the synthesis).

待分類15今天更新