Skip to content
Development
Command

/generate-project-claude-settings

Generate project-specific .claude/settings.json based on project context with appropriate hooks and configurations

From plugin
claude-cmd
313180 skills180 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/generate-project-claude-settings

Context preview

What this command does when you run it.

Generate project-specific .claude/settings.json based on project context with appropriate hooks and configurations

Command definition

generate-project-claude-settings.md
allowed-tools: Bash(fd:*), Bash(rg:*), Bash(jq:*), Bash(gdate:*), Bash(which:*), Read, Write, MultiEdit, WebFetch
name: "Generate Project Claude Settings"
description: "Generate project-specific .claude/settings.json based on project context with appropriate hooks and configurations"
author: "wcygan"
tags: ["scaffold"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
  • Current directory: !`pwd`
  • Project type detection: !`fd -e go -e rs -e ts -e js -e java -e py . -d 2 --type f | head -5 | xargs -I {} basename {} | cut -d. -f2 | sort | uniq | tr '\n' ' ' || echo "unknown"`
  • Package managers: !`fd "package.json|deno.json|Cargo.toml|go.mod|pom.xml|build.gradle|requirements.txt|Pipfile" . -d 2 --type f | head -5 | xargs -I {} basename {} | tr '\n' ' ' || echo "none"`
  • Existing Claude settings: !`[ -f .claude/settings.json ] && echo "exists" || echo "none"`
  • Git repository: !`[ -d .git ] && echo "yes" || echo "no"`
  • CI/CD files: !`fd ".github/workflows|.gitlab-ci.yml|Jenkinsfile" . -d 3 --type f | head -3 | xargs -I {} basename {} 2>/dev/null | tr '\n' ' ' || echo "none"`

Your task

Generate a project-specific .claude/settings.json file based on the project context, including appropriate permissions, hooks, and configurations.

STEP 1: Analyze project context and determine configuration needs

# Create session state
session_id="$SESSION_ID"
state_file="/tmp/claude-settings-gen-$session_id.json"

# Initialize project analysis
echo '{
  "session_id": "'$session_id'",
  "project_root": "'$(pwd)'",
  "timestamp": "'$(gdate -Iseconds 2>/dev/null || date -Iseconds)'",
  "detected_languages": [],
  "detected_tools": [],
  "suggested_hooks": [],
  "existing_settings": null
}' > "$state_file"

**Project Type Detection:**

  • IDENTIFY primary programming languages
  • DETECT build tools and package managers
  • FIND test frameworks and linters
  • CHECK for existing CI/CD configurations
  • LOCATE database configurations or API specs

**Tool Detection:**

# Check for common development tools
tools_found=""
[ -f "package.json" ] && tools_found="$tools_found npm"
[ -f "deno.json" ] && tools_found="$tools_found deno"
[ -f "Cargo.toml" ] && tools_found="$tools_found cargo"
[ -f "go.mod" ] && tools_found="$tools_found go"
[ -f "pom.xml" -o -f "build.gradle" ] && tools_found="$tools_found java"
[ -f "requirements.txt" -o -f "Pipfile" ] && tools_found="$tools_found python"

STEP 2: Fetch latest Claude Code settings documentation

  • USE WebFetch to get current settings options from docs.anthropic.com
  • EXTRACT all available configuration options
  • UNDERSTAND hook types and MCP server configurations

STEP 3: Interactive configuration gathering

PROMPT user for configuration preferences:

1. **Permission Mode**:

  • Strict: Explicit allow/deny lists
  • Permissive: Allow most operations
  • Custom: User-defined rules

2. **Hook Preferences**:

  • Auto-formatting on file edit
  • Git integration (auto-stage, commit helpers)
  • Test execution on code changes
  • Linting and validation
  • Custom command execution

3. **MCP Server Setup**:

  • Database connections (if detected)
  • API integrations
  • File system servers
  • Custom servers

STEP 4: Generate base configuration structure

CREATE initial settings object based on project analysis:

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [],
    "deny": [],
    "defaultMode": "ask"
  },
  "hooks": {},
  "env": {},
  "includeCoAuthoredBy": true
}

STEP 5: Add language-specific configurations

FOR EACH detected language, add appropriate settings:

**JavaScript/TypeScript Projects:**

{
  "permissions": {
    "allow": [
      "Bash(npm run:*)",
      "Bash(npx:*)",
      "Bash(deno task:*)",
      "Read(**/*.js)",
      "Read(**/*.ts)",
      "Write(**/*.js)",
      "Write(**/*.ts)"
    ]
  },
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "npx prettier --write $FILE_PATH 2>/dev/null || true"
          }
        ]
      }
    ]
  }
}

**Go Projects:**

{
  "permissions": {
    "allow": [
      "Bash(go test:*)",
      "Bash(go run:*)",
      "Bash(go build:*)",
      "Bash(go fmt:*)"
    ]
  },
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "[ \"${FILE_PATH##*.}\" = \"go\" ] && go fmt $FILE_PATH || true"
          }
        ]
      }
    ]
  }
}

**Rust Projects:**

{
  "permissions": {
    "allow": [
      "Bash(cargo build:*)",
      "Bash(cargo test:*)",
      "Bash(cargo run:*)",
      "Bash(cargo fmt:*)"
    ]
  },
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "[ \"${FILE_PATH##*.}\" = \"rs\" ] && rustfmt $FILE_PATH || true"
          }
        ]
      }
    ]
  }
}

STEP 6: Add common hooks based on user preferences

**Git Auto-Stage Hook:**

{
  "PostToolUse": [
    {
      "matcher": "Write|Edit|MultiEdit",
      "hooks": [
        {
          "type": "command",
          "command": "[ -d .git ] && git add $FILE_PATH 2>/dev/null || true"
        }
      ]
    }
  ]
}

**Command Logging Hook:**

{
  "PreToolUse": [
    {
      "matcher": "Bash",
      "hooks": [
        {
          "type": "command",
          "command": "echo \"$(date): $TOOL_INPUT\" >> ~/.claude/command-log.txt"
        }
      ]
    }
  ]
}

**Notification Hook:**

{
  "Stop": [
    {
      "matcher": "",
Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin