tmck-code/dotfiles/linux-bashrc
Claude Code and agent skill by tmck-code/dotfiles
- community
Checking that the SKILL.md file is still in the repository.
Conventions and invariants for editing home/linux/.bashrc — the interactive prompt (PS0 timer, PROMPT_COMMAND=_mk_prompt, exit-status capture, prefix array), the PS1_* colour vars, and performance rules (no forks per prompt). Use when editing home/linux/.bashrc, the prompt, PS1, PS0, _mk_prompt, PROMPT_COMMAND, or adding/changing prompt segments or colours.
Install
npx vskill@latest install tmck-code/dotfiles/linux-bashrcSKILL.md
linux-bashrc
Rules for safely modifying home/linux/.bashrc. The prompt is hot-path code — runs on every Enter — so correctness and zero-fork performance both matter.
Prompt invariants
The prompt is built by _mk_prompt, called via PROMPT_COMMAND=_mk_prompt. Do not prepend anything to PROMPT_COMMAND (e.g. PROMPT_COMMAND="history -a; $PROMPT_COMMAND") — it clobbers $? before _mk_prompt reads it. Put any pre-prompt work inside _mk_prompt.
_mk_prompt rules:
- First line must be `local last_exit=$?`. Any earlier command resets
$?to 0. - Second, capture the duration:
local elapsed=$(( ${EPOCHREALTIME/./} - _PS0_TIME ))if_PS0_TIMEis set; thenunset _PS0_TIME. Start time is set byPS0(see below). - Build the prompt by appending to a local
prefix=(...)array, then assemble with"${prefix[@]}". Do not concatenate strings ad-hoc. - Honour
HIDE— iftest -v HIDE, setPS1=""and skip the prefix.
PS0 captures the command start time:
The \r\e[K overwrites the printed integer in the terminal. Do not remove it. Do not move the time capture into a DEBUG trap — measured ~6× slower (33 µs vs 5 µs per command) and fires per simple command in pipelines.
Colour conventions
Colours are declared once as exported vars at file scope:
Rules:
- Every colour escape must be wrapped in
\[ ... \]so readline counts width correctly. - Always pair with
${PS1_reset}at the end of the coloured span. - Add new colours to the same block, named
PS1_<name>. - Inside
_mk_prompt'sprefixarray, reference the vars — do not inline\e[codes. - Exception: per-call dynamic colour (e.g. exit-code red vs green) may be a
local exit_colour='\[\e[1;31m\]'inside_mk_prompt.
Performance rules
All existing code in this file has been benchmarked as the fastest known way to do its job. Do not modify any existing line without first confirming the replacement is equal-or-better in wall time. Use hyperfine (already installed) to compare:
If the new approach is slower, keep the old one — even if the new one looks cleaner. Document the benchmark result in the commit message when you change a hot-path line.
_mk_prompt runs on every Enter. Forks are expensive (~500 µs each, vs <10 µs for builtins). Rules:
- Use
$EPOCHREALTIME(bash builtin), neverdate(1). - Use bash arithmetic
$(( ... )), neverbcorawk, for prompt-time math. For the float-stringEPOCHREALTIME, strip the dot:${EPOCHREALTIME/./}gives integer microseconds. - Prefer parameter expansion (
${var/pattern/repl},${var:offset:length}) oversed/cut/trsubshells. - Avoid
$(...)command substitution in_mk_promptunless it calls a pure-bash function. - The existing
gitbranchfunction reads.git/HEADdirectly withread -r— do not replace withgitcalls. - If you add a new segment that needs an external tool, put the call behind a guard (e.g. only run if a marker file exists in the repo).
When changing the prompt
Test by sourcing in a subshell and calling _mk_prompt with synthetic state:
Verify exit colour, duration formatting (auto-scaled µs/ms/s/m), and that \[ \] wraps every escape.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinghome/general/.claude/skills/linux-bashrc/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tmck-code/dotfiles/linux-bashrc)