How to Use Claude Code Safely — Leveraging cc-health-check

Haram

@haram

Have you tried Anthropic's Claude Code, which lets you write code and run commands directly in your terminal? It's incredibly convenient to grant an AI agent full terminal access, but many of you have likely felt nervous about it potentially running dangerous commands like rm -rf or git force push on its own. I couldn't take my eyes off the screen the first time I used it either! Fortunately, the developer community has released a useful security diagnostic tool that helps you use Claude Code much more safely.

By running a single command in your terminal, it instantly scans your Claude Code config files and CLAUDE.md for any risky security vulnerabilities. You can also use the companion tool, cc-safe-setup, to automatically set up 8 safety guardrail hooks that prevent dangerous command execution in just 10 seconds.

bash
# 보안 상태 진단하기
npx cc-health-check

# 안전한 훅 자동으로 설치하기
npx cc-safe-setup

Here's a practical tip: In the early versions of Claude Code v2, a bug was reported where returning process exit code 2 in the PreToolUse hook wouldn't reliably block tool execution within the sub-agent. To be absolutely sure it's blocked, don't rely solely on exit codes. I recommend a configuration that explicitly signals rejection by returning a JSON object via standard output, as shown in the example below. Be sure to apply this when using terminal agents!

json
{
  "hookSpecificOutput": {
    "permissionDecision": "deny"
  }
}

No comments yet.