agentleFS
ryankoleanryankolean/summit-claude-skills/skills/cli-bat/SKILL.md

cli-bat

Skill3 starsChanged 7 months agoMITView on GitHub

Covers effective use of bat, the syntax-highlighting cat replacement, for viewing files, previewing diffs, using as a MANPAGER, integrating with fzf previews, and customizing themes. Activates when the user asks about bat, syntax-highlighted file viewing, or replacing cat/less.

  • Reads credentials

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    fzf (cli-fzf): Use --preview 'bat --color=always {}' to get syntax-highlighted previews inside any fzf selection UI

    line 186

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

bat — cat with Syntax Highlighting

Repo: https://github.com/sharkdp/bat

A cat clone with syntax highlighting, Git integration, line numbers, and automatic paging. Drop-in replacement for cat with a much better reading experience for source code, configs, and diffs.

When to Activate

Manual triggers:

  • "How do I use bat?"
  • "Syntax highlight a file in the terminal"
  • "Better cat / better less"
  • "View a file with line numbers"

Auto-detect triggers:

  • User wants to view source files with highlighting in the terminal
  • User is building fzf previews that need syntax highlighting
  • User wants to use bat as a pager for man pages or git diff
  • User wants to inspect non-printable characters in a file
  • User wants to view only a range of lines from a large file

Key Commands

Basic Usage

bat file.py                      # View file with syntax highlighting + line numbers
bat file1.py file2.py            # View multiple files
bat -l json file.txt             # Force language (json, python, yaml, etc.)
bat -n file.py                   # Show line numbers only (no decorations)
bat -A file.py                   # Show non-printable chars (tabs, spaces, newlines)
bat -p file.py                   # Plain output (no line numbers, no header, no pager)
bat --diff file.py               # Show only lines changed vs Git (requires git repo)
bat -r 10:50 file.py             # Show only lines 10–50
bat -r 10: file.py               # Show from line 10 to end
bat -r :50 file.py               # Show first 50 lines
bat --list-languages             # List all supported languages
bat --list-themes                # List all available themes

Output Control

bat -P file.py                   # Disable pager (print directly, like cat)
bat --paging=never file.py       # Same as -P
bat --paging=always file.py      # Always use pager even for short files
bat --wrap=never file.py         # No line wrapping (scroll horizontally)
bat --tabs 4 file.py             # Set tab width to 4 spaces
bat --style=plain file.py        # No line numbers, no Git marks, no header
bat --style=numbers,header file.py  # Only specific decorations

Theming

bat --theme=TwoDark file.py      # Use a specific theme
bat --theme=ansi file.py         # ANSI colors (good for light/dark compatibility)
bat --theme=GitHub file.py       # GitHub-style theme
BAT_THEME="TwoDark" bat file.py  # Set via env var (put in .bashrc/.zshrc)
bat --list-themes | fzf          # Interactively preview themes

Advanced Patterns

Use bat as MANPAGER

# In ~/.bashrc or ~/.zshrc:
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"

# Now man pages render with bat's syntax highlighting:
man ls
man grep

Use bat as Git Diff Pager

# Preview staged/unstaged changes with syntax highlighting:
git diff | bat --language=diff
git diff HEAD | bat -l diff --style=plain

# Set bat as the default git pager:
git config --global core.pager "bat --style=plain"
# Or just for diff:
git config --global pager.diff "bat"
git config --global pager.log "bat"

fzf Preview Integration

# Use bat for syntax-highlighted file previews in fzf:
fzf --preview 'bat --color=always {}'

# With line-range preview centered on a match (for rg output):
rg --line-number '' | fzf \
  --delimiter ':' \
  --preview 'bat --color=always --highlight-line {2} {1}' \
  --preview-window 'up,60%,border-bottom,+{2}+3/3'

# Open the selected file at the matching line in $EDITOR:
rg --line-number '' | fzf \
  --delimiter ':' \
  --preview 'bat --color=always --highlight-line {2} {1}' | \
  awk -F: '{print "+"$2" "$1}' | xargs $EDITOR

Piping from curl / Remote Files

# View an API response with JSON highlighting:
curl -s https://api.example.com/data | bat -l json

# Highlight a shell script fetched from remote:
curl -s https://raw.githubusercontent.com/.../script.sh | bat -l sh

# View a local response body saved to file:
http GET api.example.com/endpoint | bat -l json

Custom Themes

# Theme files go in bat's config dir:
bat --config-dir        # Shows path (e.g., ~/.config/bat)
mkdir -p $(bat --config-dir)/themes

# Drop .tmTheme or .sublime-color-scheme files there, then:
bat cache --build       # Rebuild theme cache

# Use your custom theme:
bat --theme=MyTheme file.py

bat Config File

# ~/.config/bat/config
--theme=TwoDark
--style=numbers,changes,header
--paging=auto
--map-syntax "*.conf:INI"
--map-syntax "*.env:Dotenv"
--map-syntax "Dockerfile*:Dockerfile"

Show Non-Printable Characters

bat -A file.txt      # Tabs shown as ^I, line endings as $, spaces as ·
bat -A *.sh          # Good for spotting Windows line endings (CRLF)

Practical Examples

Daily Workflows

# Quick syntax-highlighted view of any config:
bat ~/.ssh/config
bat /etc/hosts
bat package.json

# Preview last 20 lines of a log:
bat -r -20: app.log

# Compare two files side-by-side (combine with diff):
diff <(bat -p file1.py) <(bat -p file2.py)

# View a range and pipe to clipboard:
bat -r 10:30 -p main.py | pbcopy

Aliases (add to .bashrc/.zshrc)

alias cat='bat --paging=never'     # Replace cat with bat
alias catp='bat -p --paging=never' # bat with no decorations (truly cat-like)
alias batn='bat -n'                # Line numbers only
alias bata='bat -A'                # Show non-printable chars

Chaining with Other Skills

  • fzf (cli-fzf): Use --preview 'bat --color=always {}' to get syntax-highlighted previews inside any fzf selection UI
  • fd (cli-fd): fd -e py | xargs bat to view all Python files with highlighting; fd -e md | fzf --preview 'bat --color=always {}' for interactive selection
  • ripgrep (cli-ripgrep): Combine rg's line-number output with bat's --highlight-line for pinpoint preview of search matches
  • git: Set core.pager=bat or pager.diff=bat for syntax-highlighted git output across all git commands

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.