brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: claude --append-system-prompt-file adds your own rules to the default prompt

Claude
~/tips/tip-claude-code-append-system-prompt-file

claude --append-system-prompt-file ./extra-rules.txt

Adds text from a file to the end of Claude Code's default system prompt for one session.

CLAUDE.md holds the rules a project always follows. For instructions that belong to a single run, such as a scripted call, a flag suits me better.

Claude Code has two flags that append text to its default system prompt: --append-system-prompt for text on the command line and --append-system-prompt-file for text from a file.

claude --append-system-prompt-file ./extra-rules.txt

The file is plain text. A line like “Answer in Dutch” or “Never touch files under /vendor” is enough. The docs say appending keeps the default tool guidance, safety instructions and coding conventions, so you only supply what differs.

You can combine both flags with -p for a one-off scripted call:

claude -p --append-system-prompt-file ./style.md --append-system-prompt "Always reply in French" "Summarize README.md"

Claude then receives the default prompt, the contents of style.md, a blank line, and the inline text. The file content comes first even if you type the flags in the other order. Passing a flag together with its own file form needs Claude Code v2.1.283 or later, according to the reference.

The append flags only add. To replace the default prompt you need --system-prompt or --system-prompt-file, which drops all of it, tool guidance and safety instructions included. For conventions a project should always follow, the docs point to CLAUDE.md, and for personas you switch between, to output styles.

Further reading: Claude Code CLI reference

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link