uipath-coded-workflows
UiPath Coded Workflows Assistant
Full coding assistant for creating, editing, managing and running UiPath coded automation projects.
When to Use This Skill
- User wants to create a new UiPath coded automation project
- User wants to add a coded workflow or test case to an existing project
- User wants to edit an existing coded workflow or test case
- User wants to modify project configuration (dependencies, entry points)
- User asks about UiPath activities or how to automate something with UiPath coded workflows
- User wants to add dependencies to a project
- User wants to create a test case with assertions (can be in any project type)
- User wants to add helper/utility classes or models to a project (Coded Source Files)
- User wants to validate, build, pack and run a coded workflow project
Quick Start
Step 0 — Resolve PROJECT_DIR first (applies to ALL operations below):
Before creating or modifying anything, you MUST determine which project to work with. Do NOT skip this step. Do NOT assume no project exists.
PROJECT_DIR is the absolute path to the root folder of a UiPath project (the folder that contains project.json).
Step 0a — Determine the path (use the first rule that matches):
-
Explicit path — The user provided a directory path → use it as-is.
-
Project name reference — The user mentioned a project by name (e.g., "the MyAutomation project") → search the file system for a folder with that name containing a
project.json. -
Detect from running Studio — No path or name given → run this command:
uip rpa list-instances --format jsonParse the JSON response. If
Datais a non-empty array, each entry has aProjectDirectoryfield containing the absolute path of the open project. Use it:- One instance → use its
ProjectDirectory. - Multiple instances → pick the one whose
ProjectDirectorybest matches the user's context (or ask the user which project).
Example response:
{ "Data": [{ "ProcessId": 11764, "ProjectDirectory": "C:\\Users\\me\\Documents\\UiPath\\MyProject" }] }→
PROJECT_DIR=C:\Users\me\Documents\UiPath\MyProjectThis works regardless of where Claude Code was launched from (Studio terminal, external terminal, etc.).
- One instance → use its
-
Fall back to current working directory — If
Datais an empty array (no Studio instance is running), use the current working directory.
Step 0b — Ensure a project exists at that path:
- Check whether
<PROJECT_DIR>/project.jsonexists.- If yes → A project already exists here. Proceed with this directory.
- If no → No project exists yet. Create one (see below).
Creating a new project (ONLY when no project is open and none exists at cwd or user gives a specific path):
ALWAYS use uip rpa create-project — never write project.json, project.uiproj, or other scaffolding files manually:
uip rpa create-project --name "<NAME>" --location "<PARENT_DIR>" --studio-dir "<STUDIO_DIR>" --format json
Use --template-id TestAutomationProjectTemplate for test projects, or --template-id LibraryProcessTemplate for libraries.
After creation:
- Read the scaffolded files —
create-projectgenerates starter files (e.g.Main.cs,project.json). Read them before making changes so you build on valid defaults rather than overwrite blindly - Add workflow/test case/source files and edit
project.jsonas needed (add dependencies, entry points — do NOT rewrite the entire file) - Validate each file (Critical Rule #14) — run the validation loop on every
.csfile you create or edit until it compiles cleanly
See references/operations-guide.md § Initialize a New Project for the full step-by-step procedure.
Adding to existing project:
- Perform API Discovery — Search for and read 5 existing .cs files to learn project patterns
- Identify operation type (workflow, test case, or source file)
- Follow relevant operation guide (references/operations-guide.md)
- Update
project.jsonas needed - Use appropriate template from
assets/ - Add
usingstatements based on packages inproject.json - Validate each file (Critical Rule #14) — run the validation loop on every
.csfile you create or edit until it compiles cleanly
Critical Rules
- NEVER create a project without first confirming no project already exists. Follow the Step 0a resolution order above: if the user gave an explicit path or project name, check whether
project.jsonexists there. If no path was given, runuip rpa list-instances --format json— if a Studio instance is running with aProjectDirectory, that IS the project. Only create a new project when you have confirmed no existing project matches AND the user explicitly requests creation (or no project exists at cwd). This prevents accidentally creating nested projects or working in the wrong directory. - Prefer UiPath built-in activities for Orchestrator integration (
system.GetAsset,system.AddQueueItem), UI automation (uiAutomation.*), and document handling (excel.*,word.*) — these provide reliability, logging, and Studio-level support. Prefer plain .NET / third-party packages for pure data transforms, HTTP calls to non-Orchestrator endpoints, parsing, string manipulation, and anything where code is clearly the right tool. When no built-in activity exists, find a well-known NuGet package — inspect it withuip rpa inspect-packagefirst, then add it toproject.json. - ALWAYS inherit from
CodedWorkflowbase class for workflow and test case classes (NOT for Coded Source Files — see below). - ALWAYS use
[Workflow]or[TestCase]attribute on theExecutemethod (workflows/test cases only). - Generate the companion
.cs.jsonmetadata file for each.csworkflow/test case file (NOT for Coded Source Files). When the project is managed in UiPath Studio, Studio may regenerate these — only create them when scaffolding new files outside Studio. - Update
project.jsonentry points when adding or removing workflow files (NOT for Coded Source Files). - Update
project.jsonfileInfoCollection when adding or removing test case files (NOT for Coded Source Files). - Use v25.x dependency versions by default (UiPath.CodedWorkflows is implicit in v25.x).
- One workflow/test case class per file, class name must match file name. Coded Source Files may group related types (e.g. multiple models or enums in one file).
- Namespace = sanitized project name from
project.json. Sanitize: remove spaces and invalid C# identifier characters, replace hyphens/spaces with_, ensure it doesn't start with a digit. E.g. project name"My Invoice-App 2"becomes namespaceMy_Invoice_App_2. For files in subfolders, append the folder name:ProjectName.FolderName. - Entry method is always named
Execute(workflows/test cases only). - ALWAYS ensure required package dependencies are in
project.jsonwhen using a service. Each service onCodedWorkflowrequires its corresponding NuGet package — without it you getCS0103: The name 'xxx' does not exist in the current context. See the Service-to-Package mapping below. - Use Coded Source Files for reusable code — extract models, helper classes, utilities, and shared logic into plain
.csfiles that don't inherit fromCodedWorkflow. These have NO.cs.json, NO entry point, NO fileInfoCollection, and NO[Workflow]/[TestCase]attribute. - ALWAYS validate each file until error-free after creating or editing it. Never consider a file "done" until validation returns no errors. Follow this loop after every create/edit:
- Run
uip rpa validate --file-path "<FILE>" --project-dir "<PROJECT_DIR>" --studio-dir "<STUDIO_DIR>" --format json— this forces Studio to re-analyze the specific file and returns a JSON result with validation status and any errors found - If errors exist in the response: read the error messages, fix the code, and go back to step 1
- Repeat until validation returns zero errors (max 5 fix attempts)
- Only then proceed to run the workflow or report success to the user
- If after 5 fix attempts errors persist, stop and present the remaining errors to the user — they may require domain knowledge, missing dependencies, or environment-specific fixes you cannot resolve autonomously
Note:
get-errorsreturns the cached error state without re-analyzing — usevalidateinstead when files have been changed outside Studio.
- Run
- NEVER use UITask (ScreenPlay) as the primary UI automation approach. For ANY workflow using
uiAutomation.*, follow the Finding Descriptors hierarchy in ui-automation-guide.md: (1) Check Object Repository, (2) Check UILibrary NuGet packages, (3) Configure missing targets through theuia-configure-targetskill flow (found in the UIA activity-docs — NOT via raw CLI commands), (4) UITask ONLY as last resort for brittle selectors. Do NOT skip steps or jump to UITask because configuring targets seems tedious. Do NOT manually call low-leveluip rpa uiaCLI commands outside of the skill flow.
UI Automation References
For a quick overview of UI automation patterns, descriptor resolution, target configuration via uia-configure-target, runtime selector failure recovery, and common pitfalls, see ui-automation-guide.md.
The UIA activity-docs version folder contains skill files (uia-configure-target, uia-improve-selector) and additional guides (selector creation, CV targeting). Discover them by globbing: Glob: pattern="**/*.md" path="../../references/activity-docs/UiPath.UIAutomation.Activities/{closest}/". These are reference docs to read and follow — they are NOT invocable as slash commands. Read the relevant .md file and follow its steps using the uip rpa CLI commands directly.
For full API details: .local/docs/packages/UiPath.UIAutomation.Activities/ → fallback: ../../references/activity-docs/UiPath.UIAutomation.Activities/{closest}/coded/.
Task Navigation
Choose your task to find the right reference files. For any activity package docs, always follow the doc resolution order from Resolving Packages & Activity Docs § Step 2: check {PROJECT_DIR}/.local/docs/packages/{PackageId}/ first, then fall back to the bundled references below.
| I need to... | Read these |
|---|---|
| Create a new project | Quick Start above → operations-guide.md § Initialize |
| Add/edit a workflow | operations-guide.md § Add Workflow → coding-guidelines.md |
| Add a test case | operations-guide.md § Add Test Case |
| Write UI automation | ui-automation-guide.md → .local/docs/ → fallback: ../../references/activity-docs/UiPath.UIAutomation.Activities/{closest}/coded/ → operations-guide.md § Indicate |
| Use Excel/Word/Mail/etc. | Service table below → .local/docs/packages/{PackageId}/ → fallback: ../../references/activity-docs/{PackageId}/{closest}/coded/ |
| Call an Integration Service connector | references/integration-service.md — use uipath-development skill first to resolve connector key, connection id, object name, httpMethod, path, and parameter types. Before writing any Create/Update call: run Step 1b in that guide to check for "type": "multipart" params in the raw metadata file — if found, pass multipartParameters: new() to ExecuteAsync |
| Use Office 365 / Google | Service table below → codedworkflow-reference.md § Integration Service |
| Use Azure services | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.Azure.Activities/{closest}/coded/ |
| Use Google Cloud (GCP) | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.GoogleCloud.Activities/{closest}/coded/ |
| Use Exchange Server | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.ExchangeServer.Activities/{closest}/coded/ |
| Use System Center | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.SystemCenter.Activities/{closest}/coded/ |
| Use Amazon Web Services | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.AmazonWebServices.Activities/{closest}/coded/ |
| Use Amazon WorkSpaces | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.AmazonWorkSpaces.Activities/{closest}/coded/ |
| Use Azure AD | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.AzureActiveDirectory.Activities/{closest}/coded/ |
| Use Azure WVD | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.AzureWVD.Activities/{closest}/coded/ |
| Use Active Directory | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.ActiveDirectory.Activities/{closest}/coded/ |
| Use Citrix | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.Citrix.Activities/{closest}/coded/ |
| Use Hyper-V | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.HyperV.Activities/{closest}/coded/ |
| Use NetIQ eDirectory | Service table below → .local/docs/ → fallback: ../../references/activity-docs/UiPath.NetIQeDirectory.Activities/{closest}/coded/ |
| Build/run/validate | uip-guide.md |
| Add a NuGet package | operations-guide.md § Add Dependency → third-party-packages-guide.md |
| Troubleshoot errors | coding-guidelines.md § Common Issues |
| Review coding rules | coding-guidelines.md (using statements, best practices, anti-patterns) |
Three Types of .cs Files
| Type | Base Class | Attribute | .cs.json |
Entry Point | Purpose |
|---|---|---|---|---|---|
| Coded Workflow | CodedWorkflow |
[Workflow] |
Yes | Yes | Executable automation logic |
| Coded Test Case | CodedWorkflow |
[TestCase] |
Yes | Yes | Automated test with assertions |
| Coded Source File | None (plain C#) | None | No | No | Reusable models, helpers, utilities, hooks |
Service-to-Package Dependency Mapping
Each service available on the CodedWorkflow base class is injected by UiPath Studio only when its corresponding NuGet package is listed in project.json dependencies. If the package is missing, the service property won't exist and you'll get a compile error.
Commonly used packages
These packages are typically included in most projects. Always check project.json dependencies to confirm which are actually present before using their services — not all projects include all of them:
| Service Property | Required Package in project.json |
|---|---|
system |
UiPath.System.Activities [25.12.2] |
testing |
UiPath.Testing.Activities [25.10.0] |
uiAutomation |
UiPath.UIAutomation.Activities [25.10.21] |
Integration Service package (add when calling connectors from code)
| API Class | Required Package in project.json |
Reference |
|---|---|---|
IntegrationConnectorService |
UiPath.IntegrationService.Activities [1.24.0] |
references/integration-service.md |
Use IntegrationConnectorService.Create(services.Container).ExecuteAsync(...) to call any connector (Jira, Salesforce, ServiceNow, Slack, etc.) directly. Requires the connector key, connection id, object name, HTTP method, path, and parameter buckets — all resolved up-front via the uipath-development skill.
Domain-specific packages (add only when needed)
These packages provide the excel, word, powerpoint, mail, office365, and google services. Add them to project.json dependencies when the workflow uses the corresponding service.
| Service Property | Required Package in project.json |
|---|---|
excel |
UiPath.Excel.Activities [3.3.1] |
word |
UiPath.Word.Activities [2.3.1] |
powerpoint |
UiPath.Presentations.Activities [2.3.1] |
mail |
UiPath.Mail.Activities [2.5.10] |
office365 |
UiPath.MicrosoftOffice365.Activities [3.6.10] |
google |
UiPath.GSuite.Activities [3.6.10] |
Infrastructure & Cloud packages (add only when needed)
These packages provide services for cloud platforms, virtualization, directory services, and IT infrastructure automation. Add them to project.json dependencies when the workflow uses the corresponding service.
| Service Property | Required Package in project.json |
API Reference |
|---|---|---|
azure |
UiPath.Azure.Activities |
../../references/activity-docs/UiPath.Azure.Activities/{latest}/coded/ |
gcp |
UiPath.GoogleCloud.Activities |
../../references/activity-docs/UiPath.GoogleCloud.Activities/{latest}/coded/ |
exchangeserver |
UiPath.ExchangeServer.Activities |
../../references/activity-docs/UiPath.ExchangeServer.Activities/{latest}/coded/ |
systemCenter |
UiPath.SystemCenter.Activities |
../../references/activity-docs/UiPath.SystemCenter.Activities/{latest}/coded/ |
aws |
UiPath.AmazonWebServices.Activities |
../../references/activity-docs/UiPath.AmazonWebServices.Activities/{latest}/coded/ |
awrks |
UiPath.Amazon.Workspaces.Activities |
../../references/activity-docs/UiPath.AmazonWorkSpaces.Activities/{latest}/coded/ |
azureAD |
UiPath.AzureActiveDirectory.Activities |
../../references/activity-docs/UiPath.AzureActiveDirectory.Activities/{latest}/coded/ |
azureWVD |
UiPath.AzureWVD.Activities |
../../references/activity-docs/UiPath.AzureWVD.Activities/{latest}/coded/ |
activeDirectoryDomainServices |
UiPath.ActiveDirectory.Activities |
../../references/activity-docs/UiPath.ActiveDirectory.Activities/{latest}/coded/ |
citrix |
UiPath.Citrix.Activities |
../../references/activity-docs/UiPath.Citrix.Activities/{latest}/coded/ |
hyperv |
UiPath.HyperV.Activities |
../../references/activity-docs/UiPath.HyperV.Activities/{latest}/coded/ |
netiq |
UiPath.NetIQeDirectory.Activities |
../../references/activity-docs/UiPath.NetIQeDirectory.Activities/{latest}/coded/ |
Note: The
office365andoffice365/connectionsproperty for accessing configured connection instances.office365provides Mail, Calendar, Excel (cloud), OneDrive, and SharePoint via Microsoft Graph API.
Resolving Packages & Activity Docs
Follow this flow whenever you need to use an activity package:
Step 1 — Ensure the package is installed
Check project.json → dependencies for the required package.
- If the package IS in
project.json→ note the installed version, proceed to Step 2. You may suggest updating to the latest for the best experience, but never force an update — respect the user's current version. - If the package is NOT in
project.json→ discover and install the latest version:
# List latest versions including prerelease/beta (newest first) — DEFAULT
uip rpa get-versions --package-id <PackageId> --include-prerelease --project-dir "<PROJECT_DIR>" --format json
# List only stable versions (use when the user explicitly prefers stable)
uip rpa get-versions --package-id <PackageId> --project-dir "<PROJECT_DIR>" --format json
# Install a specific version
uip rpa install-or-update-packages --packages '[{"id":"<PackageId>","version":"<version>"}]' --project-dir "<PROJECT_DIR>" --format json
# Install without specifying version (auto-resolves: prerelease Studio → latest preview, stable Studio → latest stable)
uip rpa install-or-update-packages --packages '[{"id":"<PackageId>"}]' --project-dir "<PROJECT_DIR>" --format json
By default, use --include-prerelease to get the absolute latest version (including beta/preview). Only omit it when the user explicitly asks for stable versions. Always prefer uip rpa get-versions over hardcoded version numbers — it queries the actual NuGet feeds configured for the project.
Step 2 — Find activity docs (priority order)
Once the package is installed, find the right documentation in this order:
- Check
{PROJECT_DIR}/.local/docs/packages/{PackageId}/— these are auto-generated docs from the installed package version and are always the most accurate match. If present, use them as the primary source and stop here.Important: The
.local/folder is gitignored and hidden, soGrepwill not find it. Always useGlob+ReadorBash: lsto discover and search docs inside.local/docs/. - Fall back to bundled reference docs — if
.local/docs/is missing or doesn't contain docs for this package, look in../../references/activity-docs/{PackageId}/and pick the closest version folder to what is installed:- Extract major.minor from the installed version (e.g.,
[25.10.21]→25.10) - List available doc folders:
ls ../../references/activity-docs/{PackageId}/ - Pick the closest match: exact major.minor if it exists, otherwise the nearest available folder
- If the package was just installed (new), use the latest available folder
- Extract major.minor from the installed version (e.g.,
Resolving {latest}: Throughout this document, {latest} means "list the version folders under the package directory and pick the highest one." When the project already has the package installed, prefer the docs version closest to the installed version instead.
📖 Using statements rules and best practices: references/coding-guidelines.md
CodedWorkflow Base Class
All workflow and test case files inherit from CodedWorkflow, which provides built-in methods (Log, Delay, RunWorkflow), service properties (mapped in the table above), and the workflows property for strongly-typed invocation of other workflows. It can be extended with Before/After hooks via IBeforeAfterRun.
📖 Full reference (methods, invocation patterns, hooks): references/codedworkflow-reference.md
Project Structure Reference
ProjectName/
├── project.json # Project configuration (dependencies, entry points, runtime options)
├── project.uiproj # Simple project descriptor (Name, ProjectType, MainFile)
├── Main.cs # Main entry point workflow (CodedWorkflow + [Workflow])
├── Main.cs.json # Metadata for Main.cs (DisplayName, Arguments)
├── [OtherWorkflow].cs # Additional workflow/test case files
├── [OtherWorkflow].cs.json # Metadata for each workflow/test case .cs file
├── [HelperClass].cs # Coded Source File — plain C# class (NO .cs.json, NO entry point)
├── [Models].cs # Coded Source File — data models, DTOs, enums
├── .codedworkflows/ # Auto-generated (ConnectionsFactory.cs, ConnectionsManager.cs)
├── .objects/ # Object Repository metadata
├── .project/
│ ├── PackageBindingsMetadata.json
│ └── design.json
├── .settings/Design/ # IDE design settings
├── .tmh/config.json # Telemetry config
└── .variations/ # (Tests only) data-driven test parameters
Important: Auto-generated coded workflow artifacts — Files under
.codedworkflows/(such asObjectRepository.cs,ConnectionsFactory.cs,ConnectionsManager.cs,WorkflowRunnerService.cs) are only generated by Studio when the project contains at least one coded workflow (.cs) file. If the project only has XAML workflows, these files will not exist. When adding the first coded workflow to a project, even creating an empty.csfile is enough to trigger Studio to generate these artifacts — no need to validate first. Do not create or edit these files manually.
📖 Design guidelines: See assets/project-structure-examples.md
Templates
📁 Location: assets/
All file templates with ready-to-use code:
- Workflow templates → assets/codedworkflow-template.md
- Test case templates → assets/testcase-template.md
- Helper class templates → assets/helper-utility-template.md
- JSON/config templates → assets/json-template.md (project.json, .cs.json, project.uiproj)
- Project structure examples → assets/project-structure-examples.md
- Before/After hooks template → assets/before-after-hooks-template.md
Activity Examples & References
Always check {PROJECT_DIR}/.local/docs/packages/{PackageId}/ first — these are auto-generated from the installed package and are the most accurate. Only fall back to the bundled references below when .local/docs/ is unavailable.
Bundled reference docs live in ../../references/activity-docs/{PackageId}/{Version}/coded/ — pick the version folder closest to what is installed in the project (see Resolving Packages & Activity Docs § Step 2).
Available reference packages:
- Document & productivity:
UiPath.Excel.Activities,UiPath.Word.Activities,UiPath.Presentations.Activities,UiPath.Mail.Activities,UiPath.MicrosoftOffice365.Activities,UiPath.GSuite.Activities - Cloud platforms:
UiPath.Azure.Activities,UiPath.GoogleCloud.Activities,UiPath.AmazonWebServices.Activities - Virtualization & infrastructure:
UiPath.AmazonWorkSpaces.Activities,UiPath.AzureWVD.Activities,UiPath.Citrix.Activities,UiPath.HyperV.Activities - Identity & directory:
UiPath.AzureActiveDirectory.Activities,UiPath.ActiveDirectory.Activities,UiPath.NetIQeDirectory.Activities - IT automation:
UiPath.ExchangeServer.Activities,UiPath.SystemCenter.Activities - Core:
UiPath.System.Activities,UiPath.Testing.Activities,UiPath.UIAutomation.Activities
Completion Output
When you finish a task, report to the user:
- What was done — files created, edited, or deleted (list file paths)
- Validation status — whether all files passed validation (or remaining errors if max retries hit)
- How to run — the
uip rpa run-filecommand to execute the workflow (if applicable) - Next steps — any follow-up actions the user should take (e.g. configure Integration Service connections, add Object Repository elements)