workers-code-review

SkillCloud & infra

This skill lets your AI review code built on Cloudflare Workers and the Cloudflare Developer Platform. It checks TypeScript and JavaScript for type errors and incorrect API usage, and it validates wrangler.c or wrangler.toml configuration files. Once added, your AI can flag problems in Workers code and config during a review.

Available today. Use it from your connected AI after setup.

Add the skill, then ask your AI to review your Workers code or wrangler configuration files. It is meant to be loaded when a review involves Workers APIs, config files, or Cloudflare bindings.

Then ask your AI: use the workers-code-review skill

What your AI can do with it

  • Review Workers code for type errors
  • Check that Workers APIs are used correctly
  • Validate wrangler.c and wrangler.toml configuration files
  • Check how code uses Cloudflare services such as KV, R2, D1, Durable Objects, Queues, Vectorize, AI, and Hyperdrive
  • Review TypeScript and JavaScript projects that use the Cloudflare Developer Platform

What this skill tells your AI

The instructions your AI receives, as published by try-works/role-model in .agents/skills/workers-code-review/SKILL.md and read by ahel’s review.

Your knowledge of Cloudflare Workers APIs, types, and wrangler configuration may be outdated. Prefer retrieval over pre-training for any Workers code review task.

Reference Sources

Use the repo's local copies — do not run npm pack or install packages to fetch types.

SourceWhere to find itUse for
Wrangler config schemanode_modules/wrangler/config-schema.jsonConfig fields, binding shapes, allowed values
Workers typesnode_modules/@cloudflare/workers-types/index.d.tsAPI usage, handler signatures, binding types
Cloudflare docs searchUse the cloudflare-docs search tool or read files in this repoAPI reference, compatibility dates/flags, binding docs

Read these files directly when you need to verify a type, config field, or API signature. The guides in this folder describe what to validate — not how to fetch packages.

Review Process

1. Build Context

Read full files, not just diffs or isolated snippets. Code that looks wrong in isolation may be correct given surrounding logic.

  • Identify the purpose of the code: is it a complete Worker, a snippet, a configuration example?
  • Check git history for context: git log --oneline -5 -- <file>
  • Understand which bindings, types, and patterns the code depends on

2. Categorize the Code

Every code block falls into one of three categories. Review in the context of its category.

CategoryDefinitionExpectations
IllustrativeDemonstrates a concept; uses comments for most logicCorrect API names, realistic signatures
DemonstrativeFunctional but incomplete; would work if placed in the right contextSyntactically valid, correct APIs and binding access
ExecutableStandalone and complete; runs without modificationCompiles, runs, includes imports and config

3. Validate with Tools

Run type-checking and linting. Tool output is evidence, not opinion.

npx tsc --noEmit                    # TypeScript errors
npx eslint <files>                  # Lint issues

For config files, validate against the latest wrangler config schema (see wrangler-config.md for retrieval) and check that all fields, binding types, and values conform.

4. Check Against Rules

See workers-types.md for type system rules, wrangler-config.md for config validation, and common-patterns.md for correct API patterns.

Quick-reference rules:

RuleDetail
Binding accessenv.X in module export handlers; this.env.X in classes extending platform base classes. See common-patterns.md.
No anyNever use any for binding types, handler params, or API responses. Use proper generics.
No type-system cheatsFlag as unknown as T, unjustified @ts-ignore, unsafe assertions. See workers-types.md.
Config-code consistencyBinding names in wrangler config must match env.X usage in code. See wrangler-config.md.
Required config fieldsVerify against the wrangler config schema — do not assume which fields are required.
Concise examplesExamples should focus on core logic. Minimize boilerplate that distracts from what the code teaches.
Floating promisesEvery Promise must be awaited, returned, voided, or passed to ctx.waitUntil(). See common-patterns.md.
SerializationData crossing Queue, Workflow step, or DO storage boundaries must be structured-clone serializable. See common-patterns.md.
StreamingLarge/unknown payloads must stream, not buffer. Flag await response.text() on unbounded data.
Error handlingMinimal but present — null checks on nullable returns, basic fetch error handling. Do not distract with verbose try/catch.

5. Assess Risk

RiskTriggers
HIGHAuth, crypto, external calls, value transfer, validation removal, access control, binding misconfiguration
MEDIUMBusiness logic, state changes, new public APIs, error handling, config changes
LOWComments, logging, formatting, minor style

Focus deeper analysis on HIGH risk. For critical paths, check blast radius: how many other files reference this code?

Security logic escalation: for crypto, auth, and timing-sensitive code, do not stop at verifying API calls are correct. Examine the surrounding logic for flaws that undermine the security property (e.g., correct timingSafeEqual call but early return on length mismatch). See common-patterns.md Security section.

Anti-patterns to Flag

Anti-patternWhy it matters
any on Env or handler paramsDefeats type safety for every binding access downstream
as unknown as T double-castHides real type incompatibilities — fix the underlying design
@ts-ignore / @ts-expect-error without explanationMasks errors silently; require a comment justifying each suppression
Buffering unbounded data (await res.text(), await res.json() on streams)Memory exhaustion on large payloads; use streaming
Hardcoded secrets or API keysUse env bindings and wrangler secret
blockConcurrencyWhile on every requestOnly for initialization; blocks all concurrent requests
Single global Durable ObjectCreates a bottleneck; shard by coordination atom
In-memory-only state in DOsLost on eviction; persist to SQLite storage
Missing DO migrations in configNew DO classes require migration entries or deployment fails
Floating promises (step.do(), fetch() without await)Silent bugs — drops results, breaks Workflow durability, ignores errors
Non-serializable values across boundaries (Response, Error in step/queue)Compiles but fails at runtime; extract plain data before crossing boundary
implements instead of extends on platform base classesLegacy pattern — loses this.ctx, this.env access from base class

What NOT to Flag

  • Style not enforced by linters
  • "Could be cleaner" when code is correct and clear
  • Theoretical performance concerns without evidence
  • Missing features not in scope of the example
  • Pre-existing issues in unchanged code

Output Format

**[SEVERITY]** Brief description
`file.ts:42` — explanation with evidence (tool output, type error, config mismatch)
Suggested fix: `code` (if applicable)

Severity: CRITICAL (security, data loss, crash) | HIGH (type error, wrong API, broken config) | MEDIUM (missing validation, edge case, outdated pattern) | LOW (style, minor improvement)

End with a summary count by severity. If no issues found, say so directly.

Principles

  • Be certain. Investigate before flagging. If you cannot confirm an API, binding pattern, or config field, retrieve the docs or schema first.
  • Provide evidence. Reference line numbers, tool output, schema fields, or type definitions.
  • Correctness over completeness. A concise example that works is better than a comprehensive one with errors.
  • Respect existing patterns. Do not flag conventions already established in the codebase unless actively harmful.
  • Focus on what developers will copy. Code in documentation gets pasted into production. Treat it accordingly.

Signals

GitHub stars
118
Forks
6
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
workers-code-review-try-works
Source
github.com/try-works/role-model