MCP HubMCP Hub
Retour aux compétences

bash-script-framework

vamseeachanta
Mis à jour Today
8 vues
3
2
3
Voir sur GitHub
Autre

À propos

Cette compétence crée des scripts bash organisés avec des fonctionnalités standardisées telles que la sortie colorée, les systèmes de menus et la gestion des erreurs. Utilisez-la lors de la construction d'outils CLI ou de scripts d'automation pour garantir une structure cohérente et une prise en charge multiplateforme. Elle aide les développeurs à échafauder rapidement des scripts bash professionnels intégrant les meilleures pratiques.

Installation rapide

Claude Code

Recommandé
Principal
npx skills add vamseeachanta/workspace-hub
Commande PluginAlternatif
/plugin add https://github.com/vamseeachanta/workspace-hub
Git CloneAlternatif
git clone https://github.com/vamseeachanta/workspace-hub.git ~/.claude/skills/bash-script-framework

Copiez et collez cette commande dans Claude Code pour installer cette compétence

Documentation

Bash Script Framework

Quick Start

# Create script directory structure
/bash-script-framework init

# Create new script with menu
/bash-script-framework new my-script --menu

# Add to existing scripts directory
/bash-script-framework add utility-script

When to Use

USE when:

  • Creating CLI tools for repository
  • Building menu-driven automation
  • Standardizing script organization
  • Cross-platform script development

DON'T USE when:

  • Python script is more appropriate
  • Simple one-liner needed
  • Windows-only environment

For Windows/Git Bash-compatible scripts, see _core/bash/cross-platform-compat.

Prerequisites

  • Bash 4.0+
  • Unix-like environment (Linux, macOS, WSL)

Overview

Creates organized bash scripts following workspace-hub patterns:

  1. Color utilities - Consistent terminal output
  2. Menu systems - Multi-level navigation
  3. Error handling - Proper exit codes
  4. Logging - Timestamped output
  5. Cross-platform - Linux/macOS/WSL support

Directory Structure

scripts/
├── workspace                  # Main entry point
├── lib/
│   ├── colors.sh             # Color definitions
│   ├── logging.sh            # Logging utilities
│   ├── menu.sh               # Menu system
│   └── utils.sh              # General utilities
├── bash/
│   ├── git/                  # Git operations
│   └── dev/                  # Development tools
├── python/                   # Python utilities
└── powershell/               # Windows scripts

Core Templates

1. Color Library (lib/colors.sh)

#!/bin/bash
# lib/colors.sh - Color definitions for terminal output
# Source this file: source lib/colors.sh

# Reset
NC='\033[0m'              # No Color / Reset

# Regular Colors
BLACK='\033[0;30m'

*See sub-skills for full details.*
### 2. Logging Library (lib/logging.sh)

```bash
#!/bin/bash
# lib/logging.sh - Logging utilities
# Source this file after colors.sh

# Log levels
LOG_LEVEL_DEBUG=0
LOG_LEVEL_INFO=1
LOG_LEVEL_WARN=2
LOG_LEVEL_ERROR=3

*See sub-skills for full details.*
### 3. Menu System (lib/menu.sh)

```bash
#!/bin/bash
# lib/menu.sh - Menu system utilities
# Source after colors.sh

# Display menu and get selection
show_menu() {
    local title="$1"
    shift
    local options=("$@")

*See sub-skills for full details.*
### 4. Utilities (lib/utils.sh)

```bash
#!/bin/bash
# lib/utils.sh - General utilities

# Check if command exists
command_exists() {
    command -v "$1" &> /dev/null
}

# Check required commands

*See sub-skills for full details.*
### 5. Main Script Template

```bash
#!/bin/bash
# scripts/my-tool - Main entry point
# Description: Tool description here

set -e  # Exit on error

# Get script directory and load libraries
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/lib/colors.sh"

*See sub-skills for full details.*

## Related Skills

- [python-project-template](../python-project-template/SKILL.md) - Python CLI tools
- [yaml-workflow-executor](../yaml-workflow-executor/SKILL.md) - YAML-driven execution

## References

- [Bash Reference Manual](https://www.gnu.org/software/bash/manual/)
- [workspace-hub CLI Standards](../../../docs/modules/cli/WORKSPACE_CLI.md)

---

## Version History

- **1.0.0** (2026-01-14): Initial release - bash script framework with colors, menus, logging, and utilities

## Sub-Skills

- [Example 1: Create New CLI Tool (+1)](example-1-create-new-cli-tool/SKILL.md)
- [Best Practices](best-practices/SKILL.md)

Dépôt GitHub

vamseeachanta/workspace-hub
Chemin: .claude/skills/_core/bash/bash-script-framework

Compétences associées

usage-tracker

Autre

The usage-tracker skill enables developers to track and analyze tool or resource usage over time through timestamped logging and reporting. It's designed for generating periodic usage reports, monitoring quotas, and detecting usage trends, but is not suitable for real-time or high-frequency event tracking. Key capabilities include daily/weekly/monthly breakdowns and pattern analysis for building dashboards.

Voir la compétence

parallel-batch-executor

Autre

This skill enables parallel task execution in bash using xargs and job control for significant performance gains. It's ideal for batch operations on independent items like multiple files or repositories, particularly for I/O-bound tasks. Developers should use it when order doesn't matter and avoid it for tasks with dependencies or shared resource requirements.

Voir la compétence

usage-tracker-3-usage-summary-reports

Autre

This skill generates human-readable usage summary reports from Claude API logs, organizing data by model type (Opus, Sonnet, Haiku) and time periods. It provides formatted output with color-coded statistics for quick analysis of API consumption patterns. Use this when you need to monitor and report on Claude model usage across different timeframes.

Voir la compétence

core-context-management-windows-task-scheduler

Autre

This skill automates daily context management by scheduling a Windows Task Scheduler job that runs comprehensive validation and analysis scripts at 6:00 AM. It performs size checks, pattern analysis, and provides optimization suggestions for your Claude development context. Use this to maintain context health through automated daily reports without manual intervention.

Voir la compétence