Robocorp Cursor Rules

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Guidelines for building RoboCorp RPA automation with Python, emphasizing functional programming, Pydantic validation, and async operations.

AI 生成的概览

用于以 Python 构建 RoboCorp RPA 自动化的编码规范,强调函数式风格、Pydantic 校验与异步操作。

功能
提供一套用 Python 编写 RoboCorp RPA 自动化的开发约定,涵盖函数式与声明式编程、类型注解、用于输入输出校验的 Pydantic 模型、使用守卫子句和自定义异常的错误处理、异步 I/O、缓存,以及依赖注入和声明式任务定义等 RoboCorp 特有做法。它只产出指导内容,不产出可运行代码或生成的文件。
适用场景
在编写或审查 RoboCorp RPA 项目的 Python 代码,并希望保持统一的结构、校验和异步约定时使用。它面向需要统一任务、工具函数和错误处理风格的开发者。
运行要求
无需任何工具、软件包或凭据;它是仅含说明的文档,不附带脚本。

RoboCorp Python Development

You are an expert in Python and RoboCorp RPA development.

Core Guidelines

Key Principles

  • Write concise, technical responses with accurate Python examples
  • Emphasize functional, declarative programming while avoiding classes
  • Prioritize iteration and modularization over code duplication
  • Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission)
  • Adopt lowercase with underscores for directories/files (e.g., tasks/data_processing.py)
  • Favor named exports for utility functions and task definitions
  • Implement the Receive an Object, Return an Object (RORO) pattern

Python/RoboCorp Standards

  • Use def for pure functions and async def for asynchronous operations
  • Include type hints for all function signatures
  • Prefer Pydantic models over raw dictionaries for input validation
  • Structure files with: exported tasks, sub-tasks, utilities, static content, types

Error Handling and Validation

  • Handle errors and edge cases at the beginning of functions
  • Use early returns for error conditions to avoid deeply nested statements
  • Place the happy path last for improved readability
  • Implement guard clauses for preconditions and invalid states
  • Provide proper error logging and user-friendly messages
  • Use custom error types for consistent handling

RoboCorp-Specific Guidelines

  • Use functional components (plain functions) and Pydantic models
  • Create declarative task definitions with clear return type annotations
  • Minimize lifecycle event handlers; prefer context managers
  • Employ middleware for logging, error monitoring, and optimization
  • Optimize performance using async functions for I/O-bound tasks
  • Use specific exceptions like RPA.HTTP.HTTPException for expected errors
  • Apply Pydantic's BaseModel for consistent input/output validation

Performance Optimization

  • Minimize blocking I/O operations; use asynchronous operations for all database calls
  • Implement caching for static and frequently accessed data using Redis or in-memory stores
  • Optimize data serialization/deserialization with Pydantic
  • Use lazy loading techniques for large datasets

Key Conventions

  1. Rely on RoboCorp's dependency injection system
  2. Prioritize RPA performance metrics (execution time, resource utilization, throughput)
  3. Limit blocking operations; favor asynchronous flows
  4. Structure tasks and dependencies clearly for maintainability

来源与署名

来源:mindrally/skills位于robocorp-cursor-rules提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架