[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AQ6412TP8RSF2DH2NN9172":3,"skill-same:01M7AQ6412TP8RSF2DH2NN9172":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":5,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":27,"install":28,"resources":41},"01M7AQ6412TP8RSF2DH2NN9172","timeout-prevention",null,"Prevent request timeouts in Claude Code sessions by chunking long operations, implementing progress checkpoints, using background processes, and optimizing tool usage patterns. Use when performing bulk operations, processing large datasets, running long-running commands, downloading multiple files, or executing tasks that exceed 2-minute timeout limits. Implements strategies like task decomposition, incremental processing, parallel execution, checkpoint-resume patterns, and efficient resource management to ensure reliable completion of complex workflows.","davidanthonyn\u002Fclaude-skills","davidanthonyn","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F55152980?v=4","01M7AJ4MY8S5C2RJCGX6626J0G","01M7AJ7JE1K98GRPH9Z57Z0R0W",0,"MIT","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Ftimeout-prevention\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: timeout-prevention\ndescription: Prevent request timeouts in Claude Code sessions by chunking long operations, implementing progress checkpoints, using background processes, and optimizing tool usage patterns. Use when performing bulk operations, processing large datasets, running long-running commands, downloading multiple files, or executing tasks that exceed 2-minute timeout limits. Implements strategies like task decomposition, incremental processing, parallel execution, checkpoint-resume patterns, and efficient resource management to ensure reliable completion of complex workflows.\nlicense: MIT\n---\n\n# Timeout Prevention Skill\n\nExpert strategies for preventing request timeouts in Claude Code by breaking down long operations into manageable chunks with progress tracking and recovery mechanisms.\n\n## When to Use This Skill\n\nUse when:\n- Performing bulk operations (100+ files, repos, etc.)\n- Running long commands (>60 seconds)\n- Processing large datasets\n- Downloading multiple files sequentially\n- Executing complex multi-step workflows\n- Working with slow external APIs\n- Any operation that risks timing out\n\n## Understanding Timeout Limits\n\n### Claude Code Timeout Behavior\n- **Default Tool Timeout**: 120 seconds (2 minutes)\n- **Request Timeout**: Entire response cycle\n- **What Causes Timeouts**:\n  - Long-running bash commands\n  - Large file operations\n  - Sequential processing of many items\n  - Network operations without proper timeout settings\n  - Blocking operations without progress\n\n## Core Prevention Strategies\n\n### 1. Task Chunking\n\nBreak large operations into smaller batches:\n\n```bash\n# ❌ BAD: Process all 1000 files at once\nfor file in $(find . -name \"*.txt\"); do\n    process_file \"$file\"\ndone\n\n# ✅ GOOD: Process in batches of 10\nfind . -name \"*.txt\" | head -10 | while read file; do\n    process_file \"$file\"\ndone\n# Then process next 10, etc.\n```\n\n### 2. Progress Checkpoints\n\nSave progress to resume if interrupted:\n\n```bash\n# Create checkpoint file\nCHECKPOINT_FILE=\"progress.txt\"\n\n# Save completed items\necho \"completed_item_1\" >> \"$CHECKPOINT_FILE\"\n\n# Skip already completed items\nif grep -q \"completed_item_1\" \"$CHECKPOINT_FILE\"; then\n    echo \"Skipping already processed item\"\nfi\n```\n\n### 3. Background Processes\n\nRun long operations in background:\n\n```bash\n# Start long-running process in background\nlong_command > output.log 2>&1 &\necho $! > pid.txt\n\n# Check status later\nif ps -p $(cat pid.txt) > \u002Fdev\u002Fnull; then\n    echo \"Still running\"\nelse\n    echo \"Completed\"\n    cat output.log\nfi\n```\n\n### 4. Incremental Processing\n\nProcess and report incrementally:\n\n```bash\n# Process items one at a time with status updates\nTOTAL=100\nfor i in $(seq 1 10); do  # First 10 of 100\n    process_item $i\n    echo \"Progress: $i\u002F$TOTAL\"\ndone\n# Continue with next 10 in subsequent calls\n```\n\n### 5. Timeout Configuration\n\nSet explicit timeouts for commands:\n\n```bash\n# Use timeout command\ntimeout 60s long_command || echo \"Command timed out\"\n\n# Set timeout in tool calls\nyt-dlp --socket-timeout 30 \"URL\"\ngit clone --depth 1 --timeout 60 \"URL\"\n```\n\n## Practical Patterns\n\n### Pattern 1: Batch File Processing\n\n```bash\n# Define batch size\nBATCH_SIZE=10\nOFFSET=${1:-0}  # Accept offset as parameter\n\n# Process batch\nfind . -name \"*.jpg\" | tail -n +$((OFFSET + 1)) | head -$BATCH_SIZE | while read file; do\n    convert \"$file\" -resize 800x600 \"thumbnails\u002F$(basename $file)\"\n    echo \"Processed: $file\"\ndone\n\n# Report next offset\nNEXT_OFFSET=$((OFFSET + BATCH_SIZE))\necho \"Next batch: Run with offset $NEXT_OFFSET\"\n```\n\n**Usage**:\n```bash\n# First batch\n.\u002Fprocess.sh 0\n\n# Next batch\n.\u002Fprocess.sh 10\n\n# Continue...\n.\u002Fprocess.sh 20\n```\n\n### Pattern 2: Repository Cloning with Checkpoints\n\n```bash\n#!\u002Fbin\u002Fbash\nREPOS_FILE=\"repos.txt\"\nCHECKPOINT=\"downloaded.txt\"\n\n# Read repos, skip already downloaded\nwhile read repo; do\n    # Check if already downloaded\n    if grep -q \"$repo\" \"$CHECKPOINT\" 2>\u002Fdev\u002Fnull; then\n        echo \"✓ Skipping $repo (already downloaded)\"\n        continue\n    fi\n\n    # Clone with timeout\n    echo \"Downloading $repo...\"\n    if timeout 60s git clone --depth 1 \"$repo\" 2>\u002Fdev\u002Fnull; then\n        echo \"$repo\" >> \"$CHECKPOINT\"\n        echo \"✓ Downloaded $repo\"\n    else\n        echo \"✗ Failed: $repo\"\n    fi\ndone \u003C \u003C(head -5 \"$REPOS_FILE\")  # Only 5 at a time\n\necho \"Processed 5 repos. Check $CHECKPOINT for status.\"\n```\n\n### Pattern 3: Progress-Tracked Downloads\n\n```bash\n#!\u002Fbin\u002Fbash\nURLS_FILE=\"urls.txt\"\nPROGRESS_FILE=\"download_progress.json\"\n\n# Initialize progress\n[ ! -f \"$PROGRESS_FILE\" ] && echo '{\"completed\": 0, \"total\": 0}' > \"$PROGRESS_FILE\"\n\n# Get current progress\nCOMPLETED=$(jq -r '.completed' \"$PROGRESS_FILE\")\nTOTAL=$(wc -l \u003C \"$URLS_FILE\")\n\n# Download next batch (5 at a time)\nBATCH_SIZE=5\ntail -n +$((COMPLETED + 1)) \"$URLS_FILE\" | head -$BATCH_SIZE | while read url; do\n    echo \"Downloading: $url\"\n    if yt-dlp --socket-timeout 30 \"$url\"; then\n        COMPLETED=$((COMPLETED + 1))\n        echo \"{\\\"completed\\\": $COMPLETED, \\\"total\\\": $TOTAL}\" > \"$PROGRESS_FILE\"\n    fi\ndone\n\n# Report progress\nCOMPLETED=$(jq -r '.completed' \"$PROGRESS_FILE\")\necho \"Progress: $COMPLETED\u002F$TOTAL\"\n[ $COMPLETED -lt $TOTAL ] && echo \"Run again to continue.\"\n```\n\n### Pattern 4: Parallel Execution with Rate Limiting\n\n```bash\n#!\u002Fbin\u002Fbash\nMAX_PARALLEL=3\nCOUNT=0\n\nfor item in $(seq 1 15); do\n    # Start background job\n    (\n        process_item $item\n        echo \"Completed: $item\"\n    ) &\n\n    COUNT=$((COUNT + 1))\n\n    # Wait when reaching max parallel\n    if [ $COUNT -ge $MAX_PARALLEL ]; then\n        wait -n  # Wait for any job to finish\n        COUNT=$((COUNT - 1))\n    fi\n\n    # Rate limiting\n    sleep 0.5\ndone\n\n# Wait for remaining jobs\nwait\necho \"All items processed\"\n```\n\n### Pattern 5: Resumable State Machine\n\n```bash\n#!\u002Fbin\u002Fbash\nSTATE_FILE=\"workflow_state.txt\"\n\n# Read current state (default: START)\nSTATE=$(cat \"$STATE_FILE\" 2>\u002Fdev\u002Fnull || echo \"START\")\n\ncase $STATE in\n    START)\n        echo \"Phase 1: Initialization\"\n        initialize_project\n        echo \"PHASE1\" > \"$STATE_FILE\"\n        echo \"Run again to continue to Phase 2\"\n        ;;\n    PHASE1)\n        echo \"Phase 2: Processing (Batch 1 of 3)\"\n        process_batch_1\n        echo \"PHASE2\" > \"$STATE_FILE\"\n        echo \"Run again for Phase 3\"\n        ;;\n    PHASE2)\n        echo \"Phase 3: Processing (Batch 2 of 3)\"\n        process_batch_2\n        echo \"PHASE3\" > \"$STATE_FILE\"\n        echo \"Run again for Phase 4\"\n        ;;\n    PHASE3)\n        echo \"Phase 4: Processing (Batch 3 of 3)\"\n        process_batch_3\n        echo \"PHASE4\" > \"$STATE_FILE\"\n        echo \"Run again for finalization\"\n        ;;\n    PHASE4)\n        echo \"Phase 5: Finalization\"\n        finalize_project\n        echo \"COMPLETE\" > \"$STATE_FILE\"\n        echo \"Workflow complete!\"\n        ;;\n    COMPLETE)\n        echo \"Workflow already completed\"\n        ;;\nesac\n```\n\n## Command Optimization\n\n### Optimize Bash Commands\n\n```bash\n# ❌ SLOW: Multiple commands sequentially\ngit clone repo1\ngit clone repo2\ngit clone repo3\n\n# ✅ FAST: Parallel with wait\ngit clone repo1 &\ngit clone repo2 &\ngit clone repo3 &\nwait\n```\n\n### Optimize File Operations\n\n```bash\n# ❌ SLOW: Process one file at a time\nfor file in *.txt; do\n    cat \"$file\" | process > \"output\u002F$file\"\ndone\n\n# ✅ FAST: Parallel processing\nfor file in *.txt; do\n    cat \"$file\" | process > \"output\u002F$file\" &\ndone\nwait\n```\n\n### Optimize Network Calls\n\n```bash\n# ❌ SLOW: Sequential API calls\nfor id in {1..100}; do\n    curl \"https:\u002F\u002Fapi.example.com\u002Fitem\u002F$id\"\ndone\n\n# ✅ FAST: Batch API call\ncurl \"https:\u002F\u002Fapi.example.com\u002Fitems?ids=1,2,3,4,5\"\n```\n\n## Claude Code Integration\n\n### Strategy 1: Multi-Turn Workflow\n\nInstead of one long operation, break into multiple turns:\n\n**Turn 1**:\n```\nProcess first 10 repositories and report progress\n```\n\n**Turn 2**:\n```\nProcess next 10 repositories (11-20)\n```\n\n**Turn 3**:\n```\nProcess final batch and generate report\n```\n\n### Strategy 2: Status Check Pattern\n\n```bash\n# Turn 1: Start background process\n.\u002Flong_operation.sh > output.log 2>&1 &\necho $! > pid.txt\necho \"Started background process\"\n\n# Turn 2: Check status\nif ps -p $(cat pid.txt) > \u002Fdev\u002Fnull; then\n    echo \"Still running... Check again\"\n    tail -20 output.log\nelse\n    echo \"Completed!\"\n    cat output.log\nfi\n```\n\n### Strategy 3: Incremental Results\n\nReport partial results as you go:\n\n```bash\necho \"=== Batch 1 Results ===\"\nprocess_batch_1\necho \"\"\necho \"=== Batch 2 Results ===\"\nprocess_batch_2\n```\n\n## Error Handling\n\n### Graceful Degradation\n\n```bash\n# Try operation with timeout, fallback if fails\nif timeout 30s expensive_operation; then\n    echo \"Operation completed\"\nelse\n    echo \"Operation timed out, using cached result\"\n    cat cached_result.txt\nfi\n```\n\n### Retry Logic\n\n```bash\nMAX_RETRIES=3\nRETRY_COUNT=0\n\nwhile [ $RETRY_COUNT -lt $MAX_RETRIES ]; do\n    if timeout 60s risky_operation; then\n        echo \"Success!\"\n        break\n    else\n        RETRY_COUNT=$((RETRY_COUNT + 1))\n        echo \"Attempt $RETRY_COUNT failed, retrying...\"\n        sleep 5\n    fi\ndone\n```\n\n## Best Practices\n\n### ✅ DO\n\n1. **Chunk Large Operations**: Process 5-10 items at a time\n2. **Save Progress**: Use checkpoint files\n3. **Report Incrementally**: Show results as you go\n4. **Use Timeouts**: Set explicit timeout values\n5. **Parallelize Wisely**: 3-5 concurrent operations max\n6. **Enable Resume**: Make operations resumable\n7. **Monitor Progress**: Show completion percentage\n8. **Background Long Tasks**: Use `&` for async operations\n\n### ❌ DON'T\n\n1. **Don't Process Everything**: Batch large datasets\n2. **Don't Block Forever**: Always set timeouts\n3. **Don't Ignore State**: Save progress between runs\n4. **Don't Go Silent**: Report progress regularly\n5. **Don't Retry Infinitely**: Limit retry attempts\n6. **Don't Over-Parallelize**: Limit concurrent operations\n7. **Don't Assume Success**: Always check return codes\n8. **Don't Skip Cleanup**: Clean up temp files\n\n## Common Scenarios\n\n### Scenario 1: Downloading 100 YouTube Videos\n\n```bash\n# DON'T do this (will timeout)\nyt-dlp -a urls.txt  # 100 URLs\n\n# DO this instead\nhead -5 urls.txt | yt-dlp -a -\n# Then process next 5 in another turn\n```\n\n### Scenario 2: Cloning 50 Repositories\n\n```bash\n# DON'T\nfor repo in $(cat repos.txt); do\n    git clone $repo\ndone\n\n# DO\nhead -5 repos.txt | while read repo; do\n    timeout 60s git clone --depth 1 $repo\ndone\n# Continue with tail -n +6 in next turn\n```\n\n### Scenario 3: Processing 1000 Images\n\n```bash\n# DON'T\nfor img in *.jpg; do\n    convert $img processed\u002F$img\ndone\n\n# DO\nfind . -name \"*.jpg\" | head -20 | xargs -P 4 -I {} convert {} processed\u002F{}\n# Process next 20 in subsequent turn\n```\n\n## Monitoring and Debugging\n\n### Track Execution Time\n\n```bash\nstart_time=$(date +%s)\n# ... operations ...\nend_time=$(date +%s)\nduration=$((end_time - start_time))\necho \"Duration: ${duration}s\"\n```\n\n### Log Everything\n\n```bash\nLOG_FILE=\"operation.log\"\n{\n    echo \"Started at $(date)\"\n    perform_operations\n    echo \"Completed at $(date)\"\n} | tee -a \"$LOG_FILE\"\n```\n\n### Progress Indicators\n\n```bash\nTOTAL=100\nfor i in $(seq 1 10); do\n    process_item $i\n    echo -ne \"Progress: $i\u002F$TOTAL\\r\"\ndone\necho \"\"\n```\n\n## Recovery Strategies\n\n### Checkpoint-Based Recovery\n\n```bash\n# Check last successful checkpoint\nLAST_CHECKPOINT=$(cat .checkpoint 2>\u002Fdev\u002Fnull || echo 0)\necho \"Resuming from item $LAST_CHECKPOINT\"\n\n# Continue from checkpoint\nfor i in $(seq $((LAST_CHECKPOINT + 1)) $((LAST_CHECKPOINT + 10))); do\n    process_item $i && echo $i > .checkpoint\ndone\n```\n\n### Transaction-Like Operations\n\n```bash\n# Create temporary workspace\nTEMP_DIR=$(mktemp -d)\ntrap \"rm -rf $TEMP_DIR\" EXIT\n\n# Work in temp, only commit on success\ncd $TEMP_DIR\nperform_operations\nif [ $? -eq 0 ]; then\n    mv $TEMP_DIR\u002Fresults ~\u002Ffinal\u002F\nfi\n```\n\n---\n\n**Version**: 1.0.0\n**Last Updated**: 2025-11-07\n**Key Principle**: Break long operations into manageable chunks with progress tracking and resumability\n","# Timeout Prevention Skill\n\nExpert strategies for preventing request timeouts in Claude Code by breaking down long operations into manageable chunks with progress tracking and recovery mechanisms.\n\n## When to Use This Skill\n\nUse when:\n- Performing bulk operations (100+ files, repos, etc.)\n- Running long commands (>60 seconds)\n- Processing large datasets\n- Downloading multiple files sequentially\n- Executing complex multi-step workflows\n- Working with slow external APIs\n- Any operation that risks timing out\n\n## Understanding Timeout Limits\n\n### Claude Code Timeout Behavior\n- **Default Tool Timeout**: 120 seconds (2 minutes)\n- **Request Timeout**: Entire response cycle\n- **What Causes Timeouts**:\n  - Long-running bash commands\n  - Large file operations\n  - Sequential processing of many items\n  - Network operations without proper timeout settings\n  - Blocking operations without progress\n\n## Core Prevention Strategies\n\n### 1. Task Chunking\n\nBreak large operations into smaller batches:\n\n```bash\n# ❌ BAD: Process all 1000 files at once\nfor file in $(find . -name \"*.txt\"); do\n    process_file \"$file\"\ndone\n\n# ✅ GOOD: Process in batches of 10\nfind . -name \"*.txt\" | head -10 | while read file; do\n    process_file \"$file\"\ndone\n# Then process next 10, etc.\n```\n\n### 2. Progress Checkpoints\n\nSave progress to resume if interrupted:\n\n```bash\n# Create checkpoint file\nCHECKPOINT_FILE=\"progress.txt\"\n\n# Save completed items\necho \"completed_item_1\" >> \"$CHECKPOINT_FILE\"\n\n# Skip already completed items\nif grep -q \"completed_item_1\" \"$CHECKPOINT_FILE\"; then\n    echo \"Skipping already processed item\"\nfi\n```\n\n### 3. Background Processes\n\nRun long operations in background:\n\n```bash\n# Start long-running process in background\nlong_command > output.log 2>&1 &\necho $! > pid.txt\n\n# Check status later\nif ps -p $(cat pid.txt) > \u002Fdev\u002Fnull; then\n    echo \"Still running\"\nelse\n    echo \"Completed\"\n    cat output.log\nfi\n```\n\n### 4. Incremental Processing\n\nProcess and report incrementally:\n\n```bash\n# Process items one at a time with status updates\nTOTAL=100\nfor i in $(seq 1 10); do  # First 10 of 100\n    process_item $i\n    echo \"Progress: $i\u002F$TOTAL\"\ndone\n# Continue with next 10 in subsequent calls\n```\n\n### 5. Timeout Configuration\n\nSet explicit timeouts for commands:\n\n```bash\n# Use timeout command\ntimeout 60s long_command || echo \"Command timed out\"\n\n# Set timeout in tool calls\nyt-dlp --socket-timeout 30 \"URL\"\ngit clone --depth 1 --timeout 60 \"URL\"\n```\n\n## Practical Patterns\n\n### Pattern 1: Batch File Processing\n\n```bash\n# Define batch size\nBATCH_SIZE=10\nOFFSET=${1:-0}  # Accept offset as parameter\n\n# Process batch\nfind . -name \"*.jpg\" | tail -n +$((OFFSET + 1)) | head -$BATCH_SIZE | while read file; do\n    convert \"$file\" -resize 800x600 \"thumbnails\u002F$(basename $file)\"\n    echo \"Processed: $file\"\ndone\n\n# Report next offset\nNEXT_OFFSET=$((OFFSET + BATCH_SIZE))\necho \"Next batch: Run with offset $NEXT_OFFSET\"\n```\n\n**Usage**:\n```bash\n# First batch\n.\u002Fprocess.sh 0\n\n# Next batch\n.\u002Fprocess.sh 10\n\n# Continue...\n.\u002Fprocess.sh 20\n```\n\n### Pattern 2: Repository Cloning with Checkpoints\n\n```bash\n#!\u002Fbin\u002Fbash\nREPOS_FILE=\"repos.txt\"\nCHECKPOINT=\"downloaded.txt\"\n\n# Read repos, skip already downloaded\nwhile read repo; do\n    # Check if already downloaded\n    if grep -q \"$repo\" \"$CHECKPOINT\" 2>\u002Fdev\u002Fnull; then\n        echo \"✓ Skipping $repo (already downloaded)\"\n        continue\n    fi\n\n    # Clone with timeout\n    echo \"Downloading $repo...\"\n    if timeout 60s git clone --depth 1 \"$repo\" 2>\u002Fdev\u002Fnull; then\n        echo \"$repo\" >> \"$CHECKPOINT\"\n        echo \"✓ Downloaded $repo\"\n    else\n        echo \"✗ Failed: $repo\"\n    fi\ndone \u003C \u003C(head -5 \"$REPOS_FILE\")  # Only 5 at a time\n\necho \"Processed 5 repos. Check $CHECKPOINT for status.\"\n```\n\n### Pattern 3: Progress-Tracked Downloads\n\n```bash\n#!\u002Fbin\u002Fbash\nURLS_FILE=\"urls.txt\"\nPROGRESS_FILE=\"download_progress.json\"\n\n# Initialize progress\n[ ! -f \"$PROGRESS_FILE\" ] && echo '{\"completed\": 0, \"total\": 0}' > \"$PROGRESS_FILE\"\n\n# Get current progress\nCOMPLETED=$(jq -r '.completed' \"$PROGRESS_FILE\")\nTOTAL=$(wc -l \u003C \"$URLS_FILE\")\n\n# Download next batch (5 at a time)\nBATCH_SIZE=5\ntail -n +$((COMPLETED + 1)) \"$URLS_FILE\" | head -$BATCH_SIZE | while read url; do\n    echo \"Downloading: $url\"\n    if yt-dlp --socket-timeout 30 \"$url\"; then\n        COMPLETED=$((COMPLETED + 1))\n        echo \"{\\\"completed\\\": $COMPLETED, \\\"total\\\": $TOTAL}\" > \"$PROGRESS_FILE\"\n    fi\ndone\n\n# Report progress\nCOMPLETED=$(jq -r '.completed' \"$PROGRESS_FILE\")\necho \"Progress: $COMPLETED\u002F$TOTAL\"\n[ $COMPLETED -lt $TOTAL ] && echo \"Run again to continue.\"\n```\n\n### Pattern 4: Parallel Execution with Rate Limiting\n\n```bash\n#!\u002Fbin\u002Fbash\nMAX_PARALLEL=3\nCOUNT=0\n\nfor item in $(seq 1 15); do\n    # Start background job\n    (\n        process_item $item\n        echo \"Completed: $item\"\n    ) &\n\n    COUNT=$((COUNT + 1))\n\n    # Wait when reaching max parallel\n    if [ $COUNT -ge $MAX_PARALLEL ]; then\n        wait -n  # Wait for any job to finish\n        COUNT=$((COUNT - 1))\n    fi\n\n    # Rate limiting\n    sleep 0.5\ndone\n\n# Wait for remaining jobs\nwait\necho \"All items processed\"\n```\n\n### Pattern 5: Resumable State Machine\n\n```bash\n#!\u002Fbin\u002Fbash\nSTATE_FILE=\"workflow_state.txt\"\n\n# Read current state (default: START)\nSTATE=$(cat \"$STATE_FILE\" 2>\u002Fdev\u002Fnull || echo \"START\")\n\ncase $STATE in\n    START)\n        echo \"Phase 1: Initialization\"\n        initialize_project\n        echo \"PHASE1\" > \"$STATE_FILE\"\n        echo \"Run again to continue to Phase 2\"\n        ;;\n    PHASE1)\n        echo \"Phase 2: Processing (Batch 1 of 3)\"\n        process_batch_1\n        echo \"PHASE2\" > \"$STATE_FILE\"\n        echo \"Run again for Phase 3\"\n        ;;\n    PHASE2)\n        echo \"Phase 3: Processing (Batch 2 of 3)\"\n        process_batch_2\n        echo \"PHASE3\" > \"$STATE_FILE\"\n        echo \"Run again for Phase 4\"\n        ;;\n    PHASE3)\n        echo \"Phase 4: Processing (Batch 3 of 3)\"\n        process_batch_3\n        echo \"PHASE4\" > \"$STATE_FILE\"\n        echo \"Run again for finalization\"\n        ;;\n    PHASE4)\n        echo \"Phase 5: Finalization\"\n        finalize_project\n        echo \"COMPLETE\" > \"$STATE_FILE\"\n        echo \"Workflow complete!\"\n        ;;\n    COMPLETE)\n        echo \"Workflow already completed\"\n        ;;\nesac\n```\n\n## Command Optimization\n\n### Optimize Bash Commands\n\n```bash\n# ❌ SLOW: Multiple commands sequentially\ngit clone repo1\ngit clone repo2\ngit clone repo3\n\n# ✅ FAST: Parallel with wait\ngit clone repo1 &\ngit clone repo2 &\ngit clone repo3 &\nwait\n```\n\n### Optimize File Operations\n\n```bash\n# ❌ SLOW: Process one file at a time\nfor file in *.txt; do\n    cat \"$file\" | process > \"output\u002F$file\"\ndone\n\n# ✅ FAST: Parallel processing\nfor file in *.txt; do\n    cat \"$file\" | process > \"output\u002F$file\" &\ndone\nwait\n```\n\n### Optimize Network Calls\n\n```bash\n# ❌ SLOW: Sequential API calls\nfor id in {1..100}; do\n    curl \"https:\u002F\u002Fapi.example.com\u002Fitem\u002F$id\"\ndone\n\n# ✅ FAST: Batch API call\ncurl \"https:\u002F\u002Fapi.example.com\u002Fitems?ids=1,2,3,4,5\"\n```\n\n## Claude Code Integration\n\n### Strategy 1: Multi-Turn Workflow\n\nInstead of one long operation, break into multiple turns:\n\n**Turn 1**:\n```\nProcess first 10 repositories and report progress\n```\n\n**Turn 2**:\n```\nProcess next 10 repositories (11-20)\n```\n\n**Turn 3**:\n```\nProcess final batch and generate report\n```\n\n### Strategy 2: Status Check Pattern\n\n```bash\n# Turn 1: Start background process\n.\u002Flong_operation.sh > output.log 2>&1 &\necho $! > pid.txt\necho \"Started background process\"\n\n# Turn 2: Check status\nif ps -p $(cat pid.txt) > \u002Fdev\u002Fnull; then\n    echo \"Still running... Check again\"\n    tail -20 output.log\nelse\n    echo \"Completed!\"\n    cat output.log\nfi\n```\n\n### Strategy 3: Incremental Results\n\nReport partial results as you go:\n\n```bash\necho \"=== Batch 1 Results ===\"\nprocess_batch_1\necho \"\"\necho \"=== Batch 2 Results ===\"\nprocess_batch_2\n```\n\n## Error Handling\n\n### Graceful Degradation\n\n```bash\n# Try operation with timeout, fallback if fails\nif timeout 30s expensive_operation; then\n    echo \"Operation completed\"\nelse\n    echo \"Operation timed out, using cached result\"\n    cat cached_result.txt\nfi\n```\n\n### Retry Logic\n\n```bash\nMAX_RETRIES=3\nRETRY_COUNT=0\n\nwhile [ $RETRY_COUNT -lt $MAX_RETRIES ]; do\n    if timeout 60s risky_operation; then\n        echo \"Success!\"\n        break\n    else\n        RETRY_COUNT=$((RETRY_COUNT + 1))\n        echo \"Attempt $RETRY_COUNT failed, retrying...\"\n        sleep 5\n    fi\ndone\n```\n\n## Best Practices\n\n### ✅ DO\n\n1. **Chunk Large Operations**: Process 5-10 items at a time\n2. **Save Progress**: Use checkpoint files\n3. **Report Incrementally**: Show results as you go\n4. **Use Timeouts**: Set explicit timeout values\n5. **Parallelize Wisely**: 3-5 concurrent operations max\n6. **Enable Resume**: Make operations resumable\n7. **Monitor Progress**: Show completion percentage\n8. **Background Long Tasks**: Use `&` for async operations\n\n### ❌ DON'T\n\n1. **Don't Process Everything**: Batch large datasets\n2. **Don't Block Forever**: Always set timeouts\n3. **Don't Ignore State**: Save progress between runs\n4. **Don't Go Silent**: Report progress regularly\n5. **Don't Retry Infinitely**: Limit retry attempts\n6. **Don't Over-Parallelize**: Limit concurrent operations\n7. **Don't Assume Success**: Always check return codes\n8. **Don't Skip Cleanup**: Clean up temp files\n\n## Common Scenarios\n\n### Scenario 1: Downloading 100 YouTube Videos\n\n```bash\n# DON'T do this (will timeout)\nyt-dlp -a urls.txt  # 100 URLs\n\n# DO this instead\nhead -5 urls.txt | yt-dlp -a -\n# Then process next 5 in another turn\n```\n\n### Scenario 2: Cloning 50 Repositories\n\n```bash\n# DON'T\nfor repo in $(cat repos.txt); do\n    git clone $repo\ndone\n\n# DO\nhead -5 repos.txt | while read repo; do\n    timeout 60s git clone --depth 1 $repo\ndone\n# Continue with tail -n +6 in next turn\n```\n\n### Scenario 3: Processing 1000 Images\n\n```bash\n# DON'T\nfor img in *.jpg; do\n    convert $img processed\u002F$img\ndone\n\n# DO\nfind . -name \"*.jpg\" | head -20 | xargs -P 4 -I {} convert {} processed\u002F{}\n# Process next 20 in subsequent turn\n```\n\n## Monitoring and Debugging\n\n### Track Execution Time\n\n```bash\nstart_time=$(date +%s)\n# ... operations ...\nend_time=$(date +%s)\nduration=$((end_time - start_time))\necho \"Duration: ${duration}s\"\n```\n\n### Log Everything\n\n```bash\nLOG_FILE=\"operation.log\"\n{\n    echo \"Started at $(date)\"\n    perform_operations\n    echo \"Completed at $(date)\"\n} | tee -a \"$LOG_FILE\"\n```\n\n### Progress Indicators\n\n```bash\nTOTAL=100\nfor i in $(seq 1 10); do\n    process_item $i\n    echo -ne \"Progress: $i\u002F$TOTAL\\r\"\ndone\necho \"\"\n```\n\n## Recovery Strategies\n\n### Checkpoint-Based Recovery\n\n```bash\n# Check last successful checkpoint\nLAST_CHECKPOINT=$(cat .checkpoint 2>\u002Fdev\u002Fnull || echo 0)\necho \"Resuming from item $LAST_CHECKPOINT\"\n\n# Continue from checkpoint\nfor i in $(seq $((LAST_CHECKPOINT + 1)) $((LAST_CHECKPOINT + 10))); do\n    process_item $i && echo $i > .checkpoint\ndone\n```\n\n### Transaction-Like Operations\n\n```bash\n# Create temporary workspace\nTEMP_DIR=$(mktemp -d)\ntrap \"rm -rf $TEMP_DIR\" EXIT\n\n# Work in temp, only commit on success\ncd $TEMP_DIR\nperform_operations\nif [ $? -eq 0 ]; then\n    mv $TEMP_DIR\u002Fresults ~\u002Ffinal\u002F\nfi\n```\n\n---\n\n**Version**: 1.0.0\n**Last Updated**: 2025-11-07\n**Key Principle**: Break long operations into manageable chunks with progress tracking and resumability\n",{"name":5,"license":14,"description":7},"main","45d5ac830c3e238eeba6d0b4e6fd7cf6b56bf380","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn","2026-09-09 16:05:56",{"source":8,"skillName":5,"commands":29,"prompt":39,"zipAvailable":40},[30,33,36],{"tool":31,"command":32},"npx","npx skills add davidanthonyn\u002Fclaude-skills --skill timeout-prevention",{"tool":34,"command":35},"bunx","bunx skills add davidanthonyn\u002Fclaude-skills --skill timeout-prevention",{"tool":37,"command":38},"pnpm","pnpm dlx skills add davidanthonyn\u002Fclaude-skills --skill timeout-prevention","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Ftimeout-prevention\u002FSKILL.md",true,[42,48],{"path":43,"resourceType":44,"resourceTypeDesc":45,"sizeBytes":46,"sourceHtmlUrl":47},"SKILL.json","REFERENCE","参考文档",12273,"https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Ftimeout-prevention\u002FSKILL.json",{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"SKILL.md.backup","OTHER","其他",11922,"https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Ftimeout-prevention\u002FSKILL.md.backup",[55,62,70,77,84,93],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M7AQPHJF528A4MD52YZEZV3R","zustand-state-management","Production-tested setup for Zustand state management in React applications with TypeScript.\nThis skill provides comprehensive patterns for building scalable, type-safe global state.\n\nUse when: setting up global state in React, migrating from Redux or Context API, implementing\nstate persistence with localStorage, configuring TypeScript with Zustand, using slices pattern\nfor modular stores, adding devtools middleware for debugging, handling Next.js SSR hydration,\nor encountering hydration errors, TypeScript inference issues, or persist middleware problems.\n\nPrevents 5 documented issues: Next.js hydration mismatches, TypeScript double parentheses\nsyntax errors, persist middleware export errors, infinite render loops, and slices pattern\ntype inference failures.\n\nKeywords: zustand, state management, React state, TypeScript state, persist middleware,\ndevtools, slices pattern, global state, React hooks, create store, useBoundStore,\nStateCreator, hydration error, text content mismatch, infinite render, localStorage,\nsessionStorage, immer middleware, shallow equality, selector pattern, zustand v5","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fzustand-state-management\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":66,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M7AQP2XJRPNYEH323GJ81NN5","zetic-mlange","Help users integrate the ZETIC Melange (MLange) on-device AI SDK into Android (Kotlin\u002FJava) and iOS (Swift) mobile apps. Use this skill whenever the user mentions Zetic, MLange, Melange, ZeticMLangeModel, ZeticMLangeLLMModel, ZeticMLangeHFModel, on-device NPU inference for mobile, or deploying ML models to Android\u002FiOS with NPU acceleration. Also trigger when users ask about running LLMs on-device with GGUF quantization, mobile NPU model deployment, or converting PyTorch\u002FONNX models for mobile inference. Covers general model inference, LLM inference (streaming token generation), and HuggingFace model loading.","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fzetic-mlange\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fzetic-mlange\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M7AQNEJHD27NNF5PYQDSW8B9","youtube-downloader","Download videos, audio, playlists, and channels from YouTube and 1000+ websites using yt-dlp. Supports quality selection, format conversion, subtitle download, playlist filtering, metadata extraction, thumbnail download, and batch operations. Use when downloading YouTube videos in any quality (4K, 8K, HDR), extracting audio as MP3\u002FM4A\u002FFLAC, downloading entire playlists\u002Fchannels, getting subtitles in multiple languages, converting to specific formats, downloading live streams, archiving content, or batch processing multiple URLs. Optimized for reliability with automatic retries, rate limiting, and error handling.","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fyoutube-downloader\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M7AQJQSD2H04EE2EPNAQ8A3M","wordpress-plugin-core","This skill provides comprehensive knowledge for WordPress plugin development, covering core patterns, security best practices, database interactions, hooks\u002Ffilters, Settings API, custom post types, REST API, and AJAX. This skill should be used when creating WordPress plugins, troubleshooting security issues, implementing custom post types\u002Ftaxonomies, building admin interfaces, or working with the WordPress database.\n\nUse when: Creating new WordPress plugins, implementing nonces\u002Fsanitization\u002Fescaping, working with $wpdb and prepared statements, building Settings API pages, registering custom post types or taxonomies, implementing REST API endpoints, handling AJAX requests, debugging plugin activation\u002Fdeactivation issues, preventing SQL injection\u002FXSS\u002FCSRF vulnerabilities.\n\nKeywords: wordpress plugin development, wordpress security, wordpress hooks, wordpress filters, wordpress database, wpdb prepare, sanitize_text_field, esc_html, wp_nonce, custom post type, register_post_type, settings api, rest api, admin-ajax, wordpress sql injection, wordpress xss, wordpress csrf, plugin header, activation hook, deactivation hook, wordpress coding standards, wordpress plugin architecture","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fwordpress-plugin-core\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":18},"01M7AQJ91T970QCFMN9R1EHZXV","webapp-testing","Test local web applications with Playwright. Use when asked to verify frontend functionality, debug UI behavior, capture browser screenshots, or inspect browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":18},"01M7AQJ5E89MS8C5K3GZTY4B48","web-performance-audit","Audit web performance using Chrome DevTools MCP. Use when asked to audit, profile, debug, or optimize page load performance, Lighthouse scores, or site speed.","https:\u002F\u002Fgithub.com\u002Fdavidanthonyn\u002Fclaude-skills\u002Fblob\u002Fmain\u002Fweb-performance-audit\u002FSKILL.md",[],[]]