Run Cloudflare Workers validation checks before committing code
Run comprehensive validation checks on Cloudflare Workers projects before committing code. Validates documentation, configuration, TypeScript, builds, linting, and bundle size to ensure zero errors and ≤5 warnings.
/plugin marketplace add hirefrank/hirefrank-marketplace/plugin install edge-stack@hirefrank-marketplaceRun comprehensive validation checks for Cloudflare Workers projects:
Cloudflare Workers SKILLs:
Frontend Design SKILLs (if shadcn/ui components detected):
Run this command before committing code:
/validate
git commitThe validation will:
pnpm build if build script exists (fails on any build errors)pnpm typecheck if typecheck script exists (fails on any TypeScript errors)pnpm lint if lint script exists (counts warnings toward threshold)Integration Note: SKILLs provide continuous validation during development, catching issues early. The /validate command provides explicit validation and summarizes any SKILL findings alongside traditional build/lint checks.
This helps catch issues early and ensures code quality before committing to repository.
The plugin must maintain these documentation files:
1. Count actual files:
# Count commands
COMMAND_COUNT=$(find commands -name "es-*.md" | wc -l)
NON_ES_COMMANDS=$(find commands -name "*.md" ! -name "es-*.md" | wc -l)
TOTAL_COMMANDS=$((COMMAND_COUNT + NON_ES_COMMANDS))
# Count agents
AGENT_COUNT=$(find agents -name "*.md" | wc -l)
# Count SKILLs
SKILL_COUNT=$(find skills -name "SKILL.md" | wc -l)
echo "📊 Actual counts:"
echo " Commands: $TOTAL_COMMANDS ($COMMAND_COUNT /es-* + $NON_ES_COMMANDS other)"
echo " Agents: $AGENT_COUNT"
echo " SKILLs: $SKILL_COUNT"
2. Check README.md accuracy:
# Extract counts from README
README_COMMANDS=$(grep -oP '\d+(?= workflow commands)' README.md || echo "NOT_FOUND")
README_AGENTS=$(grep -oP '\d+(?= specialized agents)' README.md || echo "NOT_FOUND")
README_SKILLS=$(grep -oP '\d+(?= autonomous SKILLs)' README.md || echo "NOT_FOUND")
echo ""
echo "📄 README.md claims:"
echo " Commands: $README_COMMANDS"
echo " Agents: $README_AGENTS"
echo " SKILLs: $README_SKILLS"
# Compare
DOCS_VALID=true
if [ "$README_COMMANDS" != "$TOTAL_COMMANDS" ]; then
echo "❌ ERROR: README.md lists $README_COMMANDS commands, but found $TOTAL_COMMANDS"
DOCS_VALID=false
fi
if [ "$README_AGENTS" != "$AGENT_COUNT" ]; then
echo "❌ ERROR: README.md lists $README_AGENTS agents, but found $AGENT_COUNT"
DOCS_VALID=false
fi
if [ "$README_SKILLS" != "$SKILL_COUNT" ]; then
echo "❌ ERROR: README.md lists $README_SKILLS SKILLs, but found $SKILL_COUNT"
DOCS_VALID=false
fi
if [ "$DOCS_VALID" = false ]; then
echo ""
echo "❌ Documentation validation FAILED"
echo " Fix: Update README.md with correct counts before committing"
exit 1
fi
3. Verify all commands are documented:
# List all commands
COMMANDS_LIST=$(find commands -name "*.md" -exec basename {} .md \; | sort)
# Check if README mentions each command
UNDOCUMENTED_COMMANDS=""
for cmd in $COMMANDS_LIST; do
if ! grep -q "/$cmd" README.md 2>/dev/null; then
UNDOCUMENTED_COMMANDS="$UNDOCUMENTED_COMMANDS\n - /$cmd"
fi
done
if [ -n "$UNDOCUMENTED_COMMANDS" ]; then
echo "⚠️ WARNING: Commands not mentioned in README.md:$UNDOCUMENTED_COMMANDS"
echo " Consider adding documentation for these commands"
fi
4. Check for outdated command references:
# Check for /cf- references (should be /es- now)
CF_REFS=$(grep -r '/cf-' --include="*.md" 2>/dev/null | wc -l)
if [ "$CF_REFS" -gt 0 ]; then
echo "❌ ERROR: Found $CF_REFS references to /cf-* commands (should be /es-*)"
echo " Files with /cf- references:"
grep -r '/cf-' --include="*.md" -l 2>/dev/null
exit 1
fi
5. Verify MCP server list:
# Count MCPs in .mcp.json
if [ -f ".mcp.json" ]; then
MCP_COUNT=$(jq '.mcpServers | keys | length' .mcp.json 2>/dev/null || echo "0")
# Check if README mentions correct MCP count
if ! grep -q "$MCP_COUNT MCP" README.md 2>/dev/null && ! grep -q "${MCP_COUNT} MCP" README.md 2>/dev/null; then
echo "⚠️ WARNING: README.md may not list all $MCP_COUNT MCP servers"
fi
fi
6. Check documentation freshness:
# Find recently modified code files
RECENT_CODE=$(find agents commands skills -name "*.md" -mtime -1 | wc -l)
if [ "$RECENT_CODE" -gt 0 ]; then
# Check if README was also updated
README_MODIFIED=$(find README.md -mtime -1 | wc -l)
if [ "$README_MODIFIED" -eq 0 ]; then
echo "⚠️ WARNING: $RECENT_CODE code files modified recently, but README.md not updated"
echo " Consider updating README.md to reflect recent changes"
fi
fi
If documentation validation fails, offer to auto-update:
if [ "$DOCS_VALID" = false ]; then
echo ""
echo "Would you like to auto-update documentation? (y/n)"
read -r UPDATE_DOCS
if [ "$UPDATE_DOCS" = "y" ]; then
# Update README.md counts
sed -i "s/\*\*[0-9]* specialized agents\*\*/\*\*$AGENT_COUNT specialized agents\*\*/g" README.md
sed -i "s/\*\*[0-9]* autonomous SKILLs\*\*/\*\*$SKILL_COUNT autonomous SKILLs\*\*/g" README.md
sed -i "s/\*\*[0-9]* workflow commands\*\*/\*\*$TOTAL_COMMANDS workflow commands\*\*/g" README.md
echo "✅ README.md updated with correct counts"
echo " Please review changes and commit"
fi
fi
If all checks pass:
echo ""
echo "✅ Documentation validation PASSED"
echo " - All counts accurate"
echo " - No outdated command references"
echo " - All commands documented"