MCP HubMCP Hub
Zurück zu Fähigkeiten

state-directory-manager

vamseeachanta
Aktualisiert 3 days ago
5 Ansichten
3
2
3
Auf GitHub ansehen
Anderebashstatepersistenceconfigdirectoryxdg

Über

Diese Fähigkeit bietet XDG-konforme Verwaltung persistenter Zustandsverzeichnisse für Bash-Skripte, wobei Pfadauflösung und Bereinigung automatisch erfolgen. Sie ist ideal für CLI-Tools, die Konfigurationen, Cache-Daten oder Protokolle zwischen Ausführungen speichern müssen. Entwickler sollten sie verwenden, wenn sie portable Skripte erstellen, die zustandsbehaftete Persistenz über mehrere Ausführungen hinweg benötigen.

Schnellinstallation

Claude Code

Empfohlen
Primär
npx skills add vamseeachanta/workspace-hub
Plugin-BefehlAlternativ
/plugin add https://github.com/vamseeachanta/workspace-hub
Git CloneAlternativ
git clone https://github.com/vamseeachanta/workspace-hub.git ~/.claude/skills/state-directory-manager

Kopieren Sie diesen Befehl und fügen Sie ihn in Claude Code ein, um diese Fähigkeit zu installieren

Dokumentation

State Directory Manager

When to Use This Skill

Use when:

  • Scripts need to persist data between runs
  • Storing user preferences or configuration
  • Caching results for performance
  • Managing log files with rotation
  • Creating portable CLI tools

Avoid when:

  • One-time scripts that don't need state
  • Scripts that should be purely stateless
  • When environment variables are sufficient

Complete Example: State Manager Module

#!/bin/bash
# ABOUTME: Complete state directory manager
# ABOUTME: Reusable module for bash scripts

# ─────────────────────────────────────────────────────────────────
# State Directory Manager v1.0.0
# ─────────────────────────────────────────────────────────────────

# Application identity (override in your script)
: "${STATE_APP_NAME:=my-app}"

# Directory setup
STATE_BASE_DIR="${HOME}/.${STATE_APP_NAME}"
STATE_CONFIG_DIR="$STATE_BASE_DIR/config"
STATE_DATA_DIR="$STATE_BASE_DIR/data"
STATE_CACHE_DIR="$STATE_BASE_DIR/cache"
STATE_LOG_DIR="$STATE_BASE_DIR/logs"
STATE_TMP_DIR="$STATE_BASE_DIR/tmp"

# File paths
STATE_CONFIG_FILE="$STATE_CONFIG_DIR/config"
STATE_STATE_FILE="$STATE_DATA_DIR/state"
STATE_LOG_FILE="$STATE_LOG_DIR/app.log"


*See sub-skills for full details.*

## Usage in Scripts

```bash
#!/bin/bash
# Your script that uses the state manager

# Set app name before sourcing
STATE_APP_NAME="my-tool"

# Source the state manager
source /path/to/state-manager.sh

# Now use it
state_config_set "api_key" "abc123"
api_key=$(state_config_get "api_key")

state_set "last_run" "$(date -Iseconds)"
state_log "INFO" "Script started"

# Use cache
if ! result=$(state_cache_get "api_response"); then
    result=$(curl -s https://api.example.com/data)
    state_cache_set "api_response" "$result"
fi

Resources


Version History

  • 1.0.0 (2026-01-14): Initial release - extracted from workspace-hub patterns

Sub-Skills

GitHub Repository

vamseeachanta/workspace-hub
Pfad: .claude/skills/_core/bash/state-directory-manager

Verwandte Skills

usage-tracker

Andere

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.

Skill ansehen

parallel-batch-executor

Andere

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.

Skill ansehen

cross-platform-compat

Andere

This skill provides canonical bash patterns and command replacements for writing portable scripts across Windows Git Bash, Linux, and macOS. It includes OS detection and fixes for common breaking commands like `bc`, `python3`, `nproc`, and `sed -i`. Use it when writing or auditing scripts that need to run reliably on different development machines.

Skill ansehen

json-config-loader

Andere

This skill provides bash configuration parsing patterns for INI, key=value, and JSON files using tools like jq. It's ideal for loading configs into bash scripts, generating JSON reports, and managing settings with associative arrays. Avoid it for complex nested configurations where Python would be more suitable.

Skill ansehen