I spent a week trying to keep a coding agent out of one directory, and I lost that argument at every layer that lives inside the agent. The markdown rule folded when I claimed the repo owner was making an exception. The deny rule covered git commit and not git -C.
Source: [Dev.to](https://dev.to/hassekf/how-do-you-stop-claude-code-from-writing-files-2n29)