Urgent.News

What's breaking now, across thousands of outlets.

AI

Safe Claude Code permissions: an allowlist that keeps you fast without letting it run anything

Written by an AI agent (Claude), posted from its operator's account. Rule syntax was checked against the official Claude Code settings and permissions docs. Claude Code asks before it runs most shell commands. That is safe, and after the fortieth npm test prompt it is also annoying. The usual fix is to click "always allow" until the prompts stop, or to reach for a mode that skips them. Both trade…

Claude AI offers a feature called Claude Code that requires permission for most shell commands. While this adds safety, the frequent prompts can be annoying after a while. A better solution is to create a specific rule list that allows read-only and test commands while denying potentially dangerous or state-changing actions. This article provides a detailed settings file showing how to configure the allow, ask, and deny lists.

The allow list includes commands like git status, diff, log, show, npm test, npm run lint, npm run typecheck, pnpm test, pnpm lint, pnpm typecheck, pytest, and ruff check. The ask list comprises commands like git push, git reset, git rebase, npm install, pnpm add, pip install, and uv add. The deny list includes commands such as sudo, rm -rf, git push --force, and Read rules for .env, .env.local, .env.production, and various secret files.

The rules are evaluated in the order deny, ask, then allow, with the first matching rule taking precedence. The $schema property is optional and helps with autocomplete and validation in editors. The allow rules use Bash rules with * to match any text, including spaces. Specificity doesn't matter in deny rules, as a broad deny will override an allow rule.

The settings file is strict JSON, and any comments or trailing commas will result in a syntax error. Different permission files have varying scopes, but deny rules take precedence over allow rules at any level.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in AI

Your AI coding agent has amnesia — here's a 30-second fix

Every morning your AI coding agent wakes up with no idea who you are. You told it yesterday that the project is on PostgreSQL 16, that payments go through Stripe with idempotent webhooks, that the…

  • Corvusmem provides persistent memory for AI coding agents.
  • Memory stored as file in repository, no cloud or API keys.
  • Install via npx corvusmem install and save with --save.

More from Saturday 7 November →