plugin-settings
使用 YAML 前置元数据配置插件设置
Également disponible depuis: anthropics,anthropics
使用 YAML 前置元数据和 markdown 内容将插件特定的配置和状态存储在 .claude/plugin-name.local.md 文件中。实现用户可以直接编辑的每个项目的插件自定义。
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
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 faibleThis 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.
Facteurs de risque
⚙️ Commandes externes (4)
Score de qualité
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 - 这些是每个用户、每个项目的覆盖
- 在写入设置之前不验证用户输入 - 可能导致文件格式错误