Build Python serverless APIs on Cloudflare Workers with async-only execution, external package support, and multi-step workflow automation.
Works with
Deploy Python APIs using the WorkerEntrypoint class pattern with pywrangler CLI; supports all Cloudflare bindings (D1, KV, R2, Workers AI, Durable Objects, Queues)
Requires async-only code: use httpx or aiohttp for HTTP calls, avoid sync libraries like requests and native C extensions
Python Workflows enable durable multi-step DAG automation with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versioncloudflare-python-workersExecute the skills CLI command in your project's root directory to begin installation:
Fetches cloudflare-python-workers from jezweb/claude-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate cloudflare-python-workers. Access via /cloudflare-python-workers in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
697
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
697
stars
Status: Beta (requires python_workers compatibility flag)
Runtime: Pyodide (Python 3.12+ compiled to WebAssembly)
Package Versions: [email protected], [email protected], [email protected]
Last Verified: 2026-01-21
Ensure you have installed:
# Create project directory
mkdir my-python-worker && cd my-python-worker
# Initialize Python project
uv init
# Install pywrangler
uv tool install workers-py
# Initialize Worker configuration
uv run pywrangler init
Create src/entry.py:
from workers import WorkerEntrypoint, Response
class Default(WorkerEntrypoint):
async def fetch(self, request):
return Response("Hello from Python Worker!")
{
"name": "my-python-worker",
"main": "src/entry.py",
"compatibility_date": "2025-12-01",
"compatibility_flags": ["python_workers"]
}
uv run pywrangler dev
# Visit http://localhost:8787
uv run pywrangler deploy
If you created a Python Worker before December 2025, you were limited to built-in packages. With pywrangler (Dec 2025), you can now deploy with external packages.
Old Approach (no longer needed):
# Limited to built-in packages only
# Could only use httpx, aiohttp, beautifulsoup4, etc.
# Error: "You cannot yet deploy Python Workers that depend on
# packages defined in requirements.txt [code: 10021]"
New Approach (pywrangler):
# pyproject.toml
[project]
dependencies = ["fastapi", "any-pyodide-compatible-package"]
uv tool install workers-py
uv run pywrangler deploy # Now works!
Historical Timeline:
See: Package deployment issue history
As of August 2025, Python Workers use a class-based pattern (not global handlers):
from workers import WorkerEntrypoint, Response
class Default(WorkerEntrypoint):
async def fetch(self, request):
# Access bindings via self.env
value = await self.env.MY_KV.get("key")
# Parse request
url = request.url
method = request.method
return Response(f"Method: {method}, URL: {url}")
All Cloudflare bindings are accessed via self.env:
class Default(WorkerEntrypoint):
async def fetch(self, request):
# D1 Database
result = await self.env.DB.prepare("SELECT * FROM users").all()
# KV Storage
value = await self.env.MY_KV.get("key")
await self.env.MY_KV.put("key", "value")
# R2 Object Storage
obj = await self.env.MY_BUCKET.get("file.txt")
# Workers AI
response = await self.env.AI.run("@cf/meta/llama-2-7b-chat-int8", {
"prompt": "Hello!"
})
return Response("OK")
Supported Bindings:
See Cloudflare Bindings Documentation for details.
from workers import WorkerEntrypoint, Response
import json
class Default(WorkerEntrypoint):
async def fetch(self, request):
# Parse JSON body
if request.method == "POST":
body = await request.json()
return Response(
json.dumps({"received": body}),
headers={"Content-Type": "application/json"}
)
# Query parameters
url = URL(request.url)
name = url.searchParams.get("name", "World")
return Response(f"Hello, {name}!")
from workers import handler
@handler
async def on_scheduled(event, env, ctx):
# Run on cron schedule
print(f"Cron triggered at {event.scheduledTime}")
# Do work...
await env.MY_KV.put("last_run", str(event.scheduledTime))
Configure in wrangler.jsonc:
{
"triggers": {
"crons": ["*/5 * * * *"] // Every 5 minutes
}
}
Python Workflows enable durable, multi-step automation with automatic retries and state persistence.
Python Workflows use the @step.do() decorator pattern because Python does not easily support anonymous callbacks (unlike JavaScript/TypeScript which allows inline arrow functions). This is a fundamental language difference, not a limitation of Cloudflare's implementation.
JavaScript Pattern (doesn't translate):
await step.do("my step", async () => {
// Inline callback
return result;
});
Python Pattern (required):
@step.do("my step")
async def my_step():
# Named function with decorator
return result
result = await my_step()
Source: Python Workflows Blog
Pyodide captures JavaScript promises (thenables) and proxies them as Python awaitables. This enables Promise.all-equivalent behavior using standard Python async patterns:
import asyncio
@step.do("step_a")
async def step_a():
return "A"
@step.do("step_b")
async def step_b():
return "B"
# Concurrent execution (like Promise.all)
results = await asyncio.gather(step_a(), step_b(Implementation Guide
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
- 1Install skill using provided installation command
- 2Test with simple use case relevant to your work
- 3Evaluate output quality and relevance
- 4Iterate on prompts to improve results
- 5Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Related Skills
wordpress-elementor
137jezweb/claude-skills
Productivitysame reporeact-native
22jezweb/claude-skills
Frontendsame repozustand-state-management
7jezweb/claude-skills
Productivitysame repodependency-audit
4jezweb/claude-skills
Productivitysame repoonboarding-ux
4jezweb/claude-skills
Productivitysame repofastapi-python
73mindrally/skills
Backendtag: pythonReviews
4.6★★★★★71 reviews- CChaitanya Patil★★★★★Dec 24, 2024
cloudflare-python-workers is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- IIshan Khanna★★★★★Dec 16, 2024
Keeps context tight: cloudflare-python-workers is the kind of skill you can hand to a new teammate without a long onboarding doc.
- EEvelyn Sethi★★★★★Dec 12, 2024
Useful defaults in cloudflare-python-workers — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- KKofi Reddy★★★★★Dec 12, 2024
cloudflare-python-workers has been reliable in day-to-day use. Documentation quality is above average for community skills.
- XXiao Sharma★★★★★Dec 12, 2024
Registry listing for cloudflare-python-workers matched our evaluation — installs cleanly and behaves as described in the markdown.
- IIshan Anderson★★★★★Dec 8, 2024
cloudflare-python-workers fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- MMin Agarwal★★★★★Nov 27, 2024
I recommend cloudflare-python-workers for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- PPiyush G★★★★★Nov 15, 2024
Useful defaults in cloudflare-python-workers — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- XXiao Desai★★★★★Nov 7, 2024
Keeps context tight: cloudflare-python-workers is the kind of skill you can hand to a new teammate without a long onboarding doc.
- IIsabella Bansal★★★★★Nov 3, 2024
cloudflare-python-workers is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
showing 1-10 of 71
1 / 8Discussion
Comments — not star reviews- No comments yet — start the thread.