settings.json template for AI coding projects

Replaces .claude/settings.json. Keeps Expo's plugin, adds hooks: blocks edits to .env, runs tsc and tests before a task is done.

Download settings.json

How to use this template

  1. Read the template. Inspect the full file below and decide which instructions match your project.
  2. Adapt it to your repo. Save it as .claude/settings.json. Replace placeholders and update stack choices, paths and verification commands to match your repository.
  3. Check and commit. Review the diff. Test the listed commands and keep the file in version control so future changes can be reviewed.

Complete template

{
  "enabledPlugins": {
    "expo@claude-plugins-official": true
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "node -e \"let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{const f=(JSON.parse(d).tool_input||{}).file_path||'';const b=require('path').win32.basename(f);if((b==='.env'||b.startsWith('.env.'))&&b!=='.env.example'){console.error('Blocked: .env holds the secret keys. Ask the user to change it by hand.');process.exit(2)}})\""
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "node -e \"let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{if(JSON.parse(d).stop_hook_active)process.exit(0);const x=require('child_process');if(!x.execSync('git status --porcelain').toString().trim())process.exit(0);try{x.execSync('npx tsc --noEmit',{stdio:'pipe'});x.execSync('npm run test --if-present -- --watchAll=false',{stdio:'pipe'})}catch(e){console.error('Checks failed. Fix this before you call the task done:');console.error(String(e.stdout||'')+String(e.stderr||''));process.exit(2)}})\"",
            "timeout": 300
          }
        ]
      }
    ]
  }
}