
What is AGENTS.md? How to write one your coding agents follow
AGENTS.md is a Markdown file that tells AI coding agents how to work on your repo. What it is, which tools read it, and how to write one that works.
Three copy-paste Claude Code hooks: block edits to .env and lockfiles, block git push and rm -rf, and auto-format with Prettier. Tested.
CLAUDE.md is advice. Hooks always run. When a hook exits with code 2, Claude Code blocks the action.
#!/bin/bash
# PreToolUse hook (Bash): blocks commands you never want an agent to run alone.
# From codema.ai. Exit code 2 blocks the command and sends stderr to Claude.
# This is a safety net, not a sandbox: a determined rewrite can slip past a pattern.
COMMAND=$(jq -r '.tool_input.command // empty')
RISKY_PATTERNS=("rm -rf" "git push" "git reset --hard" "supabase db reset" "vercel --prod" "DROP TABLE" "drop table")
for pattern in "${RISKY_PATTERNS[@]}"; do
if [[ "$COMMAND" == *"$pattern"* ]]; then
echo "Blocked: command contains '$pattern'. Ask the user to run it themselves." >&2
exit 2
fi
done
exit 0
protect-files.sh: no edits to .env, lockfiles or .git/block-risky-bash.sh: no rm -rf, git push, git reset --hard, supabase db reset, vercel --prod, DROP TABLE.claude/settings.json that registers all three.claude/ into your project. Merge hooks if you already have a settings file.jq.chmod +x .claude/hooks/*.sh./hooks in Claude Code to check..env. It should be blocked.Claude Code users who let the agent run commands on its own.

AGENTS.md is a Markdown file that tells AI coding agents how to work on your repo. What it is, which tools read it, and how to write one that works.

How to run coding agents safely with Claude Code permission modes, Codex sandbox and approval settings, deny rules, and habits that keep secrets out of reach.

MCP security best practices for vibe coders: prompt injection risks, what the MCP spec requires, and a checklist to use MCP servers without leaking data.
The Codema publication. Consent is required. You are not subscribed until you confirm from the email, and nothing is stored if email delivery is not connected.