Automatically validates Cloudflare Workers runtime compatibility during development, preventing Node.js API usage and ensuring proper Workers patterns
View on GitHubhirefrank/hirefrank-marketplace
edge-stack
January 16, 2026
Select agents to install to:
npx add-skill https://github.com/hirefrank/hirefrank-marketplace/blob/main/plugins/edge-stack/skills/workers-runtime-validator/SKILL.md -a claude-code --skill workers-runtime-validatorInstallation paths:
.claude/skills/workers-runtime-validator/# Workers Runtime Validator SKILL
## Activation Patterns
This SKILL automatically activates when:
- New `.ts` or `.js` files are created in Workers projects
- Import statements are added or modified
- Code changes include potential runtime violations
- Before deployment commands are executed
- When `process.env`, `require()`, or Node.js APIs are detected
## Expertise Provided
### Runtime Compatibility Validation
- **Forbidden API Detection**: Identifies Node.js built-ins that don't exist in Workers
- **Environment Access**: Ensures proper `env` parameter usage vs `process.env`
- **Module System**: Validates ES modules usage (no `require()`)
- **Async Patterns**: Ensures all I/O operations are async
- **Package Compatibility**: Checks npm packages for Node.js dependencies
### Specific Checks Performed
#### ❌ Critical Violations (Will Break in Production)
```typescript
// These patterns trigger immediate alerts:
import fs from 'fs'; // Node.js API
import { Buffer } from 'buffer'; // Node.js API
const secret = process.env.API_KEY; // process doesn't exist
const data = require('./module'); // require() not supported
```
#### ✅ Correct Workers Patterns
```typescript
// These patterns are validated as correct:
import { z } from 'zod'; // Web-compatible package
const secret = env.API_KEY; // Proper env parameter
const hash = await crypto.subtle.digest(); // Web Crypto API
```
## Integration Points
### Complementary to Existing Components
- **workers-runtime-guardian agent**: Handles deep runtime analysis, SKILL provides immediate validation
- **es-deploy command**: SKILL prevents deployment failures by catching issues early
- **validate command**: SKILL provides continuous validation between explicit checks
### Escalation Triggers
- Complex runtime compatibility questions → `workers-runtime-guardian` agent
- Package dependency analysis → `edge-performance-oracle` agent
- Migration from Node.js to Wor