Skip to content

Day 47 of 52 · about 20 min · Basics · Bonus

Debug a setup that is not doing what you expect

When a hook, skill or server seems ignored, the cause is usually a file in the wrong place or a stray comma. A few checks find it faster than rewriting, so practise them on a setup broken on purpose.

You’ll finish with

  • A broken settings file found with claude doctor and fixed.
  • A skill and an MCP server traced to where their files sat.
  • The checks to run before you rewrite anything.

You’ll need

  • The Acme Quotes project with scripts/make-broken-setup.mjs from the Day 47 kit, and Node.js 22 or newer.
  • Claude Code, run in a new practice folder, not your project.

Before you start

Tell us about your setup and the steps change to fit it. Your answers stay in this browser, and you can change them at any time.

Which system are you on?

Commands differ between systems. Pick the one you’ll run Claude Code on.

The steps

One step at a time. When a step’s check matches, tick it and the next one opens.

0 of 5 steps done0%
  1. Step 1 of 5: Build the broken practice folder

    A script writes a small folder with three planted mistakes, next to your project.
    Terminal

    Run: node scripts/make-broken-setup.mjs

    Run: cd ../acme-broken-setup

    What happens: Nothing in your project changes.

    The same two commands work in PowerShell.
    scripts/make-broken-setup.mjsJavaScript
    // Day 47: builds a small practice folder whose Claude Code setup has three
    // planted mistakes, so you can find them with Claude Code's own checks.
    //
    //   node scripts/make-broken-setup.mjs [folder]
    //
    // It writes only to the folder you name, by default ../acme-broken-setup
    // (next to this project), and refuses to touch a folder that already exists.
    // Nothing in this project changes, so the mistakes never reach your real
    // setup or a later kit. Tested by test/broken-setup.test.js.
    import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
    import path from 'node:path';
    import { fileURLToPath } from 'node:url';
    
    const root = path.resolve(fileURLToPath(new URL('..', import.meta.url)));
    const target = path.resolve(process.argv[2] ?? path.join(root, '..', 'acme-broken-setup'));
    
    if (existsSync(target)) {
      console.error(`${target} already exists. Delete it, or pass another folder name.`);
      process.exit(1);
    }
    
    // The answers are in the Day 47 lesson, not here, so the folder can't give
    // them away. Each file below holds one mistake.
    const files = {
      'README.md': [
        '# Broken setup (practice)',
        '',
        'Three things in this folder\'s Claude Code setup are wrong on purpose.',
        'Start Claude Code here and use the checks from Day 47 of the',
        'HorizonLux 52-Day Claude Code Challenge to find and fix them:',
        'https://horizonlux.com/resources/claude-code-challenge',
        '',
      ].join('\n'),
    
      '.claude/settings.json': [
        '{',
        '  "hooks": {',
        '    "SessionStart": [',
        '      {',
        '        "hooks": [',
        '          {',
        '            "type": "command",',
        '            "command": "node",',
        '            "args": ["-e", "console.log(\'The practice hook ran, so the hooks in this folder loaded.\')"]',
        '          }',
        '        ]',
        '      }',
        '    ],',
        '  }',
        '}',
        '',
      ].join('\n'),
    
      '.claude/skills/release-notes.md': [
        '---',
        'description: Writes short release notes from the commits since the last tag. Use when the user asks for release notes or a changelog entry.',
        '---',
        '',
        'Write release notes for the changes since the last git tag.',
        'Group them under Added, Changed and Fixed, one line per change.',
        '',
      ].join('\n'),
    
      '.claude/.mcp.json': [
        '{',
        '  "mcpServers": {',
        '    "claude-code-docs": {',
        '      "type": "http",',
        '      "url": "https://code.claude.com/docs/mcp"',
        '    }',
        '  }',
        '}',
        '',
      ].join('\n'),
    };
    
    for (const [rel, text] of Object.entries(files)) {
      const file = path.join(target, ...rel.split('/'));
      mkdirSync(path.dirname(file), { recursive: true });
      writeFileSync(file, text);
    }
    
    console.log(`Created ${target}`);
    console.log('Three things in its Claude Code setup are wrong. Open a terminal there and follow Day 47.');
    

    No peeking: the mistakes are in this file.

    Check it worked

    The script prints Created with the new folder’s path.

  2. Step 2 of 5: Find the broken settings file

    Start Claude Code in the practice folder and read what it reports.

    In order:

    1. You

      You run claude here

    2. File

      Claude Code reads .claude/settings.json

    3. Claude

      A Settings Error dialog opens

      Fix it with Claude, exit, or continue without the file.

    Invalid JSON switches off the whole file, hooks included.

    Choose to exit. Run claude doctor in your terminal: it reports invalid settings files without starting a session. Delete the comma after the last ] in .claude/settings.json, then start claude again.

    Check it worked

    No dialog this time, and /hooks lists a SessionStart hook from project settings.

    If it didn’t work

    No Settings Error appears.

    Check you started claude inside acme-broken-setup, not in your project.

  3. Step 3 of 5: Find the skill that never loads

    A skill needs its own folder with SKILL.md inside.
    In Claude Code

    You type: /skills

    What happens: release-notes is missing, though .claude/skills/release-notes.md exists.

    /context shows the same gap: no description for it under skills.

    For macOS, Linux and WSL

    Terminal
    mkdir -p .claude/skills/release-notes
    mv .claude/skills/release-notes.md .claude/skills/release-notes/SKILL.md

    For Windows

    PowerShell
    New-Item -ItemType Directory .claude\skills\release-notes
    Move-Item .claude\skills\release-notes.md .claude\skills\release-notes\SKILL.md

    Check it worked

    Run /skills again. release-notes is listed.

    If it didn’t work

    It still isn’t listed.

    Run /reload-skills.

  4. Step 4 of 5: Find the MCP server that never appears

    Project servers belong in .mcp.json at the folder root, not inside .claude.
    In Claude Code

    You type: /mcp

    What happens: claude-code-docs isn’t listed: Claude Code never reads .claude/.mcp.json.

    Claude Code reads .mcp.json only when a session starts.

    For macOS, Linux and WSL

    Terminal
    mv .claude/.mcp.json .mcp.json

    For Windows

    PowerShell
    Move-Item .claude\.mcp.json .mcp.json

    Exit Claude Code, move the file, start claude again and approve the server.

    Check it worked

    /mcp lists claude-code-docs as connected.

  5. Step 5 of 5: Keep the checks for next time

    Ask Claude Code what it loaded before you change any file.

    Is it loaded?

    • /context: everything in this session
    • /hooks, /skills, /mcp: one feature each, with its source

    Is it broken?

    • claude doctor: invalid settings files
    • /doctor: a checkup that asks before fixing
    • claude --safe-mode: your setup switched off, to compare
    For a message you don’t recognise, search its exact text in the error reference.

    Check it worked

    Start claude --safe-mode in the folder. /hooks shows no project hooks, proving the fixes came from your files.

Finish · 5 of 5 steps to go

You can find what didn’t load

Three silent failures, found without guessing. The error reference covers the rest.

What you’ll have checked

  • /hooks, /skills and /mcp each show today’s fix.
  • claude doctor reports no invalid settings files.

Lesson updates by email

Get lesson updates by email

Leave your email and we’ll tell you when we add or update a lesson.

We’ll email you when we add or update a lesson. We use your email only for this. Privacy policy

Claude Code for your team

Want Claude Code set up across your team?

HorizonLux sets up and repairs Claude Code for teams: CLAUDE.md rules, hooks that enforce them and reviewed MCP servers. Book a free call to talk it through.

Questions

Questions about Day 47

Why build a separate folder?

So the planted mistakes never touch your real project or a later kit. Delete `acme-broken-setup` when you’re done.

Sources

Checked against the official Claude Code docs on .

Independent resource, not affiliated with Anthropic. HorizonLux wrote this lesson; Claude Code is made by Anthropic.