指令发生器
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
写之前先回答:这是给谁的?所有团队成员(工作空间)还是仅此用户(用户级别)?哪些文件会触发它?语言、框架、文件夹还是所有文件?什么行为改变?风格、安全规则、禁止模式或工作流程步骤?
变体 · 使用场合 · 目标长度 简洁的规则 · 简单的首选项(命名、样式、导入) · ≤ 20 行 扩展规则 · 脆弱的工作流程、多步骤过程、容易出错的区域 · 20–60 行 基于参考 · 大型规则集;使用渐进式披露 · SKILL 正文 → `details.md` 如果指令正文超过 60 行,请将其拆分:
请参阅 templates/instructions-concise.md 和 templates/instructions-extended.md。从命令行构建存根:
通过此测试运行每条规则:“Claude 可以不加判断地确定通过/失败吗?”模糊(拒绝)·具体(接受)“编写好的代码”·“更喜欢纯函数;避免实用程序模块中的副作用”“简洁”·“将函数体保持在 40 行以内;如果超出则提取帮助程序”“正确处理错误”·“在 try/catch 中包装异步调用;向调用者显示错误 - 永远不要吞下”
[ ] 此文件中的任何规则是否与其他规则相矛盾? [ ] 是否有任何规则与`.github/copilot-instructions.md`中的现有说明相矛盾? [ ] `applyTo`模式足够精确吗? (过于宽泛的模式 → 高上下文成本)
[ ] 每条规则都是强制性且可验证的(没有“应该”、“尝试”、“考虑”)。 [ ] `applyTo` 模式是正确的 glob 语法 - 针对目标文件路径进行验证。 [ ] 没有时间敏感信息(没有带有到期日期的版本号,没有 API 阶段)。 [ ] 始终使用一致的术语(相同术语表示相同概念)。 [ ] 说明不会重复 VS Code/Copilot 默认值。
# Instruction Generator
Produces clear, scoped, non-contradictory instruction files that Claude loads
and follows automatically.
Instructions are **always-on**: they apply whenever Claude processes matching
files or contexts. Keep them concise. Every word in an instruction file costs
context tokens on every invocation.
## Quick Decision: Which instruction file?
| Need | File | Location |
|------|------|----------|
| Applies to the whole workspace / all files | `copilot-instructions.md` or `AGENTS.md` | `.github/` or root |
| Applies to specific file types or folders | `<name>.instructions.md` | `.github/instructions/` |
| Applies to user (cross-workspace) | `<name>.instructions.md` | `{{VSCODE_USER_PROMPTS_FOLDER}}/` |
`applyTo` patterns:
- `"**"` — matches all files
- `"**/*.ts"` — TypeScript files
- `"src/**"` — everything under `src/`
- `"**/*.{ts,tsx}"` — multiple extensions
- Leave `applyTo` absent for on-demand instructions (not auto-applied)
## Workflow
Follow these steps in order. Mark each ✓ when done.
### Step 1 — Clarify scope
Answer before writing:
- **Who is this for?** All team members (workspace) or just this user (user-level)?
- **What files trigger it?** Language, framework, folder, or all files?
- **What behavior changes?** Style, safety rules, prohibited patterns, or workflow steps?
### Step 2 — Choose depth
| Variant | Use when | Target length |
|---------|----------|---------------|
| Concise rules | Simple preferences (naming, style, imports) | ≤ 20 lines |
| Extended rules | Fragile workflows, multi-step processes, error-prone areas | 20–60 lines |
| Reference-based | Large rule sets; use progressive disclosure | SKILL body → `details.md` |
If the instruction body would exceed 60 lines, split it:
- SKILL body: overview + key rules
- Separate `*.md` file: extended rules, examples, edge cases
### Step 3 — Write the instruction
```markdown
---
applyTo: "<glob>"
description: "<optional: use for on-demand instructions>"
---
# <Short title>
<Context sentence: what this file covers and why>
## Rules
- <Rule 1: imperative, specific, verifiable>
- <Rule 2: imperative, specific, verifiable>
- <Rule n>
## Do not
- <Prohibited action 1>
- <Prohibited action 2>
```
See [templates/instructions-concise.md](templates/instructions-concise.md) and
[templates/instructions-extended.md](templates/instructions-extended.md).
To scaffold a stub from the command line:
```bash
python skills/instruction-generator/scripts/generate_instruction_stub.py \
--apply-to "**/*.ts" --title "TypeScript rules" [--variant concise|extended]
```
### Step 4 — Rewrite vague rules
Run each rule through this test: "Can Claude determine pass/fail without judgment?"
| Vague (reject) | Specific (accept) |
|----------------|-------------------|
| "Write good code" | "Prefer pure functions; avoid side effects in utility modules" |
| "Be concise" | "Keep function bodies under 40 lines; extract helpers if exceeded" |
| "Handle errors properly" | "Wrap async calls in try/catch; surface errors to the caller — never swallow" |
| "Use modern syntax" | "Use ES2022+; prefer `?.` and `??` over manual null checks" |
### Step 5 — Check for contradictions
- [ ] Does any rule contradict another in this file?
- [ ] Does any rule contradict existing instructions in `.github/copilot-instructions.md`?
- [ ] Are `applyTo` patterns precise enough? (Overly broad patterns → high context cost)
### Step 6 — Validate quality checklist
- [ ] Every rule is imperative and verifiable (no "should", "try to", "consider").
- [ ] `applyTo` pattern is correct glob syntax — validated against target file paths.
- [ ] No time-sensitive information (no version numbers with expiry dates, no API phases).
- [ ] Consistent terminology throughout (same term for same concept).
- [ ] Instructions don't duplicate VS Code / Copilot defaults.
- [ ] File length is appropriate for the chosen depth variant.
Run the validator to catch soft rules and frontmatter issues automatically:
```bash
python skills/instruction-generator/scripts/validate_instruction_output.py <path>
# or via poe:
poe validate-instructions <path>
```
## Anti-patterns
- **Omnibus instructions**: one file covering too many unrelated concerns. Split by domain.
- **Soft rules**: "prefer" without a fallback condition. Use "unless X, then Y" when needed.
- **Stale specifics**: "until August 2025 use the old API" — becomes wrong immediately.
- **Missing `applyTo`**: without a glob, the file is on-demand only; teams expecting auto-apply will be confused.
- **Duplicating documentation**: instructions should tell Claude *what* to do, not *explain* the library.
## Output format
Deliver the full instruction file (frontmatter + body) and note:
- Recommended file path
- Recommended scope (workspace vs user)
- Any follow-up rule files if progressive disclosure was used
See [examples/](examples/) for language-specific and workflow-specific patterns.
Concise template: [templates/instructions-concise.md](templates/instructions-concise.md)
Extended template: [templates/instructions-extended.md](templates/instructions-extended.md)
---
> Source: [Anselmoo/universal-creator](https://github.com/Anselmoo/universal-creator) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->
按说明文件中的顺序排列。
快速决策:哪个指令文件?
工作流程
第 1 步——明确范围
第 2 步 — 选择深度
第 3 步 — 编写说明
文件/命令 -> copilot-instructions.md · AGENTS.md · .github/ · <name>.instructions.md · .github/instructions/ · {{VSCODE_USER_PROMPTS_FOLDER}}/ · applyTo · "**"
内容校验值 -> 1b57cc5f1af4
当前原文的自动摘译,尚未人工审校。
快速决策:哪个指令文件?
需要·文件·位置适用于整个工作区/所有文件·
copilot-instructions.md或AGENTS.md·.github/或根适用于特定文件类型或文件夹·<name>.instructions.md·.github/instructions/适用于用户(跨工作区)·<name>.instructions.md·{{VSCODE_USER_PROMPTS_FOLDER}}/``applyTo模式:工作流程
按顺序执行以下步骤。完成后标记每个 ✓。