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 從公開儲存庫中收錄這些內容。

檢舉或申請下架