Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Pattern documentation for configuring settings in Claude Code plugins (from the official Anthropic claude-code repo).
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/validate-settings.sh
1#!/bin/bash2# Settings File Validator3# Validates .claude/plugin-name.local.md structure45set -euo pipefail67# Usage8if [ $# -eq 0 ]; then9echo "Usage: $0 <path/to/settings.local.md>"10echo ""11echo "Validates plugin settings file for:"12echo " - File existence and readability"13echo " - YAML frontmatter structure"14echo " - Required --- markers"15echo " - Field format"16echo ""17echo "Example: $0 .claude/my-plugin.local.md"18exit 119fi2021SETTINGS_FILE="$1"2223echo "๐ Validating settings file: $SETTINGS_FILE"24echo ""2526# Check 1: File exists27if [ ! -f "$SETTINGS_FILE" ]; then28echo "โ File not found: $SETTINGS_FILE"29exit 130fi31echo "โ File exists"3233# Check 2: File is readable34if [ ! -r "$SETTINGS_FILE" ]; then35echo "โ File is not readable"36exit 137fi38echo "โ File is readable"3940# Check 3: Has frontmatter markers41MARKER_COUNT=$(grep -c '^---$' "$SETTINGS_FILE" 2>/dev/null || echo "0")4243if [ "$MARKER_COUNT" -lt 2 ]; then44echo "โ Invalid frontmatter: found $MARKER_COUNT '---' markers (need at least 2)"45echo " Expected format:"46echo " ---"47echo " field: value"48echo " ---"49echo " Content..."50exit 151fi52echo "โ Frontmatter markers present"5354# Check 4: Extract and validate frontmatter55FRONTMATTER=$(sed -n '/^---$/,/^---$/{ /^---$/d; p; }' "$SETTINGS_FILE")5657if [ -z "$FRONTMATTER" ]; then58echo "โ Empty frontmatter (nothing between --- markers)"59exit 160fi61echo "โ Frontmatter not empty"6263# Check 5: Frontmatter has valid YAML-like structure64if ! echo "$FRONTMATTER" | grep -q ':'; then65echo "โ ๏ธ Warning: Frontmatter has no key:value pairs"66fi6768# Check 6: Look for common fields69echo ""70echo "Detected fields:"71echo "$FRONTMATTER" | grep '^[a-z_][a-z0-9_]*:' | while IFS=':' read -r key value; do72echo " - $key: ${value:0:50}"73done7475# Check 7: Validate common boolean fields76for field in enabled strict_mode; do77VALUE=$(echo "$FRONTMATTER" | grep "^${field}:" | sed "s/${field}: *//" || true)78if [ -n "$VALUE" ]; then79if [ "$VALUE" != "true" ] && [ "$VALUE" != "false" ]; then80echo "โ ๏ธ Field '$field' should be boolean (true/false), got: $VALUE"81fi82fi83done8485# Check 8: Check body exists86BODY=$(awk '/^---$/{i++; next} i>=2' "$SETTINGS_FILE")8788echo ""89if [ -n "$BODY" ]; then90BODY_LINES=$(echo "$BODY" | wc -l | tr -d ' ')91echo "โ Markdown body present ($BODY_LINES lines)"92else93echo "โ ๏ธ No markdown body (frontmatter only)"94fi9596echo ""97echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"98echo "โ Settings file structure is valid"99echo ""100echo "Reminder: Changes to this file require restarting Claude Code"101exit 0102