Agent skill

viewing-files

Enhanced cat clone with syntax highlighting, Git integration, and automatic paging for efficient file content viewing. Use this skill when viewing source files, documentation, or when syntax highlighting would improve readability

Stars 8
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/iota9star/my-skills/tree/main/skills/bat

SKILL.md

bat: Enhanced File Viewer with Syntax Highlighting

Always invoke bat skill for enhanced file viewing - do not execute bash commands directly.

Use bat as a modern replacement for cat with beautiful syntax highlighting, Git integration, and smart features.

When to Use bat vs cat

Use bat when:

  • Viewing source code or structured text files
  • Syntax highlighting improves readability
  • Need Git integration or line numbers
  • Working with files >50 lines where highlighting helps
  • Previewing changes from other tools

Use cat when:

  • Very small files (<10 lines)
  • Non-text/binary files
  • Simple concatenation without formatting
  • When highlighting would add noise
  • Performance-critical operations on many tiny files

Common workflow: Any skill → bat skill (preview enhanced output)

Default Strategy

Invoke bat skill for enhanced file viewing with syntax highlighting. Use when viewing source files, documentation, or when syntax highlighting improves readability.

Common workflow: Any discovery skill → bat skill (preview enhanced output).

Key Options

Display Control

  • -n/--number line numbers only
  • -p/--plain plain output (no decorations)
  • -A/--show-all show non-printable characters
  • --line-range START:END view specific lines
  • --wrap never disable line wrapping
  • --tabs N set tab width to N spaces

Language & Themes

  • -l/--language LANG force language detection
  • --list-languages show supported languages
  • --list-themes show available themes
  • --theme NAME set color theme (default: Monokai Extended)
  • --theme-dark/--theme-light auto-switch themes based on terminal
  • BAT_THEME environment variable for default theme

Output Styling

  • --style COMPONENTS control output (numbers,changes,header,grid,snip)
  • --decorations auto|never|always control decorations
  • --color always|never|auto control coloring

Paging

  • --paging auto|never|always control paging behavior
  • --pager COMMAND set custom pager
  • BAT_PAGER environment variable

When to Use

  • Code Review: View source files with syntax highlighting and line numbers
  • Git Workflow: Check file modifications and view historical versions
  • Documentation: Colorize help pages and documentation
  • File Concatenation: Replace cat with enhanced features
  • Integration: Use as previewer for fzf or other tools

Core Principles

  1. Enhanced cat: Drop-in replacement with intelligent improvements
  2. Smart Defaults: Automatic paging when appropriate, Git integration when in repo
  3. Syntax Highlighting: Supports 200+ languages with accurate detection
  4. Performance Optimized: Fast loading, efficient rendering, handles large files well

Detailed Reference

For comprehensive usage patterns, integration examples, advanced features, and troubleshooting, load bat guide when needing:

  • Git integration workflows
  • Output styling and customization details
  • Theme configuration and options
  • Performance optimization tips
  • Shell integration examples

The guide includes:

  • Core usage patterns and language control
  • Git integration workflows
  • Output styling and customization
  • Integration with other tools (fzf, git, ripgrep)
  • Advanced features and configuration
  • Performance tips and troubleshooting

Skill Combinations

For Discovery Phase

  • fd → fzf → bat: Find files, select interactively, view with syntax highlighting
  • ripgrep → fzf → bat: Search content, select matches, view with highlighting
  • jq/yq → fzf → bat: Extract data, select entries, view formatted output

For Analysis Phase

  • analyzing-code-structure → bat: Preview structural changes with syntax highlighting
  • sd → bat: Preview find-and-replace results before committing
  • extracting-code-structure → bat: View extracted code structure with formatting

For Output Preview

  • tokei → bat: View code statistics with formatted output
  • ripgrep → bat: Preview matched files with context highlighting
  • jq/yq → bat: View extracted structured data with syntax formatting

Integration Examples

bash
# Interactive file viewer
fd --type file | fzf --preview="bat --color=always --style=numbers {}" --bind="enter:execute(bat {})"

Expand your agent's capabilities with these related and highly-rated skills.

iota9star/my-skills

analyzing-code

Analyzes code statistics by language for project insight, CI/CD metrics, or before refactoring. Use this skill when understanding project composition, measuring change impact, or generating CI/CD metrics

8 0
Explore
iota9star/my-skills

querying-json

Extracts specific fields from JSON files efficiently using jq instead of reading entire files, saving 80-95% context. Use this skill when querying JSON files, filtering/transforming data, or getting specific field(s) from large JSON files

8 0
Explore
iota9star/my-skills

extracting-code-structure

Extracts file structure (functions, classes, exports) efficiently without reading entire files, using ast-grep, Dart/Flutter analyzer, ctags, or other language-specific tools to get outlines and signatures. Use this skill when listing all methods, functions, or classes in a file, exploring unfamiliar code, getting API overviews, or deciding what to read selectively

8 0
Explore
iota9star/my-skills

querying-yaml

Extracts specific fields from YAML files efficiently using yq instead of reading entire files, saving 80-95% context. Use this skill when querying YAML files, filtering/transforming configuration data, or getting specific field(s) from large YAML files like docker-compose.yml or GitHub Actions workflows

8 0
Explore
iota9star/my-skills

replacing-text

Provides intuitive find & replace CLI with JavaScript regex and string-literal mode. Use this skill when performing text replacements, batch transformations, or need JavaScript-style regex syntax

8 0
Explore
iota9star/my-skills

analyzing-code-structure

Performs structural code search and refactoring by matching code structure instead of exact text. Use when editing code structure with text matching ambiguity, handling "old_string not unique" problems, or performing formatting-independent pattern matching across function signatures, method calls, and class structures

8 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results