Cloudflare Worker Version Monitoring Skill
Purpose
Monitor changes to the Cloudflare worker (cloudflare/files/cloudflare-worker.js) and ensure the WORKER_VERSION constant is incremented using semantic versioning for ALL changes.
When to Use This Skill
This skill should be invoked automatically when:
- •Any edit is made to
cloudflare/files/cloudflare-worker.js - •A pull request includes changes to the worker file
- •Before deploying the worker to production
Version Management Rules
Semantic Versioning Format
The WORKER_VERSION constant must follow semantic versioning: MAJOR.MINOR.PATCH
export const WORKER_VERSION = '1.0.0';
When to Increment
MAJOR version (x.0.0):
- •Breaking changes to the worker API
- •Removal of existing features
- •Changes that require client updates
- •Major architectural changes
MINOR version (1.x.0):
- •New features added (backward-compatible)
- •New response headers
- •New metadata handling
- •Enhanced functionality
PATCH version (1.0.x):
- •Bug fixes
- •Documentation updates in code comments
- •Performance improvements
- •Code refactoring (no behavior changes)
Validation Process
Step 1: Detect Changes
Check if cloudflare/files/cloudflare-worker.js has been modified:
git diff HEAD cloudflare/files/cloudflare-worker.js
Step 2: Extract Current Version
grep "WORKER_VERSION = " cloudflare/files/cloudflare-worker.js
Expected format:
export const WORKER_VERSION = '1.0.0';
Step 3: Compare with Git History
git log -1 --all -S "WORKER_VERSION = " -- cloudflare/files/cloudflare-worker.js
Check if version was incremented in the current changes.
Step 4: Validate Tests
Ensure version tests pass:
cd cloudflare/files && npm test
Tests verify:
- •
WORKER_VERSIONconstant exists - •Version follows semantic versioning pattern (
\d+\.\d+\.\d+) - •
cfwheader is present in responses - •Header value matches
WORKER_VERSION
Error Scenarios
Version Not Incremented
Detection: Current commit modifies worker but version constant unchanged.
Action:
- •Alert the user
- •Ask which type of change (MAJOR, MINOR, PATCH)
- •Suggest appropriate version number
- •Offer to update the version
Example message:
⚠️ Worker Version Not Incremented The file cloudflare/files/cloudflare-worker.js has been modified, but WORKER_VERSION is still 1.0.0. What type of change is this? 1. MAJOR (2.0.0) - Breaking change or major feature 2. MINOR (1.1.0) - New feature, backward-compatible 3. PATCH (1.0.1) - Bug fix or refactor Please update WORKER_VERSION in cloudflare/files/cloudflare-worker.js
Invalid Version Format
Detection: Version doesn't match semantic versioning pattern.
Action:
- •Alert the user
- •Show current invalid version
- •Suggest correct format
Example:
❌ Invalid Version Format Current: WORKER_VERSION = 'v1.0' Expected: WORKER_VERSION = '1.0.0' Version must follow semantic versioning: MAJOR.MINOR.PATCH
Version Decremented
Detection: New version number is lower than previous.
Action:
- •Alert the user
- •Show previous and current versions
- •Ask for confirmation or correction
Integration Points
With Pre-Tool-Use Hook
The pre-tool-use-version-check.sh hook calls this skill automatically before Edit, MultiEdit, or Write operations on the worker file.
With Slash Command
The /increment-cfw-version command provides interactive version increment workflow.
With Testing
Version tests run automatically via npm test to validate:
- •Version constant format
- •Version header presence
- •Header value correctness
Example Workflow
Scenario: Adding a new feature
- •Developer modifies
cloudflare-worker.jsto add JSON-LD caching - •Pre-tool-use hook detects worker modification
- •Hook invokes this skill
- •Skill checks if version was incremented
- •If not, skill prompts:
code
New feature detected. Increment version? Current: 1.0.0 Suggested: 1.1.0 (MINOR - new feature)
- •Developer confirms
- •Skill updates
WORKER_VERSION = '1.1.0' - •Tests run automatically
- •All tests pass ✅
Scenario: Fixing a bug
- •Developer fixes date parsing bug
- •Pre-tool-use hook invokes skill
- •Skill suggests PATCH increment:
1.0.0→1.0.1 - •Developer confirms
- •Version updated and tests pass
Manual Check Command
Check version status manually:
# Check current version grep "WORKER_VERSION" cloudflare/files/cloudflare-worker.js # Check if version changed in current commit git diff HEAD -- cloudflare/files/cloudflare-worker.js | grep WORKER_VERSION # Run version tests cd cloudflare/files && npm test | grep "Worker Version"
Deployment Checklist
Before deploying to Cloudflare:
- •
WORKER_VERSIONincremented appropriately - • Version follows semantic versioning format
- • All tests passing (45 tests)
- • Documentation updated (README.md, cloudflare.md)
- • CHANGELOG.md entry added
- • Git commit includes version change
Reference
- •Worker file:
cloudflare/files/cloudflare-worker.js - •Test file:
cloudflare/files/cloudflare-worker.test.js - •Documentation:
cloudflare/files/README.md(lines 16-37) - •Implementation guide:
cloudflare/cloudflare.md(lines 159-163)
Technical Implementation
This skill should be implemented as a TypeScript module that:
- •Monitors file changes via git hooks
- •Parses
WORKER_VERSIONconstant from worker file - •Compares with previous version from git history
- •Validates semantic versioning rules
- •Prompts user for version increment if needed
- •Updates version constant when confirmed
- •Runs tests to validate changes
Success Criteria
- •All worker modifications include appropriate version increments
- •Version numbers always follow semantic versioning
- •Tests validate version presence and format
- •Documentation stays current with version changes
- •Deployment tracking via
cfwheader works reliably