Skip to content

foryourhealth111-pixel/Vibe-Skills / bundled/skills/smart-file-writer

smart-file-writer

Flagged

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.

FileKindSize
QUALITY_CHECKLIST.mdmarkdown3.5 KB
README.mdmarkdown3.1 KB
SKILL.mdskill md10.3 KB
references/diagnostic-procedures.mdmarkdown6.9 KB
references/index.mdmarkdown1.7 KB
references/integration-guide.mdmarkdown13.9 KB
references/platform-specific.mdmarkdown8.0 KB
scripts/validate.pyscript5.3 KB
# smart-file-writer Skill

Intelligent file write error handler that diagnoses and resolves file write issues automatically.

## Quick Start

This skill **auto-activates** when file write errors occur. You don't need to call it manually - it will trigger automatically when Claude Code encounters:

- "Error writing file"
- "Permission denied"
- "Access denied"
- "No space left on device"
- "Path too long"
- Any file write operation failure

## What It Does

Instead of blindly retrying failed writes, smart-file-writer:

1. **Diagnoses** the root cause:
   - Permission issues
   - Disk space problems
   - Path length limits (Windows)
   - File locks
   - Missing directories
   - File system limitations

2. **Resolves** automatically when possible:
   - Creates missing parent directories
   - Suggests permission fixes
   - Proposes alternative paths
   - Uses atomic write operations
   - Implements exponential backoff

3. **Reports** clearly:
   - Root cause analysis
   - Attempted solutions
   - Success/failure status
   - Recommendations for permanent fixes

## Examples

### Example 1: Missing Directory

**Before:**
```
Error writing file: results/model_checkpoint.pth
```

**With smart-file-writer:**
```
Diagnosis: Parent directory 'results' does not exist
Resolution: Created directory 'results'
Retry: Write succeeded
```

### Example 2: Path Too Long (Windows)

**Before:**
```
Error: Path too long (285 characters)
```

**With smart-file-writer:**
```
Warning: Path length 285 chars exceeds Windows limit (260)
Alternative: D:\project\a3f5e8b2c1d4.csv
Mapping saved to: path_mappings.json
Write succeeded to alternative path
```

### Example 3: Read-Only File

**Before:**
```
PermissionError: [Errno 13] Permission denied: 'data.csv'
```

**With smart-file-writer:**
```
Diagnosis: File 'data.csv' has read-only attribute
Resolution: Run 'attrib -r data.csv' to remove read-only flag
[After confirmation] Attribute removed. Retry succeeded.
```

## Proactive Mode

You can also use smart-file-writer proactively to prevent errors before they happen:

```python
# Validate before critical write
issues = validate_write_conditions('important_file.txt')
if not issues:
    # Safe to proceed
    write_file()
```

## Documentation

- **SKILL.md**: Complete skill reference with all patterns
- **references/diagnostic-procedures.md**: Detailed diagnostic workflows
- **references/platform-specific.md**: Windows/Linux/Mac specific issues
- **references/integration-guide.md**: Integration with Claude Code tools

## Validation

Run the validation script to test the skill:

```bash
cd scripts
python validate.py
```

All tests should pass on your platform.

## Installation

This skill is already installed in your Claude Code skills directory:
```
C:\Users\羽裳\.claude\skills\smart-file-writer\
```

It will auto-activate when needed. No manual configuration required.

## Supported Platforms

- ✓ Windows (10/11)
- ✓ Linux (all distributions)
- ✓ macOS

Platform-specific features:
- Windows: Path length detection, file attribute handling
- Linux: Permission model, inode limits, SELinux
- macOS: Gatekeeper, SIP, extended attributes

## License

Part of Claude Code skills collection.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall