Skip to content

Claude Code Permissions: Allow, Ask and Deny in a Sample Repo

Guides
A key above a locked wooden drawer and a separate open drawer with a teal folder
A locked drawer and an open one illustrate scoped file access.
Set Claude Code permissions for the job at hand. Let it read the sample files, ask before it edits the draft and block tools or folders the job does not need.

Start with a small repo and a narrow job

Use the sample repo below to write a short release note from a made-up issue. The inputs are in fixtures/. The draft goes in draft/. The private/ folder holds a fake token so you can check a denied read without risking any real data.
Save a copy of your current settings before you edit them. For this sample, use the repo's .claude/settings.json in a clean test folder. Anthropic's settings guide explains project, user and managed settings. Your admin may set rules that apply across projects. Open /permissions to see the rules Claude Code is using.

Allow a read, ask for an edit and deny a path

The sample stays in default mode. Allow Read(/fixtures/**) for source files. Add Edit(/draft/**) under ask to review a proposed change to the draft. Deny Read(/private/**) and Edit(/private/**). The sample also denies Bash, PowerShell, WebFetch and WebSearch. Keep other connectors out of this test workspace.
In project settings, the leading / in these file rules anchors them to the project root. Deny rules take precedence when rules match. For other tools and path forms, follow the Claude Code permissions reference. Treat these rules as controls for Claude Code tools. Keep real keys out of the repo and use approved OS and network controls for stronger isolation.

Check Claude Code permissions in your test repo

First, ask Claude Code to name the issue in fixtures/issue.txt. It should be able to read it. Next, ask for a one-sentence draft in draft/notes.txt. Check that you get a prompt, decline it and inspect the file for changes. Then retry and read the edit before you approve it. Finally, ask it to read the fake token in private/demo.txt. Confirm the read was blocked and the reply did not quote the token.
If a result differs, inspect /permissions and the active settings before you try again. A repo file can contain a request to use a tool or read another file. Treat that request as input. See how prompt injection works and use an agent permission checklist to scope the real job.
Restore your saved settings after the test in a repo you plan to keep. Check the active rules again when you reopen it. The download lists expected results from the docs. We checked the config and paths in the sample. A live Claude Code run is still needed to observe the prompts and the blocked read. Read the Claude privacy guide before bringing work data into the tool.
loading

Loading