state-directory-manager-1-xdg-base-directory-standard
정보
이 스킬은 애플리케이션 상태 관리를 위해 XDG 기본 디렉토리 표준을 구현하여, 구성, 데이터, 캐시 및 상태 파일에 대한 크로스 플랫폼 디렉토리 경로를 제공합니다. 환경 변수 폴백을 자동으로 처리하고 애플리케이션별 하위 디렉토리를 생성합니다. 다양한 운영 체제에서 표준화되고 체계화된 파일 저장이 필요한 CLI 도구나 애플리케이션을 구축할 때 사용하세요.
빠른 설치
Claude Code
추천npx skills add vamseeachanta/workspace-hub/plugin add https://github.com/vamseeachanta/workspace-hubgit clone https://github.com/vamseeachanta/workspace-hub.git ~/.claude/skills/state-directory-manager-1-xdg-base-directory-standardClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
1. XDG Base Directory Standard (+2)
1. XDG Base Directory Standard
Follow the XDG specification for directory locations:
#!/bin/bash
# ABOUTME: XDG Base Directory compliant state management
# ABOUTME: Cross-platform directory locations
# XDG Base Directories with fallbacks
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
# Application-specific directories
APP_NAME="my-tool"
CONFIG_DIR="$XDG_CONFIG_HOME/$APP_NAME"
DATA_DIR="$XDG_DATA_HOME/$APP_NAME"
STATE_DIR="$XDG_STATE_HOME/$APP_NAME"
CACHE_DIR="$XDG_CACHE_HOME/$APP_NAME"
LOG_DIR="$STATE_DIR/logs"
# Initialize directories
init_directories() {
mkdir -p "$CONFIG_DIR"
mkdir -p "$DATA_DIR"
mkdir -p "$STATE_DIR"
mkdir -p "$CACHE_DIR"
mkdir -p "$LOG_DIR"
}
2. Workspace-Hub Pattern
Alternative using home directory (from workspace-hub scripts):
#!/bin/bash
# ABOUTME: Workspace-hub style state directory management
# ABOUTME: Simple $HOME/.app-name pattern
APP_NAME="workspace-hub"
APP_DIR="${HOME}/.${APP_NAME}"
# Directory structure
CONFIG_DIR="$APP_DIR/config"
DATA_DIR="$APP_DIR/data"
LOGS_DIR="$APP_DIR/logs"
CACHE_DIR="$APP_DIR/cache"
TEMP_DIR="$APP_DIR/tmp"
# Initialize with proper permissions
init_app_dirs() {
local dirs=("$CONFIG_DIR" "$DATA_DIR" "$LOGS_DIR" "$CACHE_DIR" "$TEMP_DIR")
for dir in "${dirs[@]}"; do
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
chmod 700 "$dir" # Private by default
fi
done
}
# Clean old temp files
clean_temp() {
find "$TEMP_DIR" -type f -mtime +1 -delete 2>/dev/null || true
}
3. Configuration File Management
Read and write configuration files:
#!/bin/bash
# ABOUTME: Configuration file management
# ABOUTME: Key-value pairs with defaults
CONFIG_FILE="$CONFIG_DIR/config"
# Default configuration
declare -A DEFAULT_CONFIG=(
["parallel_workers"]="5"
["log_level"]="INFO"
["auto_sync"]="true"
["timeout"]="30"
)
# Initialize config with defaults
init_config() {
if [[ ! -f "$CONFIG_FILE" ]]; then
{
echo "# Configuration for $APP_NAME"
echo "# Generated: $(date)"
echo ""
for key in "${!DEFAULT_CONFIG[@]}"; do
echo "${key}=${DEFAULT_CONFIG[$key]}"
done
} > "$CONFIG_FILE"
fi
}
# Read config value
get_config() {
local key="$1"
local default="${2:-${DEFAULT_CONFIG[$key]:-}}"
if [[ -f "$CONFIG_FILE" ]]; then
local value
value=$(grep "^${key}=" "$CONFIG_FILE" 2>/dev/null | cut -d'=' -f2-)
echo "${value:-$default}"
else
echo "$default"
fi
}
# Write config value
set_config() {
local key="$1"
local value="$2"
init_config
if grep -q "^${key}=" "$CONFIG_FILE" 2>/dev/null; then
# Update existing
sed -i "s|^${key}=.*|${key}=${value}|" "$CONFIG_FILE"
else
# Add new
echo "${key}=${value}" >> "$CONFIG_FILE"
fi
}
# Load all config into associative array
load_config() {
declare -gA CONFIG
# Start with defaults
for key in "${!DEFAULT_CONFIG[@]}"; do
CONFIG[$key]="${DEFAULT_CONFIG[$key]}"
done
# Override with file values
if [[ -f "$CONFIG_FILE" ]]; then
while IFS='=' read -r key value; do
[[ "$key" =~ ^#.*$ || -z "$key" ]] && continue
CONFIG[$key]="$value"
done < "$CONFIG_FILE"
fi
}
# Usage
init_config
load_config
echo "Parallel workers: ${CONFIG[parallel_workers]}"
set_config "parallel_workers" "10"
GitHub 저장소
연관 스킬
algorithmic-art
메타This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.
subagent-driven-development
개발This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.
executing-plans
디자인Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.
cost-optimization
기타This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.
