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今天更新