LQF_Machine_Learning_E…
LQF Machine Learning Expert Guide - Routed skill for ML/Statistical Modeling with Critical Discussion Mode. Triggers on: machine…
Intelligent file write error handler: diagnoses permissions, disk space, path length, file locks before retrying. Use when you encounter 'Error writing file', 'Permission denied', 'Access denied', 'No space left', or related file write failures.
Claude Code
$ npx -y skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer --agent claude-code
Codex
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a codex -y
Cursor
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a cursor -y
Gemini CLI
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a gemini-cli -y
GitHub Copilot
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a github-copilot -y
OpenCode
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a opencode -y
Windsurf
$ npx skills add foryourhealth111-pixel/Vibe-Skills --skill smart-file-writer -a windsurf -y
name: smart-file-writer description: "Intelligent file write error handler: diagnoses permissions, disk space, path length, file locks before retrying. Use when you encounter 'Error writing file', 'Permission denied', 'Access denied', 'No space left', or related file write failures."
Automatically diagnoses and resolves file write errors through systematic investigation rather than blind retries. Prevents common write failures proactively.
Use this skill when any of these occurs:
This skill does NOT:
Required inputs:
**1. Path Validation**
import os
# Check path length (Windows: 260 char limit)
if len(filepath) > 260 and os.name == 'nt':
print(f"Path too long: {len(filepath)} chars")
# Check parent directory exists
parent = os.path.dirname(filepath)
if not os.path.exists(parent):
print(f"Parent directory missing: {parent}")**2. Permission Check**
import os
# Check directory write permission
parent = os.path.dirname(filepath) or '.'
if not os.access(parent, os.W_OK):
print(f"No write permission: {parent}")
# Check file permissions if exists
if os.path.exists(filepath):
if not os.access(filepath, os.W_OK):
print(f"File not writable: {filepath}")**3. Disk Space Check**
import shutil
# Check available disk space
stat = shutil.disk_usage(os.path.dirname(filepath) or '.')
free_gb = stat.free / (1024**3)
if free_gb < 0.1: # Less than 100MB
print(f"Low disk space: {free_gb:.2f} GB free")**4. File Lock Detection**
import os
# Try to open with exclusive access
try:
with open(filepath, 'a') as f:
pass
except PermissionError:
print(f"File locked by another process: {filepath}")**5. Windows-Specific Checks**
# Check if file is in use (Windows) handle.exe -a "filepath" # Check file attributes attrib "filepath"
**Pattern 1: Create Missing Directories**
import os os.makedirs(os.path.dirname(filepath), exist_ok=True)
**Pattern 2: Atomic Write (Temp + Rename)**
import os
import tempfile
# Write to temp file first
temp_fd, temp_path = tempfile.mkstemp(dir=os.path.dirname(filepath))
try:
with os.fdopen(temp_fd, 'w') as f:
f.write(content)
# Atomic rename
os.replace(temp_path, filepath)
except Exception as e:
os.unlink(temp_path)
raise**Pattern 3: Exponential Backoff for Transient Issues**
import time
def write_with_retry(filepath, content, max_retries=3):
for attempt in range(max_retries):
try:
with open(filepath, 'w') as f:
f.write(content)
return True
except (PermissionError, OSError) as e:
if attempt < max_retries - 1:
wait = 2 ** attempt # 1s, 2s, 4s
time.sleep(wait)
else:
raise**Pattern 4: Alternative Path (Shorten Long Paths)**
import os
import hashlib
def shorten_path(long_path):
"""Use hash for long filenames"""
dir_path = os.path.dirname(long_path)
filename = os.path.basename(long_path)
if len(long_path) > 260:
# Hash the filename
name, ext = os.path.splitext(filename)
hash_name = hashlib.md5(name.encode()).hexdigest()[:16]
return os.path.join(dir_path, f"{hash_name}{ext}")
return long_path**Pattern 5: Permission Fix Suggestions**
# Linux/Mac: Add write permission chmod u+w filepath # Windows: Remove read-only attribute attrib -r filepath # Windows: Take ownership (admin required) takeown /f filepath icacls filepath /grant %username%:F
**Pattern 6: Detect Antivirus Interference**
import time
import os
def is_antivirus_blocking(filepath):
"""Detect if antivirus is scanning file"""
try:
# Try to open exclusively
with open(filepath, 'r+b') as f:
pass
return False
except PermissionError:
# Wait and retry
time.sleep(0.5)
try:
with open(filepath, 'r+b') as f:
pass
return True # Was temporarily blocked
except:
return False # Persistent block**Before Any Critical Write**
def validate_write_conditions(filepath):
"""Run before writing important files"""
issues = []
# 1. Path length
if len(filepath) > 260 and os.name == 'nt':
issues.append(f"Path too long: {len(filepath)} chars")
# 2. Parent directory
parent = os.path.dirname(filepath) or '.'
if not os.path.exists(parent):
issues.append(f"Parent missing: {parent}")
elif not os.access(parent, os.W_OK):
issues.append(f"No write permission: {parent}")
# 3. Disk space
stat = shutil.disk_usage(parent)
if stat.free < 100 * 1024 * 1024: # 100MB
issues.append(f"Low disk space: {stat.free / 1024**2:.1f} MB")
# 4. File exists and writable
if os.path.exists(filepath):
if not os.access(filepath, os.W_OK):
issues.append(f"File not writable: {filepath}")
return issues**Wrap Write
Intelligent Skill routing and workflow orchestration for AI agents — +21.12 pp reward, −29.6% tokens on SkillsBench with DeepSeekV4Flash-VE.
LQF Machine Learning Expert Guide - Routed skill for ML/Statistical Modeling with Critical Discussion Mode. Triggers on: machine…
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental…
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting,…
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request…
Access real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+…
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design.…
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…