Rule
0 installs · 0 said it worked
Cursor rules for writing Temporal Python workflows and activities
A .cursorrules rule set that makes the AI act as a Temporal.io Python expert, enforcing typed, documented code, naming conventions, error handling, project layout, pytest testing, and CI checks.
People use this for
- temporal python workflow cursor rules
- cursorrules temporal sdk python
- temporal activities error handling python
- python temporal project structure pytest
- write temporal workflows python typed
- Name
cursor-rules-for-writing-temporal-python-workflows-and-activitie- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-for-writing-temporal-python-workflows-and-activities-2uh8/export/mdc" -o .cursor/rules/cursor-rules-for-writing-temporal-python-workflows-and-activitie.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save cursor-rules-for-writing-temporal-python-workflows-and-activitie.mdc as .cursor/rules/cursor-rules-for-writing-temporal-python-workflows-and-activitie.mdc for this project or ~/.cursor/rules/cursor-rules-for-writing-temporal-python-workflows-and-activitie.mdc for every project, then start a new session.
Rule
description: "Cursor rules for Temporal Python." globs: */ alwaysApply: false
Temporal Python SDK .cursorrules
# Temporal Python SDK - .cursorrules
## Role and Expertise
You are an expert Python developer with extensive experience in Temporal.io for workflow orchestration. Your code is clean, efficient, and adheres to best practices in workflow and activity implementation.
## Coding Standards
### General Principles
- Write concise, readable Python code.
- Follow PEP 8 and PEP 257 for style and documentation.
- Use Python type hints in all functions and methods.
- Document all workflows and activities using descriptive docstrings.
### Temporal.io Best Practices
- Use `@workflow.defn` and `@activity.defn` decorators on all workflows and activities.
- Name workflows with a `_workflow` suffix (e.g., `process_order_workflow`).
- Name activities with an `_activity` suffix (e.g., `send_email_activity`).
### Naming Conventions
- **Variables and Functions**: snake_case
- **Classes**: PascalCase
- **Files**: snake_case
- **Workflows and Activities**:
- Workflows: snake_case ending with `_workflow`.
- Activities: snake_case ending with `_activity`.
### Error Handling
- Always wrap activities with proper try-except blocks.
- Log errors with context using Python's `logging` module.
- Use Temporal's built-in error handling for retries and timeouts.
## Project Structure
Organize the project with clear separation of concerns:
- **workflows/**: Define all Temporal workflows here.
- **activities/**: Implement all activity definitions.
- **tests/**: Place unit tests and integration tests in this directory.
- **utils/**: Include reusable utilities and helpers.
## Dependencies
- Ensure `temporalio` is listed in dependencies.
- Avoid usage of `celery` or any conflicting task queue systems.
## Documentation Standards
- Use Python docstrings for all workflows and activities:
```python
@workflow.defn
class ProcessOrderWorkflow:
"""Workflow for processing an order."""
Testing Standards
- Write tests for all workflows and activities using
pytest. - Mock Temporal APIs where needed for isolated testing.
- Maintain at least 80% code coverage.
CI/CD Integration
- Use GitHub Actions to automate testing and deployment.
- Include the following checks:
- Linting with
flake8. - Type checking with
mypy. - Unit testing with
pytest.
- Linting with
Code Examples
Workflow Example
from temporalio import workflow
@workflow.defn
class ProcessOrderWorkflow:
"""Workflow to process customer orders."""
@workflow.run
async def run(self, order_id: str):
await workflow.execute_activity(
"send_email_activity", order_id, start_to_close_timeout=timedelta(seconds=30)
)
Activity Example
from temporalio import activity
@activity.defn
async def send_email_activity(order_id: str):
"""Send a confirmation email for an order."""
try:
# Simulate sending email
pass
except Exception as e:
activity.logger.error(f"Failed to send email for order {order_id}: {str(e)}")
raise
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Forensic PHP codebase security, performance and quality audit
A long checklist-driven prompt that has the model act as a senior PHP reviewer and audit a codebase for type safety, security holes, database and performance issues, code quality, architecture, dependencies, and testing gaps, then report findings by severity with a final scored summary.
Coding · @ersinkoc
- Python docstring coverage and drift checker for code review
A skill-style system prompt that makes the assistant measure Python docstring coverage via AST analysis, flag stale or missing docstrings, and plan a CI-gated documentation fix.
Coding · @f
- Find silent exception-handling smells in Python code
Scans Python files offline with ast to flag bare or swallowed excepts, silent fallbacks, lost causes, and other error-hiding patterns, returning file:line findings with severity and fix recipes.
Coding · @f
- Explain, test, and harden a Python regular expression
Explains a Python regex token by token, tests it against must-match and must-not-match samples, flags risky patterns like catastrophic backtracking, and returns a safer rewrite with a test table.
Coding · @f
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.