| name | tool-bat |
| description | Use bat for syntax-highlighted file viewing with line numbers and git context. Trigger when readable terminal code inspection is needed. |
tool-bat
When To Use
- Preview file contents with line numbers and syntax highlighting.
- Show focused line ranges during debugging and review.
- Improve readability of piped terminal output.
Trusted Commands
bat file.py
bat --plain file.py
bat -r 10:40 file.py
bat -l json file.txt
command | bat -l json
bat --paging=never file.py
Safe Defaults
- Use
--paging=never in scripts and non-interactive runs.
- Use
--plain when colored decorations would break parsing.
- Fallback to
batcat where distro packaging uses that binary name.
Common Pitfalls
- Forgetting pager behavior in automation contexts.
- Treating bat output as machine-parseable by default.
- Assuming
bat exists where only batcat is installed.
Output Interpretation
- Default output includes line numbers and style metadata.
--plain minimizes formatting for simple text workflows.
Why It Matters For Agents
- Rapidly improves human readability of code and config output.
- Language forcing (
-l) keeps piped content understandable.
Repo Conventions
- Use bat for visual inspection, not search operations.
- Keep examples aligned with WSL aliasing (
bat -> batcat).
Trigger Examples
- Should trigger: "Show this config file with line numbers and syntax color."
- Should trigger: "Preview a script quickly before editing it."
- Should not trigger: "Find every occurrence of
ValidationError in the repo."