用于创建和管理 AST 禁用规则,阻止特定代码语法或模式出现在编辑中。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "manage-bans" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode-team-kit/main/ban-ast/skills/manage-bans/SKILL.md 2. 保存为 ~/.claude/skills/manage-bans/SKILL.md 3. 装好后重载技能,告诉我可以用了
请创建一条 AST 禁用规则,阻止 JavaScript 中使用 eval(),并给出规则名称、匹配模式和简短说明。
一条可用于拦截 eval() 的禁用规则定义,包含规则名、AST 模式与用途说明。
为 TypeScript 项目新增一条 tree-sitter lint 规则,禁止直接使用 any 类型;请输出规则思路、匹配节点和违规提示文案。
一份 tree-sitter lint 规则方案,说明如何识别 any 类型并在命中时提示开发者修改。
请添加一组 AST 禁用模式,防止代码编辑时出现 Python 的裸 except、硬编码密码和 print 调试语句,并分别说明原因。
多条禁用模式配置,分别覆盖裸 except、硬编码密码和调试输出,并附带原因说明。
Ban rules are discovered from two sources, both checked by the preToolUse hook:
$HOME/.BANNED_AST.md — global rules that apply to all edits, regardless of project.BANNED_AST.md files in any parent directory of the edited file — can contain multiple rules, scoped to that subtree.$HOME/.BANNED_AST.md)Place a BANNED_AST.md in your home directory to define rules that apply globally to every edit. It uses the same multi-rule format as directory-scoped files:
---
name: no-eval
message: "Do not use eval(). It poses a security risk and should be replaced with safer alternatives."
---
(call_expression
function: (identifier) @fn
(#eq? @fn "eval"))
~/.BANNED_AST.md.--- frontmatter containing name and message, followed by --- and the Tree Sitter query.BANNED_AST.md Files (Directory-Scoped)Place a BANNED_AST.md file in any directory to ban patterns for all files at or below that directory. The hook walks up from each edited file's directory to the filesystem root, collecting rules from every BANNED_AST.md it finds.
A single BANNED_AST.md can contain multiple rules, each separated by its own frontmatter block:
---
name: no-eval
message: "Do not use eval(). It poses a security risk."
---
(call_expression
function: (identifier) @fn
(#eq? @fn "eval"))
---
name: no-console-log
message: "Avoid console.log() in production code."
---
(call_expression
function: (member_expression
object: (identifier) @obj
property: (property_identifier) @prop)
(#eq? @obj "console")
(#eq? @prop "log"))
Each rule section starts with --- frontmatter containing name and message, followed by ---, then the Tree Sitter query body. The next --- begins the next rule.
~/.BANNED_AST.md — personal global bans that apply everywhere regardless of file location.BANNED_AST.md — scoped bans for subtrees (e.g. ban any in src/ but allow it in tests/).When both sources define a rule with the same name, the BANNED_AST.md closer to the edited file takes precedence.
<name> justification: ...).The body contains a Tree Sitter query that matches the banned AST nodes. These use S-expression syntax with optional predicates like #eq? and #match?.
~/.BANNED_AST.md)---
name: no-eval
message: "Do not use eval(). It poses a security risk. Use Function constructor or a sandboxed interpreter instead."
---
(call_expression
function: (identifier) @fn
(#eq? @fn "eval"))
BANNED_AST.mdPlace this in a project directory to ban multiple patterns for all files below it:
---
name: no-console-log
message: "Avoid console.log() in production code. Use a structured logging framework instead."
---
(call_expression
function: (member_expression
object: (identifier) @obj
property: (property_identifier) @prop)
(#eq? @obj "console")
(#eq? @prop "log"))
---
name: no-any-type
message: "Do not use the 'any' type. Use 'unknown' or a concrete type instead."
---
(predefined_type) @type
(#eq? @type "any")
…
帮助用户通过 gh 命令获取并查看 GitHub 通知列表,快速处理仓库动态。
帮助 AI 代理读写记忆与规则,并按环境自动选择可用存储方案
汇集多模型独立方案与辩论,辅助实现路径和架构决策
为方案、设计与实现提供高质量第二意见,及早发现逻辑与缺陷问题
分析 Azure DevOps 中 VS Code 滚动构建健康状况并定位失败提交范围
为 GitHub 议题或拉取请求快速添加表情反应,提升协作反馈效率。
帮助用户管理看板任务,创建面板、移动事项并快速检索进度。
帮助 ClawHub 管理人员执行封禁、解封、角色调整与状态核验。
为开发者提供基于上下文的编码规范、开发指引与智能建议
用自然语言生成与编辑图片,并支持分镜、图标集和视频转图创作。
按标签或关键词搜索高质量 AI 绘画提示词,并直达完整提示与示例图。
帮助用户管理 GitHub 通知线程的订阅状态,减少无关提醒干扰。