Compétences plugin-settings
⚙️

plugin-settings

Risque faible ⚙️ Commandes externes

使用 YAML 前置元数据配置插件设置

Également disponible depuis: anthropics,anthropics

使用 YAML 前置元数据和 markdown 内容将插件特定的配置和状态存储在 .claude/plugin-name.local.md 文件中。实现用户可以直接编辑的每个项目的插件自定义。

Prend en charge: Claude Code(CC)
🥉 74 Bronze
1

Télécharger le ZIP du skill

2

Importer dans Claude

Allez dans Paramètres → Capacités → Skills → Importer un skill

3

Activez et commencez à utiliser

Tester

Utilisation de "plugin-settings". 如何仅为某些项目启用我的插件?

Résultat attendu:

  • 在项目中创建一个 .claude/my-plugin.local.md 文件:
  • ---
  • enabled: true
  • ---
  • 你的钩子应该在运行之前检查文件是否存在并读取 enabled 字段
  • 将 .claude/*.local.md 添加到 .gitignore 以防止提交项目特定的设置

Utilisation de "plugin-settings". 如何在我的钩子中解析数字设置?

Résultat attendu:

  • 使用此模式提取和验证数字设置:
  • MAX_SIZE=$(echo "$FRONTMATTER" | grep '^max_size:' | sed 's/max_size: *//')
  • 验证: if [[ "$MAX_SIZE" =~ ^[0-9]+$ ]]; then
  • 在比较中使用: if [[ $MAX_SIZE -gt 1000 ]]; then

Audit de sécurité

Risque faible
v5 • 1/17/2026

This is a documentation skill containing code examples for a plugin settings pattern. All static findings are FALSE POSITIVES - they flag shell command examples in markdown documentation, not actual executable code. The skill has no network access, no credential handling, and contains security mitigations that BLOCK access to sensitive files.

9
Fichiers analysés
2,270
Lignes analysées
1
résultats
5
Total des audits

Score de qualité

64
Architecture
100
Maintenabilité
85
Contenu
20
Communauté
90
Sécurité
96
Conformité aux spécifications

Ce que vous pouvez construire

为插件添加配置

记录如何使用用户可编辑的设置文件使插件可配置

覆盖插件默认值

创建项目特定的插件配置而无需修改插件代码

记录设置模式

在插件 README 中包含带有模板的设置文档

Essayez ces prompts

为插件添加设置
如何使用 .claude/my-plugin.local.md 文件为我的 Claude Code 插件添加用户可配置的设置?
解析前置元数据
向我展示如何在 bash 钩子中从 .local.md 文件解析 YAML 前置元数据
验证设置
有效的插件设置文件需要哪些必填字段和结构?
安全最佳实践
如何防止我的插件设置意外暴露 .env 文件或密钥?

Bonnes pratiques

  • 在读取之前始终验证设置文件结构 - 检查 --- 标记和必填字段
  • 当设置文件不存在时提供合理的默认值以保持向后兼容性
  • 将 .claude/*.local.md 添加到 .gitignore,因为这些是用户本地的覆盖

Éviter

  • 直接在钩子中硬编码设置 - 使自定义变得不可能
  • 将 .local.md 文件提交到 git - 这些是每个用户、每个项目的覆盖
  • 在写入设置之前不验证用户输入 - 可能导致文件格式错误

Foire aux questions

我应该将插件设置文件存储在哪里?
存储在项目根目录的 .claude/plugin-name.local.md 中。.claude 目录是标准位置。
设置更改是否立即生效?
不会。钩子在启动时加载。你必须重启 Claude Code 才能使设置更改生效。
我可以将此用于代理状态吗?
可以。markdown 正文可以包含代理读取和执行的提示或任务描述。
如何防止设置被提交?
在你的插件文档中将 .claude/*.local.md 和 .claude/*.local.json 添加到 .gitignore。
如果设置文件格式错误会发生什么?
你的钩子应该验证结构(检查 --- 标记)并提供优雅的回退到默认值。
我应该使用 JSON 还是 markdown 来设置?
建议插件使用带有 YAML 前置元数据的 Markdown - 允许结构化配置 + 人类可读的正文。