state-directory-manager-4-state-file-operations
Über
Diese Fähigkeit bietet Zustandsdatei-Operationen zur Verfolgung persistenter Daten zwischen Skriptausführungen. Sie umfasst Funktionen zum Initialisieren, Lesen und Aktualisieren von JSON-Zustandsdateien zur Nachverfolgung von Ausführungsverlauf, Fortschritt und Status. Verwenden Sie diese Fähigkeit, wenn Sie Zustände über mehrere Ausführungen Ihrer Claude Code Skripte hinweg beibehalten müssen.
Schnellinstallation
Claude Code
Empfohlennpx 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-4-state-file-operationsKopieren Sie diesen Befehl und fügen Sie ihn in Claude Code ein, um diese Fähigkeit zu installieren
Dokumentation
4. State File Operations
4. State File Operations
Track persistent state between runs:
#!/bin/bash
# ABOUTME: State file operations
# ABOUTME: Track last run, progress, etc.
STATE_FILE="$STATE_DIR/state.json"
# Initialize state
init_state() {
if [[ ! -f "$STATE_FILE" ]]; then
cat > "$STATE_FILE" << EOF
{
"version": "1.0.0",
"created": "$(date -Iseconds)",
"last_run": null,
"run_count": 0,
"last_status": null
}
EOF
fi
}
# Get state value (requires jq)
get_state() {
local key="$1"
local default="${2:-null}"
if [[ -f "$STATE_FILE" ]] && command -v jq &>/dev/null; then
jq -r ".$key // $default" "$STATE_FILE"
else
echo "$default"
fi
}
# Update state value (requires jq)
set_state() {
local key="$1"
local value="$2"
init_state
if command -v jq &>/dev/null; then
local temp=$(mktemp)
jq ".$key = $value" "$STATE_FILE" > "$temp" && mv "$temp" "$STATE_FILE"
fi
}
# Record run
record_run() {
local status="$1"
set_state "last_run" "\"$(date -Iseconds)\""
set_state "last_status" "\"$status\""
set_state "run_count" "$(($(get_state run_count 0) + 1))"
}
# Simple key-value state (no jq required)
STATE_KV_FILE="$STATE_DIR/state.kv"
get_state_kv() {
local key="$1"
local default="$2"
if [[ -f "$STATE_KV_FILE" ]]; then
grep "^${key}=" "$STATE_KV_FILE" 2>/dev/null | cut -d'=' -f2- || echo "$default"
else
echo "$default"
fi
}
set_state_kv() {
local key="$1"
local value="$2"
mkdir -p "$(dirname "$STATE_KV_FILE")"
if [[ -f "$STATE_KV_FILE" ]] && grep -q "^${key}=" "$STATE_KV_FILE"; then
sed -i "s|^${key}=.*|${key}=${value}|" "$STATE_KV_FILE"
else
echo "${key}=${value}" >> "$STATE_KV_FILE"
fi
}
GitHub Repository
Verwandte Skills
algorithmic-art
MetaThis 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
EntwicklungThis 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
DesignUse 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
AndereThis 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.
