uipath-rpa

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

UiPath RPA Assistant

UiPath RPA 助手

Full assistant for creating, editing, managing, and running UiPath automation projects — both coded workflows (C#) and low-code RPA workflows (XAML).
Reading the referenced files is imperative — read each required file in full. This SKILL.md is a router: it tells you which reference to open, not what it says. When a rule, the Task Navigation table, or a section points you to a reference for the task at hand, open it and read the whole file before acting — do not grep it for a keyword, skim the first screen, fall back to
--help
, or substitute prior knowledge. Exception: files whose rule prescribes a targeted lookup (Grep
^##
for the table of contents, flags via
<command> --help
) — these are catalogs: read the matching sections, never the whole file. Most errors that slip past
validate
and surface at
build
or runtime trace back to a reference that was skipped or only partially read.
用于创建、编辑、管理和运行UiPath自动化项目的全能助手 — 支持代码化工作流(C#)和低代码RPA工作流(XAML)。
必须阅读参考文件 — 完整阅读每个所需文件。 本SKILL.md是一个路由文件:它仅告知你需要打开哪个参考文件,而非文件内容。当规则、任务导航表或某个章节指向与当前任务相关的参考文件时,请打开并完整阅读该文件后再执行操作 — 不要仅通过关键词搜索、浏览首屏内容、依赖
--help
命令或凭已有经验替代。例外情况:规则中规定需定向查找的文件(通过
Grep ^##
查看目录,通过
<command> --help
查看参数)—— 这类文件属于目录型文件:只需阅读匹配的章节,无需通读全文。大多数能通过
validate
但在
build
或运行时暴露的错误,都源于跳过或仅部分阅读了参考文件。

When to Use This Skill

何时使用此技能

  • User wants to create a new UiPath automation project (coded or XAML)
  • User wants to add a workflow, test case, or source file to an existing project
  • User wants to edit an existing workflow or test case
  • User wants to modify project configuration (dependencies, entry points)
  • User asks about UiPath activities or how to automate something
  • User wants to validate, build, run, or debug a workflow
  • User wants to add dependencies or NuGet packages to a project
  • User wants to create test cases with assertions
  • User wants to call an Integration Service connector (Jira, Salesforce, ServiceNow, Slack, etc.)
  • User wants to use UI automation to interact with desktop or web applications
  • 用户想要创建新的UiPath自动化项目(代码化或XAML类型)
  • 用户想要向现有项目添加工作流、测试用例或源文件
  • 用户想要编辑现有工作流或测试用例
  • 用户想要修改项目配置(依赖项、入口点)
  • 用户询问UiPath活动或如何实现某类自动化
  • 用户想要验证、构建、运行或调试工作流
  • 用户想要向项目添加依赖项或NuGet包
  • 用户想要创建带断言的测试用例
  • 用户想要调用集成服务连接器(Jira、Salesforce、ServiceNow、Slack等)
  • 用户想要使用UI自动化与桌面或Web应用交互

UI Automation Capabilities

UI自动化能力

One UIA activity set covers every UI target:
  • Multi-platform — Windows and macOS.
  • Desktop and web — native desktop applications and browsers, driven through the same activities.
  • Resilient targeting — targets are configured with strict or fuzzy selectors (reinforced by anchors), Computer Vision, or semantic matching;
    uia-configure-target
    picks the route and falls back between them automatically.
  • Combined in a single automation — desktop and browser apps interoperate in one workflow with no bridge or handoff. Multi-screen, multi-application flows (read from a desktop app, act in a browser, verify across both) are first-class.
一套UIA活动集可覆盖所有UI目标:
  • 多平台支持 — Windows和macOS系统。
  • 桌面与Web兼容 — 原生桌面应用和浏览器,可通过相同活动驱动。
  • 弹性定位 — 目标可通过严格或模糊选择器(辅以锚点)、计算机视觉或语义匹配进行配置;
    uia-configure-target
    会自动选择合适的方式并在不同方式间 fallback。
  • 单自动化流程内协同 — 桌面和浏览器应用可在同一工作流中交互,无需桥接或切换。多屏幕、多应用流程(从桌面应用读取数据,在浏览器中操作,跨应用验证)是一等公民特性。

UIA Prerequisites

UIA前置条件

Required package:
UiPath.UIAutomation.Activities
— minimum version (
<MIN_VERSION>
):
26.10.2
, from the official UiPath NuGet feed (no prerelease flag needed). The
uip rpa uia
CLI, the package docs, and the UIA skills require
<MIN_VERSION>
or newer — before any UIA work, check the installed version in
project.json
under
dependencies
. Do not hardcode the version from memory; this section is the only source of truth.
Upgrades require explicit user consent. Never install or upgrade UIA silently. Consent comes from one of:
  • Plan-mode: approval of a plan whose Task 0 names the upgrade explicitly — both package ID and version. Plan approval IS the consent — do NOT re-ask at execution time.
  • Interactive mode (no plan): a direct prompt before
    packages install
    runs.
ScenarioBehavior
No UIA installed, request needs UIAAsk before installing
<MIN_VERSION>
from the official UiPath feed.
Major-version upgrade (e.g.
25.x
26.x
)
Ask. Breaking changes are possible across major versions.
Minor / patch / build upgradeAsk before installing the newer build.
Already at or above
<MIN_VERSION>
Proceed without prompting.
Discovery (non-mutating, no consent required):
bash
uip rpa packages versions --package-id UiPath.UIAutomation.Activities --include-prerelease --project-dir "$PROJECT_DIR" --output json
Install / upgrade (mutating — only after consent per the table above):
bash
uip rpa packages install --packages 'id=UiPath.UIAutomation.Activities,version=<MIN_VERSION>' --project-dir "$PROJECT_DIR" --output json
Omit
,version=<MIN_VERSION>
to resolve the latest compatible build (at or above
<MIN_VERSION>
).
必需包:
UiPath.UIAutomation.Activities
— 最低版本(
<MIN_VERSION>
):
26.10.2
,需从官方UiPath NuGet源获取(无需预发布标记)。
uip rpa uia
CLI、包文档和UIA技能均要求
<MIN_VERSION>
或更高版本 — 在进行任何UIA工作前,请检查
project.json
dependencies
中已安装的版本。不要凭记忆硬编码版本;本节内容是唯一的权威来源。
升级需明确获得用户同意。 切勿静默安装或升级UIA包。同意需来自以下任一情况:
  • 计划模式: 用户批准的计划中,任务0明确提及升级内容 — 包括包ID和版本。计划批准即视为同意 — 执行时无需再次询问
  • 交互模式(无计划):
    packages install
    运行前直接向用户提示。
场景行为
未安装UIA,但请求需要UIA询问用户是否从官方UiPath源安装
<MIN_VERSION>
版本。
大版本升级(如
25.x
26.x
询问用户。跨大版本可能存在破坏性变更。
小版本/补丁/构建版本升级询问用户是否安装新版本。
已安装版本等于或高于
<MIN_VERSION>
无需提示,直接继续。
发现操作(非变更操作,无需同意):
bash
uip rpa packages versions --package-id UiPath.UIAutomation.Activities --include-prerelease --project-dir "$PROJECT_DIR" --output json
安装/升级(变更操作 — 仅在符合上表中的同意条件后执行):
bash
uip rpa packages install --packages 'id=UiPath.UIAutomation.Activities,version=<MIN_VERSION>' --project-dir "$PROJECT_DIR" --output json
省略
,version=<MIN_VERSION>
将自动解析为最新兼容版本(等于或高于
<MIN_VERSION>
)。

Precondition: Project Context

前置条件:项目上下文

Before doing any work, check if
.claude/rules/project-context.md
exists in the project directory.
If the file exists → check for staleness:
  1. Read the first line of
    .claude/rules/project-context.md
    to extract the metadata comment:
    <!-- discovery-metadata: cs=N xaml=N deps=N -->
  2. Count current files: Glob
    **/*.cs
    (excluding
    .local/
    and
    .codedworkflows/
    ) and
    **/*.xaml
    in the project directory
  3. Count current dependencies: read
    project.json
    and count keys in the
    .dependencies
    object
  4. Compare the current counts against the stored metadata values
  5. For each count (cs, xaml, deps), compute the percentage difference:
    abs(current - stored) / max(stored, 1) * 100
  6. If any individual count differs by 60–70% or more → run the discovery flow below
  7. If all counts are within the threshold → context is fresh, proceed with the skill workflow
If the file does NOT exist → run the skip gate below; if it does not trip, run the discovery flow.
在进行任何工作前,请检查项目目录中是否存在
.claude/rules/project-context.md
文件。
如果文件存在 → 检查是否过期:
  1. 读取
    .claude/rules/project-context.md
    的第一行,提取元数据注释:
    <!-- discovery-metadata: cs=N xaml=N deps=N -->
  2. 统计当前文件数量:在项目目录中匹配
    **/*.cs
    (排除
    .local/
    .codedworkflows/
    )和
    **/*.xaml
    文件
  3. 统计当前依赖项数量:读取
    project.json
    并统计
    .dependencies
    对象中的键数量
  4. 将当前统计值与存储的元数据值进行比较
  5. 对每个统计值(cs、xaml、deps)计算百分比差异:
    abs(current - stored) / max(stored, 1) * 100
  6. 如果任一统计值差异达到60–70%或更高 → 运行下方的发现流程
  7. 如果所有统计值都在阈值范围内 → 上下文是最新的,继续执行技能工作流
如果文件不存在 → 运行下方的跳过检查;如果未触发,则运行发现流程。

Skip gate: nothing to discover yet

跳过检查:暂无内容可发现

Discovery on a project with no authored content returns empty tables and costs a subagent round-trip. Do NOT spawn the discovery agent when any row matches:
ConditionHow to check
Greenfield — no
project.json
(you are about to create the project)
Step 0 found no
project.json
Empty project — 0 authored workflow filesGlob
**/*.xaml
+
**/*.cs
, excluding dot-directories and
obj/
,
bin/
→ count 0
Freshly scaffolded — only the untouched entry pointCount 1; file is a scaffold entry point (
Main.xaml
process/template,
NewActivity*.xaml
library,
TestCase.xaml
test,
Main.cs
coded); no authored logic — root
Sequence
empty or only
Comment
activities (XAML) / empty
Execute
body (coded)
Gate tripped: write no context files now, proceed with the skill workflow. After the build, write both context files yourself from what you just created — same paths and
AGENTS.md
marker logic as discovery-flow step 3.
Discovery flow (used for both missing and stale context):
  1. Spawn the project discovery agent and wait for it to complete. Its definition lives inside this skill at
    agents/uipath-project-discovery-agent.md
    . Use whichever spawn mechanism your host supports:
    • Host registers plugin agents by name (e.g., Claude Code) → trigger the registered
      uipath-project-discovery-agent
      agent.
    • Host only spawns its own predefined subagents (e.g., UiPath Autopilot) → spawn a subagent and pass it that file (relative to this skill) as its instructions / custom skill. Grant it write access so it can produce the context files itself; a read-only subagent still works via step 3.
  2. The agent writes the context files itself and returns a
    context-files:
    status line followed by the context document. Use the returned document as this session's project context — do NOT re-read the files it just wrote, and do NOT rewrite them.
  3. Only when the agent reports
    context-files: not-written
    (read-only subagent host, or a write error) → write the returned content to both:
    • .claude/rules/project-context.md
      (create
      .claude/rules/
      directory if needed) — auto-loaded by Claude Code in future sessions
    • AGENTS.md
      at project root — the shared cross-agent context convention (read by UiPath Autopilot in Studio Desktop and other AGENTS.md-aware hosts). If
      AGENTS.md
      already exists, look for
      <!-- PROJECT-CONTEXT:START -->
      /
      <!-- PROJECT-CONTEXT:END -->
      markers and replace only between them; if no markers exist, append the fenced block at the end
  4. If the agent returns
    SKIP: <reason>
    instead of a document, treat it as a gate trip: no context files now, write them yourself after the build.
  5. Then proceed with the skill workflow
对没有已编写内容的项目执行发现流程会返回空表格,且会消耗子代理的往返调用。当以下任一条件匹配时,请勿启动发现代理
条件检查方式
全新项目 — 无
project.json
(即将创建项目)
步骤0未找到
project.json
空项目 — 0个已编写的工作流文件匹配
**/*.xaml
+
**/*.cs
,排除点目录和
obj/
bin/
→ 数量为0
刚搭建的项目 — 仅包含未修改的入口点数量为1;文件是搭建好的入口点(
Main.xaml
流程/模板、
NewActivity*.xaml
库、
TestCase.xaml
测试用例、
Main.cs
代码化工作流);无已编写逻辑 — 根
Sequence
为空或仅包含
Comment
活动(XAML)/
Execute
主体为空(代码化)
触发跳过检查:现在无需写入上下文文件,继续执行技能工作流。构建完成后,根据你刚刚创建的内容自行写入两个上下文文件 — 路径和
AGENTS.md
标记逻辑与发现流程步骤3相同。
发现流程(用于上下文缺失或过期的情况):
  1. 启动项目发现代理并等待其完成。代理定义位于本技能的
    agents/uipath-project-discovery-agent.md
    。使用宿主支持的启动机制:
    • 宿主按名称注册插件代理(如Claude Code)→ 触发已注册的
      uipath-project-discovery-agent
      代理。
    • 宿主仅启动预定义的子代理(如UiPath Autopilot)→ 启动子代理并将该文件(相对于本技能的路径)作为其指令/自定义技能。授予其写入权限,以便它能自行生成上下文文件;只读子代理仍可通过步骤3完成操作。
  2. 代理会自行写入上下文文件,并返回包含
    context-files:
    状态行的上下文文档。使用返回的文档作为本次会话的项目上下文 — 不要重新读取它刚刚写入的文件,也不要重写这些文件
  3. 仅当代理返回
    context-files: not-written
    (宿主为只读子代理,或写入错误)时 → 将返回的内容写入两个位置
    • .claude/rules/project-context.md
      (若需则创建
      .claude/rules/
      目录)— 供Claude Code在未来会话中自动加载
    • 项目根目录下的
      AGENTS.md
      — 跨代理共享上下文的约定(供Studio Desktop中的UiPath Autopilot和其他支持AGENTS.md的宿主读取)。如果
      AGENTS.md
      已存在,查找
      <!-- PROJECT-CONTEXT:START -->
      /
      <!-- PROJECT-CONTEXT:END -->
      标记并仅替换标记之间的内容;如果没有标记,则在末尾追加代码块
  4. 如果代理返回
    SKIP: <reason>
    而非文档,则视为触发跳过检查:现在无需写入上下文文件,构建完成后自行写入。
  5. 然后继续执行技能工作流

Step 0: Resolve PROJECT_DIR

步骤0:解析PROJECT_DIR

Before creating or modifying anything, determine which project to work with. See references/environment-setup.md for the full procedure.
Quick check: Find
project.json
to establish
{projectRoot}
. That's it — no Studio Desktop check needed for the standard loop.
uip rpa
auto-launches a headless Studio (UiPath.Studio.Helm NuGet) on first call. Studio Desktop is required only for
files diff
,
focus-activity
, and regenerating coded UI automation's
ObjectRepository.cs
(the
Descriptors.*
class — see Rule 7 and environment-setup.md).
在创建或修改任何内容前,确定要处理的项目。请参阅references/environment-setup.md获取完整流程。
快速检查: 找到
project.json
以确定
{projectRoot}
。仅此而已 — 标准流程无需检查Studio Desktop。
uip rpa
会在首次调用时自动启动无头Studio(UiPath.Studio.Helm NuGet包)。仅在执行
files diff
focus-activity
和重新生成代码化UI自动化的
ObjectRepository.cs
Descriptors.*
类 — 请参阅规则7和environment-setup.md)时才需要Studio Desktop。

Project Type Detection

项目类型检测

After establishing
PROJECT_DIR
, first check
project.json
for
targetFramework
:
  • targetFramework: "Legacy"
    (or field absent in an older project) → Legacy mode.
    Stop here and switch to the Legacy-mode workflow: references/legacy/legacy-mode-guide.md. Legacy projects use the standalone
    uip rpa-legacy
    CLI, .NET Framework 4.6.1, classic activities (no "X" suffix), and
    mscorlib
    assembly references. The rest of this SKILL.md (modern mode) does NOT apply to Legacy projects.
  • targetFramework: "Windows"
    or
    "Portable"
    (Cross-platform) → Modern mode
    , continue below.
For modern projects, determine whether this is a coded or XAML project:
  1. Coded mode
    .cs
    files with
    [Workflow]
    or
    [TestCase]
    attributes exist AND no
    .xaml
    workflow files (beyond scaffolded
    Main.xaml
    )
  2. XAML mode
    .xaml
    workflow files exist AND no coded workflow
    .cs
    files
  3. Hybrid — Both exist → consult coded-vs-xaml-guide.md to pick the right mode for each new file; default to matching the user's current request
  4. New project — Neither exists → default to XAML. Switch to coded only when the user explicitly says "coded", ".cs", "C# workflow", "coded test case", or names a coded-specific trigger (custom data models / DTOs, unit-testable business logic). For all other phrasings ("create a workflow", "automate X", "build an automation"), use XAML. See coded-vs-xaml-guide.md for the full decision flowchart.
Routing: Once mode is determined, use the Task Navigation table below to find the right reference files. For guidance on choosing between coded and XAML approaches, see coded-vs-xaml-guide.md. For Legacy projects, follow references/legacy/legacy-mode-guide.md instead.
确定
PROJECT_DIR
后,首先检查
project.json
中的
targetFramework
  • targetFramework: "Legacy"
    (或旧项目中缺少此字段)→ 旧版模式。
    在此处停止并切换到旧版模式工作流:references/legacy/legacy-mode-guide.md。旧版项目使用独立的
    uip rpa-legacy
    CLI、.NET Framework 4.6.1、经典活动(无"X"后缀)和
    mscorlib
    程序集引用。本SKILL.md的其余内容(现代模式)不适用于旧版项目。
  • targetFramework: "Windows"
    "Portable"
    (跨平台)→ 现代模式
    ,继续下文。
对于现代项目,确定其为代码化还是XAML项目:
  1. 代码化模式 — 存在带
    [Workflow]
    [TestCase]
    属性的
    .cs
    文件,且无
    .xaml
    工作流文件(搭建好的
    Main.xaml
    除外)
  2. XAML模式 — 存在
    .xaml
    工作流文件,且无代码化工作流
    .cs
    文件
  3. 混合模式 — 两者都存在 → 请参阅coded-vs-xaml-guide.md为每个新文件选择合适的模式;默认匹配用户当前的请求
  4. 新项目 — 两者都不存在 → 默认使用XAML。仅当用户明确要求"代码化"、".cs"、"C#工作流"、"代码化测试用例",或指定代码化特定触发条件(自定义数据模型/DTO、可单元测试的业务逻辑)时,才切换到代码化模式。对于其他表述("创建工作流"、"自动化X"、"构建自动化"),均使用XAML。请参阅coded-vs-xaml-guide.md获取完整决策流程图。
路由: 确定模式后,使用下方的任务导航表找到对应的参考文件。如需在代码化和XAML方法之间选择,请参阅coded-vs-xaml-guide.md。对于旧版项目,请遵循references/legacy/legacy-mode-guide.md

Authoring Mode Selection

创作模式选择

Default to matching the project's existing mode. For new projects or ambiguous cases, default to XAML — it is the more common mode, has the widest activity coverage, and is the unmarked term in user vocabulary ("create a workflow" means XAML; "create a coded workflow" means coded). Switch to coded only on explicit user phrasing or a coded-specific trigger from the table below.
ScenarioModeWhy
Standard RPA (Excel, email, file ops)XAML (default)Direct activity support, no code needed
UI automationXAML (default)Full activity support; coded also works via
uiAutomation
service
Integration Service connectors (XAML)XAMLIS connector activities use XAML-specific dynamic activity config
No matching activity for a subtaskCoded fallbackSmall .cs invoked from XAML via
Invoke Workflow File
Complex data transforms, HTTP, parsingCodedC# is more natural than nested XAML activities
Tempted to call a PowerShell scriptCodedPrefer a coded workflow. If PS is genuinely needed (admin cmdlets, existing
.ps1
), use the
InvokePowerShell<T>
activity — never
Invoke Process
+
powershell.exe
. See powershell-interop-guide.md
Custom data models / DTOsCoded Source FileXAML cannot define types — plain
.cs
, no
CodedWorkflow
base
Unit tests with assertionsCoded Test Case
[TestCase]
with Arrange/Act/Assert
User explicitly requests coded/XAMLUser's choiceNever second-guess explicit preference
默认匹配项目现有模式。对于新项目或模糊情况,默认使用XAML — 这是更常见的模式,活动覆盖范围最广,且是用户词汇中的默认术语("创建工作流"指XAML;"创建代码化工作流"指代码化)。仅在用户明确表述或出现下表中的代码化特定触发条件时,才切换到代码化模式。
场景模式原因
标准RPA(Excel、邮件、文件操作)XAML(默认)直接支持活动,无需代码
UI自动化XAML(默认)完整支持活动;代码化模式也可通过
uiAutomation
服务实现
集成服务连接器(XAML)XAMLIS连接器活动使用XAML特定的动态活动配置
子任务无匹配活动代码化 fallback从XAML通过
Invoke Workflow File
调用小型
.cs
文件
复杂数据转换、HTTP请求、解析代码化C#比嵌套XAML活动更自然
倾向于调用PowerShell脚本代码化优先使用代码化工作流。如果确实需要PS(管理命令、现有
.ps1
),请使用
InvokePowerShell<T>
活动 — 切勿使用
Invoke Process
+
powershell.exe
。请参阅powershell-interop-guide.md
自定义数据模型/DTO代码化源文件XAML无法定义类型 — 使用普通
.cs
文件,无需
CodedWorkflow
基类
带断言的单元测试代码化测试用例使用
[TestCase]
属性和Arrange/Act/Assert模式
用户明确要求代码化/XAML用户选择切勿质疑用户的明确偏好

UI Automation Boundaries

UI自动化边界

For any task whose business behavior is "open an app/browser, click, type, scrape visible UI, submit a form, or verify UI state", the interaction layer MUST be UiPath UI Automation —
NApplicationCard
plus UIA activities (XAML), or
uiAutomation.Open
/
Attach
plus Object Repository descriptors (coded). Do NOT substitute
InvokeCode
, PowerShell, Selenium, Playwright, Chrome DevTools Protocol, raw DOM JavaScript, HTTP form posts, or external browser-driver scripts. The coded fallback rows above apply only to non-UI helper logic (data transforms, parsing, DTOs, calculations, API-only integrations).
If target configuration is unavailable, fall back to the documented UIA indication path — never to an external browser automation shortcut.
The full prohibited-tool list, the UIA-only exploration requirement, and the
InvokeJS
/
InjectJsScript
exception scope are in the UIA package guide (
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
) § Mandatory: Generate Targets Before Writing Any UI Code — read it in full per Rule 7 before any UIA work.
对于任何业务行为为"打开应用/浏览器、点击、输入、抓取可见UI、提交表单或验证UI状态"的任务,交互层必须是UiPath UI自动化 — XAML中使用
NApplicationCard
加UIA活动,代码化模式中使用
uiAutomation.Open
/
Attach
加对象库描述符。切勿使用
InvokeCode
、PowerShell、Selenium、Playwright、Chrome DevTools协议、原始DOM JavaScript、HTTP表单提交或外部浏览器驱动脚本替代。上述代码化fallback仅适用于非UI辅助逻辑(数据转换、解析、DTO、计算、仅API集成)。
如果目标配置不可用,请回退到文档化的UIA指示路径 — 切勿使用外部浏览器自动化捷径。
完整的禁用工具列表、仅UIA探索要求以及
InvokeJS
/
InjectJsScript
例外范围,均在UIA包指南(
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
)的§ Mandatory: Generate Targets Before Writing Any UI Code章节中 — 在进行任何UIA工作前,请根据规则7完整阅读该章节。

Placeholder-Selector Stub Pattern (when live app access is unavailable)

占位符选择器存根模式(无实时应用访问时)

When generating a UI automation workflow without live app access (target capture cannot be run because the app is not installed, the agent has no UI, or the user explicitly deferred capture to a developer), emit real UIA activities with placeholder selectors and
TODO Indicate
markers
— never
Log
stubs.
Forbidden: a workflow whose UI-interaction steps are
Log("LoginWorkflow: type username")
with a
// TODO[selectors]:
comment. The workflow passes build/validate and runs cleanly, but does nothing. This is the most expensive kind of stub — it looks complete, the validator says it's fine, and the failure mode is silent.
Required: the real UIA activity (
NTypeInto
,
NClick
,
NGetText
,
NApplicationCard
, etc.) with the target descriptor's selector left as a placeholder string and a
TODO Indicate
marker embedded in the activity's
DisplayName
(XAML) or in a
// TODO[Indicate]
comment immediately adjacent to the coded call. A developer opens Studio, clicks Indicate on each marked activity, and the workflow runs.
This applies to both XAML and coded modes. The full pattern with XAML and coded examples is in uia-starter-guide.md § Placeholder-Selector Stub Pattern — read it before authoring stub-mode workflows. It requires no UIA package or CLI.
Hybrid pattern — XAML orchestration + coded fallback for logic with no matching activity:
Main.xaml                  ← orchestration (XAML)
  └── InvokeWorkflowFile → ProcessData.cs  ← coded logic
For the full decision flowchart, InvokeCode extraction rules, and detailed hybrid patterns, see coded-vs-xaml-guide.md.
无实时应用访问时生成UI自动化工作流(因应用未安装、代理无UI或用户明确将捕获延迟给开发人员而无法运行目标捕获),请生成带占位符选择器和
TODO Indicate
标记的真实UIA活动
— 切勿使用
Log
存根。
禁止: 工作流的UI交互步骤为
Log("LoginWorkflow: type username")
并附带
// TODO[selectors]:
注释。此类工作流可通过build/validate并正常运行,但实际无任何操作。这是最昂贵的存根类型 — 它看起来完整,验证器显示正常,但失败模式是静默的。
要求: 使用真实的UIA活动(
NTypeInto
NClick
NGetText
NApplicationCard
等),将目标描述符的选择器留为占位符字符串,并在活动的
DisplayName
(XAML)中嵌入
TODO Indicate
标记,或在代码化调用紧邻处添加
// TODO[Indicate]
注释。开发人员打开Studio后,点击每个标记活动的Indicate按钮,即可运行工作流。
此模式适用于XAML和代码化两种模式。包含XAML和代码化示例的完整模式,请参阅uia-starter-guide.md § Placeholder-Selector Stub Pattern — 在创作存根模式工作流前请阅读该章节。此模式无需UIA包或CLI。
混合模式 — XAML编排 + 代码化fallback处理无匹配活动的逻辑:
Main.xaml                  ← 编排(XAML)
  └── InvokeWorkflowFile → ProcessData.cs  ← 代码化逻辑
如需完整决策流程图、InvokeCode提取规则和详细混合模式,请参阅coded-vs-xaml-guide.md

Capture-First Fast Path

捕获优先快速路径

When the request is "automate this dialog/form" or "build a UI test from these manual steps" — i.e. the bulk of the work is target capture, not coding — defer authoring-phase prerequisites until target capture is complete. The capture surface is interactive, app-state-sensitive, and time-bound; project-context discovery adds nothing during capture and steals time from it.
Fast-path order for capture-first tasks. Read the UIA package guide (
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
) in full first (Rule 7) — it mandates the target-capture orchestration reference used in step 3. Then:
  1. Pre-flight Window Baseline — list top-level windows once; decide whether to launch the app (package guide § Window Baseline).
  2. Inventory targets from manual steps (Test Manager test case, PDD, or written script). Each "Click X" / "Enter Y" / "Select Z" / "Verify W" step maps to one OR element. Group by screen state (package guide § Capturing from Manual Test Steps).
  3. Capture all targets screen by screen via
    uia-configure-target
    and screen advancement (package guide § Multi-Step UI Flows).
  4. Then enter authoring phase: project-context discovery (the precondition above), write code, validate.
Skip this path when the task has no UI surface (data transforms, IS connector calls, headless file/email automation). Also skip it when the task HAS a UI surface but no live app to capture against (app not installed, no GUI, capture deferred to a developer) — there is nothing to capture, so use the § Placeholder-Selector Stub Pattern above instead. The Window Baseline does not tell you if the app is installed and has a GUI — validate that separately (e.g. look for the executable on disk) or ask the user.
当请求为"自动化此对话框/表单"或"根据这些手动步骤构建UI测试"时 — 即工作重点为目标捕获而非编码 — 将创作阶段的前置条件延迟到目标捕获完成后。捕获界面是交互式的、依赖应用状态且有时间限制;项目上下文发现对捕获无帮助,还会占用捕获时间。
捕获优先任务的快速路径顺序。首先完整阅读UIA包指南(
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
)(规则7)— 它规定了步骤3中使用的目标捕获编排参考。然后:
  1. 预飞窗口基线 — 列出一次顶级窗口;决定是否启动应用(包指南§ Window Baseline)。
  2. 从手动步骤盘点目标(测试管理器测试用例、PDD或书面脚本)。每个"点击X" / "输入Y" / "选择Z" / "验证W"步骤对应一个OR元素。按屏幕状态分组(包指南§ Capturing from Manual Test Steps)。
  3. 逐屏捕获所有目标 — 通过
    uia-configure-target
    和屏幕推进(包指南§ Multi-Step UI Flows)。
  4. 然后进入创作阶段: 项目上下文发现(上述前置条件)、编写代码、验证。
当任务无UI界面(数据转换、IS连接器调用、无头文件/邮件自动化)时,跳过此路径。当任务有UI界面但无实时应用可捕获(应用未安装、无GUI、捕获延迟给开发人员)时,也跳过此路径 — 无内容可捕获,因此请使用上述§ Placeholder-Selector Stub Pattern。窗口基线无法告知你应用是否已安装且有GUI — 需单独验证(如查找磁盘上的可执行文件)或询问用户。

Session Pre-warm

会话预预热

First heavy
uip rpa
call pays a ~22s Studio host cold-start (shared across
validate
/
build
/
run
/
activities get-default-xaml
/
analyzer-rules list
). When more than one is expected this session, background a cheap warm-up at session start so the tax hides behind planning:
bash
uip rpa activities find --query log --output json > /dev/null 2>&1 &
On Windows PowerShell,
&
doesn't background — use
Start-Process powershell.exe -ArgumentList ...
(not
pwsh
). Never
Start-Process -FilePath "uip"
(or any
.ps1
): Windows opens it in Notepad, not PowerShell.
Skip when 0 or 1 heavy
uip rpa
calls are expected (read-only Q&A, single-file inspection) — the warm-up doesn't reclaim its cost.
首次调用
uip rpa
会产生约22秒的Studio主机冷启动时间(
validate
/
build
/
run
/
activities get-default-xaml
/
analyzer-rules list
共享此时间)。当预计本次会话会多次调用时,在会话开始时后台执行一次低成本的预热操作,以便将冷启动时间隐藏在规划过程中:
bash
uip rpa activities find --query log --output json > /dev/null 2>&1 &
在Windows PowerShell中,
&
无法后台执行 — 请使用
Start-Process powershell.exe -ArgumentList ...
(不要使用
pwsh
)。切勿使用
Start-Process -FilePath "uip"
(或任何
.ps1
):Windows会在记事本中打开它,而非PowerShell。
跳过预热:当预计本次会话仅会调用0次或1次
uip rpa
(只读问答、单文件检查)时 — 预热无法收回其成本。

Critical Rules

关键规则

Rule numbering. Common Rules use 1–12.
### Coded-Specific Rules
continues 13–19.
### XAML-Specific Rules
is an independent 16–24 sequence, so numbers 16/17/18/19 appear in both mode-specific sections — the
[Coded]
/
[XAML]
prefix on each rule disambiguates. Cross-references in this file ("Common Rule 10", "Common Rule 12", "Rule 21", "Rule 24") always point to a uniquely-numbered rule.
规则编号。通用规则使用1–12。
### Coded-Specific Rules
继续13–19。
### XAML-Specific Rules
是独立的16–24序列,因此编号16/17/18/19会出现在两个模式特定章节中 — 每个规则前的
[Coded]
/
[XAML]
前缀用于区分。本文件中的交叉引用("通用规则10"、"通用规则12"、"规则21"、"规则24")始终指向唯一编号的规则。

Common Rules (Both Modes)

通用规则(两种模式)

  1. NEVER create a project without confirming none exists. Follow Step 0 resolution: check explicit path, project name, then CWD for
    project.json
    . Only create when confirmed no project matches AND user explicitly requests creation.
  2. ALWAYS use
    uip rpa init
    to create new projects — never write
    project.json
    or scaffolding manually.
    • Before creating, decide if a template is needed. If the user names a template ("REFramework", "Robotic Enterprise Framework", "based on the X template"), an industry/domain pattern (SAP, ERP, banking, mainframe), or otherwise hints at a non-blank starter, run
      uip rpa templates search --query "<term>" --output json
      first. Selection rule against
      Data[*]
      :
      • User named a specific non-Official template (e.g. "Enhanced REFramework", "Lite ReFrameWork") AND a
        Marketplace
        item's
        title
        or
        packageId
        substring-matches the user's specific qualifier → ask the user (Official + that Marketplace item are both candidates). Do NOT auto-pick.
      • Exactly one
        source == "Official"
        match AND user did not name a non-Official template
        → use it; pass
        --template-package-id <packageId> --template-package-version <version>
        to
        init
        . Proceed without asking.
      • Multiple
        Official
        matches OR only
        Marketplace
        matches
        → present candidates (
        packageId
        ,
        version
        ,
        source
        ,
        title
        ) to the user and ask which to use. Never silently pick a Marketplace template.
      • No matches → fall back to a built-in
        --template-id
        and tell the user nothing was found.
    • Built-in
      --template-id
      keywords map without a search:
      library
      LibraryProcessTemplate
      ,
      test automation
      /
      test project
      TestAutomationProjectTemplate
      , otherwise
      BlankTemplate
      . When
      --template-package-id
      is set,
      --template-id
      is ignored. Full decision flow: environment-setup.md § Template selection. 2a. Pass
      --target-framework
      AND
      --expression-language
      explicitly on every
      uip rpa init
      — never omit them.
      Both are immutable after creation (Rule 23); omitting
      --target-framework
      silently yields a Windows project. Choose framework by where the automation runs: cross-platform / non-Windows runtime (Linux, container, serverless) or Studio Web editing →
      Portable
      (Cross-platform); Windows runtime using Windows-only capabilities (Excel COM, classic Office, WPF /
      PresentationFramework
      , Windows-only UIA) or Studio Desktop as the edit surface →
      Windows
      (not editable in Studio Web). A request needing both a cross-platform runtime and a Windows-only capability is contradictory — surface it, don't silently pick. Windows - Legacy is a last resort (explicit ask or hard .NET 4.6.1 need; never inferred from VB.NET or non-"X" classic activities) — create it in Legacy mode, not modern
      init
      . No signal →
      AskUserQuestion
      (Windows vs Cross-platform), framed around the runtime host.
      --expression-language
      : default
      VisualBasic
      ,
      CSharp
      only on explicit request.
  3. Phase-gated validation. Two-phase validation:
    • Per-file (after every create or edit):
      uip rpa validate --file-path "<FILE>" --project-dir "<PROJECT_DIR>" --output json
      until 0 errors. Catches structural XAML, missing references, analyzer-rule violations, schema violations. Fix one thing per iteration.
    • Project-level build (after per-file
      validate
      is clean across all files in the edit session, and before declaring done):
      uip rpa build "<PROJECT_DIR>" --output json
      until clean. Catches what
      validate
      misses (unknown members, invalid enums, CacheMetadata / member resolution, attribute-form C# JIT) — full list at cli-reference.md § Errors
      build
      catches that
      validate
      misses
      . If
      build
      errors, identify the offending file from the output and re-run
      validate --file-path
      on it.
    • 5-attempt cap per loop — 5 attempts for each file's per-file
      validate
      loop; a separate 5 attempts for the project-level
      build
      loop. Fix one root cause per iteration.
    • Smoke-test shortcut: A successful
      uip rpa run
      substitutes for the standalone end-of-session
      build
      run
      compiles internally. Prefer
      run --skip-build
      when
      build
      has just passed; see cli-reference.md § Smoke Test.
    • Do NOT run
      uip rpa analyzer-rules list
      as an authoring prerequisite.
      validate
      and
      build
      already enforce the enabled analyzer rules and report violations with rule IDs and recommendations — pre-fetching the rule list is speculative cost (the unscoped call can take a minute or more). It is an on-demand command: run it when the user asks about the project's best-practice/analyzer rules, or when repeated violations of the same rule family suggest authoring against the full rule set. See cli-reference.md § analyzer-rules list.
    See cli-reference.md § Validation Iteration Loop.
  4. ALWAYS bring every touched file to per-file
    validate
    clean AND verify the project builds before declaring done.
    Cadence per Rule 18: batch-author, then validate. Project-level
    build
    runs once at the end of the edit session (or at any compile-verification gate) — not after every Edit, because
    build
    is project-scoped and rebuilds the entire project regardless of which file changed.
    validate
    clean alone is not "validated"; it cannot see member or enum errors — the project-level
    build
    is mandatory before declaring done. And a clean gate is not runtime proof — for observable-output workflows, end the gate with one
    run
    and check outputs (execution-maps-guide.md § Gate ≠ runtime proof). See cli-reference.md § Validation Iteration Loop.
  5. Prefer UiPath built-in activities for Orchestrator integration, UI automation, and document handling. Prefer plain .NET / third-party packages for pure data transforms, HTTP calls, parsing.
  6. ALWAYS ensure required package dependencies are in
    project.json
    before using their activities or services. 6a. Pre-edit verification gate. Two authoring actions are hard to roll back once
    build
    fails — verify before serialization, not after.
    • Removing a dependency — grep the project for usages before deleting an entry. A package may be the sole supplier of an activity used elsewhere (
      MergePDFs
      lives in the IntelligentOCR.StudioWeb family).
    • Writing a new activity tag — confirm via
      uip rpa activities find --query "<verb>" --output json
      and use the returned
      ClassName
      . Do not derive tag names from Studio display names. See common-pitfalls.md § Common Activity Name Confusions.
  7. [UIA] Before writing ANY UIA activity (XAML
    <uix:N*>
    or coded
    uiAutomation.*
    /
    Descriptors.*
    ), MUST read references/uia-starter-guide.md IN FULL, and the UIA package's authoring guide it mandates (
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
    ) IN FULL
    — including the mode-specific section (For Coded Workflows or For XAML Workflows). No exceptions for "simple" UIs. Skipping this rule is the most common cause of hallucinated selectors, wrong target XML, and missing OR descriptors. NEVER hand-write selectors — use
    uia-configure-target
    exclusively (the package guide explains how). The package guide exists only after the package is installed — verify § UIA Prerequisites first (Rule 7a); if the package is installed but the guide file is absent, the installed version predates it — treat as below the minimum version. The starter guide owns the skill-side UIA policies: run/debug procedure + runtime selector recovery, the stub-mode deliverable pattern, and UI Library publishing. 7a. [UIA] Verify UIA prerequisites before invoking
    uia-configure-target
    .
    The minimum version and the prerequisite check live in § UIA Prerequisites (top of this file) — run that check first (do not hardcode the version from memory; that section is the only source of truth). If
    UiPath.UIAutomation.Activities
    is below the minimum or
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
    is absent (Rule 7 treats a missing guide as below-minimum), the
    uip rpa uia
    CLI is unavailable — and both target capture and indication depend on it, so indication is not a fallback when the package itself is missing. Ask the user to install/upgrade per § UIA Prerequisites. If they decline or the package cannot be installed, fall back to the Placeholder-Selector Stub Pattern (§ above) — real activities with
    TODO Indicate
    markers need no CLI. Never silently route to a non-existent skill path. Use indication capture only when a compatible UIA package is installed but
    uia-configure-target
    cannot see the element; record
    UI capture: indication-only
    in the plan header to skip
    uia-configure-target
    in that case. Runtime failure counts too: when the package is present but the UIA snapshot CLI's live scans fail persistently (driver/COM errors on every scan), first rule out a locked or non-interactive Windows session (
    LogonUI
    running = lock screen) — that needs an unlock, not a fallback. Only if scans still fail on an unlocked interactive session, treat capture as unavailable and use the Placeholder-Selector Stub Pattern.
  8. Use
    --output json
    on all CLI commands whose output is parsed programmatically. 8a.
    run
    /
    debug start
    success/failure verdict comes from the outer
    Result
    (and equivalently the inner
    HasErrors
    ), NEVER from any log entry's
    Level
    .
    A successful workflow may emit
    Log Message
    activities at
    Error
    or
    Warning
    level as observability — those are workflow-emitted data, not CLI failures. Compile failures, validation failures, and unhandled runtime exceptions all flip
    HasErrors
    and propagate to the outer
    Result
    . Treating log-entry levels as a failure signal flips green runs to "failed" and burns retries on healthy workflows. In a debug session, check
    DebugState
    first — a
    Suspended
    response means an exception awaits your decision (continue / retry / ignore / cancel) while
    HasErrors
    is still
    false
    . See cli-reference.md § run and debugging.md § Reading Debug Output Effectively.
  9. For "leverage / reuse / find shared libraries" requests, search the tenant feed — not the local filesystem, NuGet.org, or keyword-permutation loops. Run
    uip or libraries list --limit 500 --output-filter "<JMESPath>" --output json
    . On zero results from the filtered call, take the fallback branch — do not re-keyword. Skip when an SDD already records §16 "Shared libraries referenced" or the user has said "no shared libraries" earlier in the session. See tenant-library-search-guide.md for the full procedure.
  10. Register every test case file in
    project.json
    designOptions.fileInfoCollection
    .
    Applies to both XAML and coded test cases. Required keys, GUID format, JSON snippet, and full schema (including
    dataVariationFilePath
    for data-driven and
    publishAsTestCase
    for coded): references/testing-guide.md § project.json Registration and assets/json-template.md.
  11. Test case structure: Given-When-Then. Applies to both XAML and coded test cases. See references/testing-guide.md § XAML Test Case Structure for the canonical patterns (the section's lead also points to the coded variant in
    coded/operations-guide.md
    ).
  12. Trigger activity placement. Two trigger types — identify from
    uip rpa activities find --query "<event>" --output json
    by reading
    isTrigger
    and
    triggerType
    . Placement rules differ.
    Integration triggers (
    isTrigger: true
    ,
    triggerType: "integration"
    ) — strict placement. MUST be the first activity of
    Main.xaml
    's root
    Sequence
    ; CANNOT be placed inside
    ui:TriggerScope
    . Bind
    Result
    to a workflow-scope variable; the rest of the
    Sequence
    is the handler. Connection asset (
    ConnectionId
    ) required for IS-based
    triggers (Mail / GSuite / O365 / Salesforce / Jira / Slack / ServiceNow / any
    *.IntegrationService.Activities
    package); not required for Orchestrator-native triggers (
    TimeTrigger
    ,
    QueueTrigger
    ,
    ManualTrigger
    ).
    Local triggers (
    isTrigger: true
    ,
    triggerType: "local"
    ) — flexible placement. Place EITHER as the first activity of
    Main.xaml
    's root
    Sequence
    (Orchestrator dispatches a fresh job per event) OR inside
    <ui:TriggerScope.Triggers>
    with handler in
    <ui:TriggerScope.Action>
    (robot stays alive while the scope is active; trigger fires in-process). Both placements are valid — choose by runtime model. No connection asset required.
    Unknown
    triggerType
    (forward-compat — e.g. a future
    "scheduled"
    ) → read the bundled doc and ask the user. Do not assume placement.
    Reading existing XAML: activity inside
    <ui:TriggerScope.Triggers>
    must be a local trigger; an integration trigger there is broken — flag to the user. Activity at workflow root can be either type — check
    triggerType
    to disambiguate.
    See trigger-pattern-guide.md for worked examples, the
    SchedulingMode
    reference, the catalog of trigger activities, and the procedure for editing existing
    ui:TriggerScope
    workflows.
  1. 创建项目前必须确认不存在现有项目。遵循步骤0的解析流程:检查明确路径、项目名称,然后检查当前工作目录中的
    project.json
    。仅当确认无匹配项目且用户明确要求创建时,才可创建项目。
  2. **必须使用
    uip rpa init
    **创建新项目 — 切勿手动编写
    project.json
    或搭建项目结构。
    • 创建前,决定是否需要模板。如果用户指定模板("REFramework"、"Robotic Enterprise Framework"、"基于X模板")、行业/领域模式(SAP、ERP、银行、大型机),或暗示需要非空白启动模板,请先运行
      uip rpa templates search --query "<term>" --output json
      。针对
      Data[*]
      的选择规则:
      • 用户指定了特定的非官方模板(如"Enhanced REFramework"、"Lite ReFrameWork"),且
        Marketplace
        项的
        title
        packageId
        包含用户指定的限定词 → 询问用户(官方模板和该Marketplace项均为候选)。切勿自动选择。
      • 恰好有一个
        source == "Official"
        匹配项,且用户未指定非官方模板
        → 使用该模板;将
        --template-package-id <packageId> --template-package-version <version>
        传递给
        init
        。无需询问,直接继续。
      • 多个
        Official
        匹配项或仅
        Marketplace
        匹配项
        → 向用户展示候选项(
        packageId
        version
        source
        title
        )并询问使用哪个。切勿静默选择Marketplace模板。
      • 无匹配项 → 回退到内置
        --template-id
        并告知用户未找到匹配模板。
    • 内置
      --template-id
      关键字无需搜索即可映射:
      library
      LibraryProcessTemplate
      test automation
      /
      test project
      TestAutomationProjectTemplate
      ,否则为
      BlankTemplate
      。当设置
      --template-package-id
      时,
      --template-id
      会被忽略。完整决策流程:environment-setup.md § Template selection。 2a. 每次
      uip rpa init
      必须显式传递
      --target-framework
      --expression-language
      — 切勿省略
      。两者创建后均不可变(规则23);省略
      --target-framework
      会默认创建Windows项目。根据自动化运行位置选择框架:跨平台/非Windows运行时(Linux、容器、无服务器)或Studio Web编辑 →
      Portable
      (跨平台);使用Windows专属功能(Excel COM、经典Office、WPF /
      PresentationFramework
      、Windows专属UIA)的Windows运行时,或使用Studio Desktop作为编辑界面 →
      Windows
      (不可在Studio Web中编辑)。如果请求同时需要跨平台运行时和Windows专属功能,则存在矛盾 — 需向用户说明,切勿静默选择。Windows - Legacy是最后选择(明确要求或必须使用.NET 4.6.1;切勿从VB.NET或非"X"经典活动推断)— 在旧版模式中创建,而非使用现代
      init
      。无信号时 →
      AskUserQuestion
      (Windows vs 跨平台),围绕运行时宿主进行说明。
      --expression-language
      :默认
      VisualBasic
      ,仅在明确要求时使用
      CSharp
  3. 分阶段验证。两阶段验证:
    • 单文件验证(每次创建或编辑后):
      uip rpa validate --file-path "<FILE>" --project-dir "<PROJECT_DIR>" --output json
      ,直到无错误。捕获结构性XAML错误、缺失引用、分析器规则违规、架构违规。每次迭代修复一个问题。
    • 项目级构建(编辑会话中所有文件的单文件
      validate
      均通过后,且在宣布完成前):
      uip rpa build "<PROJECT_DIR>" --output json
      ,直到无错误。捕获
      validate
      未发现的问题(未知成员、无效枚举、CacheMetadata / 成员解析、属性形式的C# JIT)— 完整列表请参阅cli-reference.md § Errors
      build
      catches that
      validate
      misses
      。如果
      build
      出错,从输出中找出有问题的文件并重新运行
      validate --file-path
    • 每次循环最多尝试5次 — 每个文件的单文件
      validate
      循环最多尝试5次;项目级
      build
      循环单独最多尝试5次。每次迭代修复一个根本原因。
    • 冒烟测试捷径: 成功执行
      uip rpa run
      可替代会话结束时的独立
      build
      run
      会在内部编译。当
      build
      刚通过时,优先使用
      run --skip-build
      ;请参阅cli-reference.md § Smoke Test
    • 切勿将
      uip rpa analyzer-rules list
      作为创作前置条件
      validate
      build
      已强制执行启用的分析器规则,并会报告带有规则ID和建议的违规情况 — 预获取规则列表是推测性成本(无范围的调用可能需要一分钟或更长时间)。这是一个按需命令:当用户询问项目的最佳实践/分析器规则,或同一规则家族重复违规表明需根据完整规则集进行创作时,才运行它。请参阅cli-reference.md § analyzer-rules list
    请参阅cli-reference.md § Validation Iteration Loop
  4. 宣布完成前,必须确保所有修改的文件通过单文件
    validate
    并验证项目可构建
    。根据规则18的节奏:批量创作,然后验证。项目级
    build
    在编辑会话结束时运行一次(或在任何编译验证检查点)— 并非每次编辑后都运行,因为
    build
    是项目范围的,无论哪个文件更改都会重新构建整个项目。仅
    validate
    通过并不代表"已验证";它无法检测成员或枚举错误 — 项目级
    build
    是宣布完成前的强制步骤。通过检查并不代表运行时无问题 — 对于有可观察输出的工作流,检查结束时需执行一次
    run
    并检查输出(execution-maps-guide.md § Gate ≠ runtime proof)。请参阅cli-reference.md § Validation Iteration Loop
  5. 优先使用UiPath内置活动进行Orchestrator集成、UI自动化和文档处理。对于纯数据转换、HTTP请求、解析,优先使用普通.NET/第三方包。
  6. 使用活动或服务前,必须确保所需包依赖项已在
    project.json
    。 6a. 编辑前验证检查。有两种创作操作在
    build
    失败后难以回滚 — 请在序列化前验证,而非之后。
    • 移除依赖项 — 删除条目前,在项目中搜索其用法。某个包可能是其他地方使用的活动的唯一提供者(
      MergePDFs
      属于IntelligentOCR.StudioWeb家族)。
    • 编写新活动标签 — 通过
      uip rpa activities find --query "<verb>" --output json
      确认并使用返回的
      ClassName
      。切勿从Studio显示名称推导标签名称。请参阅common-pitfalls.md § Common Activity Name Confusions
  7. [UIA] 在编写任何UIA活动(XAML
    <uix:N*>
    或代码化
    uiAutomation.*
    /
    Descriptors.*
    )前,必须完整阅读references/uia-starter-guide.md,以及它规定的UIA包创作指南(
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
    — 包括模式特定章节(For Coded Workflows或For XAML Workflows)。"简单"UI也不例外。跳过此规则是产生幻觉选择器、错误目标XML和缺失OR描述符的最常见原因。切勿手动编写选择器 — 仅使用
    uia-configure-target
    (包指南解释了如何使用)。包指南仅在包安装后存在 — 请先验证§ UIA Prerequisites(规则7a);如果已安装包但指南文件缺失,则安装的版本早于指南版本 — 视为低于最低版本。入门指南负责技能端的UIA策略:运行/调试流程 + 运行时选择器恢复、存根模式交付物模式和UI库发布。 7a. [UIA] 调用
    uia-configure-target
    前,验证UIA前置条件
    。最低版本和前置条件检查位于§ UIA Prerequisites(本文件顶部)— 请先运行该检查(不要凭记忆硬编码版本;本节是唯一权威来源)。如果
    UiPath.UIAutomation.Activities
    版本低于最低版本,或
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
    缺失(规则7将缺失指南视为低于最低版本),则
    uip rpa uia
    CLI不可用 — 且目标捕获和指示都依赖它,因此当包本身缺失时,指示并非fallback选项。请要求用户根据§ UIA Prerequisites安装/升级。如果用户拒绝或无法安装包,请回退到Placeholder-Selector Stub Pattern(上述章节)— 带
    TODO Indicate
    标记的真实活动无需CLI。切勿静默路由到不存在的技能路径。仅当已安装兼容UIA包但
    uia-configure-target
    无法看到元素时,才使用指示捕获;在计划标题中记录
    UI capture: indication-only
    ,以便在该情况下跳过
    uia-configure-target
    运行时失败也需考虑: 当包存在但UIA快照CLI的实时扫描持续失败(每次扫描都出现驱动/COM错误)时,首先排除锁定或非交互式Windows会话(
    LogonUI
    运行 = 锁屏)— 这需要解锁,而非fallback。仅当在已解锁的交互式会话中扫描仍失败时,才视为捕获不可用并使用Placeholder-Selector Stub Pattern。
  8. 所有输出需被程序化解析的CLI命令,请使用
    --output json
    。 8a.
    run
    /
    debug start
    的成功/失败判断来自外部
    Result
    (等效于内部
    HasErrors
    ),而非任何日志条目的
    Level
    。成功的工作流可能会以
    Error
    Warning
    级别输出
    Log Message
    活动作为可观察性数据 — 这些是工作流输出的数据,而非CLI失败。编译失败、验证失败和未处理的运行时异常都会翻转
    HasErrors
    并传播到外部
    Result
    。将日志条目级别视为失败信号会将成功运行标记为"失败",并在健康工作流上浪费重试次数。在调试会话中,请先检查
    DebugState
    Suspended
    响应表示存在异常等待你的决策(继续/重试/忽略/取消),而此时
    HasErrors
    仍为
    false
    。请参阅cli-reference.md § rundebugging.md § Reading Debug Output Effectively
  9. 对于"利用/复用/查找共享库"请求,请搜索租户源 — 而非本地文件系统、NuGet.org或关键词排列循环。运行
    uip or libraries list --limit 500 --output-filter "<JMESPath>" --output json
    。如果过滤调用无结果,则执行回退分支 — 不要重新调整关键词。当SDD已记录§16 "Shared libraries referenced",或用户在会话早期表示"无共享库"时,跳过此步骤。请参阅tenant-library-search-guide.md获取完整流程。
  10. project.json
    designOptions.fileInfoCollection
    中注册每个测试用例文件
    。适用于XAML和代码化测试用例。必填键、GUID格式、JSON片段和完整架构(包括数据驱动的
    dataVariationFilePath
    和代码化的
    publishAsTestCase
    ):请参阅references/testing-guide.md § project.json Registrationassets/json-template.md
  11. 测试用例结构:Given-When-Then。适用于XAML和代码化测试用例。请参阅references/testing-guide.md § XAML Test Case Structure获取标准模式(该章节开头还指向
    coded/operations-guide.md
    中的代码化变体)。
  12. 触发活动放置。两种触发类型 — 通过
    uip rpa activities find --query "<event>" --output json
    读取
    isTrigger
    triggerType
    进行识别。放置规则不同。
    集成触发器
    isTrigger: true
    triggerType: "integration"
    )— 严格放置。必须是
    Main.xaml
    Sequence
    的第一个活动;不能放置在
    ui:TriggerScope
    内。将
    Result
    绑定到工作流范围变量;
    Sequence
    的其余部分是处理程序。基于IS的触发器(邮件/GSuite/O365/Salesforce/Jira/Slack/ServiceNow/任何
    *.IntegrationService.Activities
    包)需要连接资产(
    ConnectionId
    );Orchestrator原生触发器(
    TimeTrigger
    QueueTrigger
    ManualTrigger
    )不需要。
    本地触发器
    isTrigger: true
    triggerType: "local"
    )— 灵活放置。可放置为
    Main.xaml
    Sequence
    的第一个活动(Orchestrator为每个事件调度新作业),或放置在
    <ui:TriggerScope.Triggers>
    内并在
    <ui:TriggerScope.Action>
    中设置处理程序(机器人在范围活动期间保持存活;触发在进程内执行)。两种放置方式均有效 — 根据运行时模型选择。无需连接资产。
    未知
    triggerType
    (向前兼容 — 如未来的
    "scheduled"
    )→ 阅读捆绑文档并询问用户。切勿假设放置方式。
    读取现有XAML:
    <ui:TriggerScope.Triggers>
    内的活动必须是本地触发器;集成触发器放置在此处会导致损坏 — 需向用户标记。工作流根的活动可以是任意类型 — 检查
    triggerType
    进行区分。
    请参阅trigger-pattern-guide.md获取示例、
    SchedulingMode
    参考、触发活动目录以及编辑现有
    ui:TriggerScope
    工作流的流程。

Destination Preflight (Both Modes)

目标预检查(两种模式)

Studio Web destination → Solution-wrapped deliverable, not a bare project. Studio Web ingests Solutions only; a bare project folder is invisible in both SW workspace tabs. Treat these phrases as SW signals in the request: "Studio Web", "SW", "upload to web", "browser editor", "cloud workspace edit". On match, build the RPA project normally per the rest of this skill, then hand off to
uipath-solution
to wrap and ship it:
uip solution init <NAME>
uip solution projects import "<PROJECT_DIR>" --solutionFile <SOLUTION>.uipx
uip solution upload "<SOLUTION_DIR>"
. The final deliverable is the Solution, not the bare project folder. Local execution (
uip rpa run
) and the Orchestrator package flow (
uip rpa pack
uip or packages upload
— there is no
uip rpa publish
) are fine with a bare project — only an SW destination changes the deliverable shape.
Studio Web目标 → 解决方案打包的交付物,而非裸项目。Studio Web仅接收解决方案;裸项目文件夹在SW工作区标签中不可见。请求中的以下表述视为SW信号:"Studio Web"、"SW"、"上传到Web"、"浏览器编辑器"、"云工作区编辑"。匹配时,先按照本技能的其余内容正常构建RPA项目,然后交给
uipath-solution
进行打包和交付:
uip solution init <NAME>
uip solution projects import "<PROJECT_DIR>" --solutionFile <SOLUTION>.uipx
uip solution upload "<SOLUTION_DIR>"
。最终交付物是解决方案,而非裸项目文件夹。本地执行(
uip rpa run
)和Orchestrator包流程(
uip rpa pack
uip or packages upload
— 无
uip rpa publish
命令)支持裸项目 — 只有SW目标会改变交付物形态。

Execution Discipline (Both Modes)

执行规范(两种模式)

Run to completion — do not declare work done while plan tasks remain. If a plan file exists at
docs/plans/*.md
referenced by this request (or discoverable there for this feature), read its header before acting and during every checkpoint.
  • If the header has
    Execution autonomy: autonomous
    : continue until ALL plan task checkboxes are
    [x]
    OR a concrete item from the plan's
    Stop conditions
    section is hit.
  • If the header has
    Execution autonomy: interactive
    , or no plan file exists: use judgment and confirm with the user on material decisions.
  • Before declaring the task done, re-read the plan and enumerate any unchecked boxes. If unchecked tasks remain and no Stop condition was hit, keep going — do not summarize partial work as "Done".
  • "Feels expensive", "many tool calls used", "natural pause point", "partial result looks usable", and "too complex to continue in one session" are NOT Stop conditions. Only the concrete hard blockers in the plan's
    Stop conditions
    section count.
  • Plan decisions already made are authoritative. Do not
    AskUserQuestion
    about structure, file count, selector strategy, or capture approach when the plan specifies them — those questions belonged to the planner.
运行至完成 — 计划任务未完成时切勿宣布工作完成。如果本次请求引用了
docs/plans/*.md
中的计划文件(或可在此处找到针对此功能的计划文件),请在执行前和每个检查点阅读其标题。
  • 如果标题包含
    Execution autonomy: autonomous
    :继续执行,直到所有计划任务复选框为
    [x]
    ,或触发计划的
    Stop conditions
    部分中的具体项。
  • 如果标题包含
    Execution autonomy: interactive
    ,或无计划文件:自行判断并在重大决策时与用户确认。
  • 宣布任务完成前,请重新阅读计划并列出所有未勾选的复选框。如果未勾选的任务仍存在且未触发停止条件,请继续执行 — 切勿将部分工作总结为"已完成"。
  • "感觉成本高"、"使用了很多工具调用"、"自然暂停点"、"部分结果看起来可用"和"太复杂无法在一个会话中继续"不是停止条件。只有计划的
    Stop conditions
    部分中的具体硬阻塞项才算停止条件。
  • 已做出的计划决策具有权威性。当计划指定了结构、文件数量、选择器策略或捕获方法时,切勿
    AskUserQuestion
    — 这些问题属于规划阶段。

Error Handling (Both Modes)

错误处理(两种模式)

Wrap external interactions (UI, file, network, DB) in Try/Catch and classify failures —
BusinessRuleException
for bad input data (no retry; needs a human), system exceptions for transient faults (retry then escalate).
Don't blanket-wrap pure logic, don't leave a Catch empty, and
Rethrow
(never
Throw New Exception(ex.Message)
) to preserve the stack trace. For exception taxonomy, Retry Scope count/interval semantics, ContinueOnError suppression, screenshot-on-error, the Global Exception Handler recipe (scaffold +
project.json
registration + verdict logic), and the resilience patterns — recovering to a known app state before retrying, per-item transaction boundaries, idempotent/compensating writes to avoid duplicate creates and partial writes, sensitive-data redaction, and retry ownership across queue/Retry-Scope/GEH/job layers — read references/error-handling-guide.md in full before adding resilience to a workflow.
将外部交互(UI、文件、网络、数据库)包装在Try/Catch中并对失败进行分类 —
BusinessRuleException
用于错误输入数据(无需重试;需人工干预),系统异常用于临时故障(重试后升级)
。不要盲目包装纯逻辑,不要留空Catch块,且要
Rethrow
(切勿
Throw New Exception(ex.Message)
)以保留堆栈跟踪。如需异常分类、Retry Scope计数/间隔语义、ContinueOnError抑制、错误时截图、全局异常处理程序方案(搭建 +
project.json
注册 + 裁决逻辑)和弹性模式 — 重试前恢复到已知应用状态、每个项目的事务边界、幂等/补偿写入以避免重复创建和部分写入、敏感数据脱敏以及队列/Retry-Scope/GEH/作业层的重试所有权 — 在向工作流添加弹性前,请完整阅读references/error-handling-guide.md

Execution Maps (Both Modes)

执行映射(两种模式)

Follow the journey map in execution-maps-guide.md for every build or edit — it fixes which tool calls batch into which assistant turn (greenfield ≤5 turns, brownfield ≤4). Within a turn: chain dependent
uip
calls with
&&
in one
Bash
; emit independent
Bash
/
Read
/
Edit
calls as parallel tool uses. Split turns only where a call needs an earlier call's stdout or a file mutation. Rule 21 discovery for off-card activities fans out inside T1/T2 — all K
find
s parallel, then all K doc
Read
s, then all K
get-default-xaml
s — never one activity at a time.
Sequential by design — never batch across:
templates search
init
(Rule 2 decision gate); any
AskUserQuestion
or consent gate; UIA state advances and indication (the UIA journey in the guide encodes its per-screen gating).
每次构建或编辑都遵循execution-maps-guide.md中的旅程映射 — 它规定了哪些工具调用应批量到哪个助手回合(全新项目≤5回合,已有项目≤4回合)。在一个回合内:将依赖的
uip
调用用
&&
链接到一个
Bash
中;将独立的
Bash
/
Read
/
Edit
调用作为并行工具使用。仅当某个调用需要之前调用的stdout或文件变更时,才拆分回合。规则21针对卡片外活动的发现会在T1/T2内展开 — 所有K个
find
并行执行,然后所有K个文档
Read
,然后所有K个
get-default-xaml
— 切勿逐个活动执行。
按设计顺序执行 — 切勿跨以下步骤批量执行:
templates search
init
(规则2决策检查点);任何
AskUserQuestion
或同意检查点;UIA状态推进和指示(指南中的UIA旅程编码了其逐屏检查点)。

Coded-Specific Rules

代码化特定规则

  1. [Coded] ALWAYS inherit from
    CodedWorkflow
    base class for workflow and test case classes (NOT for Coded Source Files).
  2. [Coded] ALWAYS use
    [Workflow]
    or
    [TestCase]
    attribute
    on the
    Execute
    method.
  3. [Coded] Update
    project.json
    entryPoints
    when adding/removing workflow files in Process projects. Tests and Library projects do NOT use
    entryPoints
    — skip this step for those project types. For
    fileInfoCollection
    (required for every test case in every project type — XAML and coded alike), see Common Rule 10.
  4. [Coded] One workflow/test case class per file, class name must match file name.
  5. [Coded] Namespace = sanitized project name from
    project.json
    . Sanitize: remove spaces, replace hyphens with
    _
    , ensure valid C# identifier.
  6. [Coded] Entry method is always named
    Execute
    .
  7. [Coded] Use Coded Source Files for reusable code — plain
    .cs
    files without
    CodedWorkflow
    inheritance, no entry point.
  1. [Coded] 工作流和测试用例类必须继承自
    CodedWorkflow
    基类
    (不适用于代码化源文件)。
  2. [Coded]
    Execute
    方法必须使用
    [Workflow]
    [TestCase]
    属性
  3. [Coded] 添加/移除流程项目中的工作流文件时,更新
    project.json
    entryPoints
    测试和库项目不使用
    entryPoints
    — 这些项目类型跳过此步骤。对于
    fileInfoCollection
    (所有项目类型的每个测试用例都需要 — XAML和代码化均适用),请参阅通用规则10。
  4. [Coded] 每个文件对应一个工作流/测试用例类,类名必须与文件名匹配。
  5. [Coded] 命名空间 =
    project.json
    中的清理后项目名称
    。清理:移除空格,将连字符替换为
    _
    ,确保为有效的C#标识符。
  6. [Coded] 入口方法始终命名为
    Execute
  7. [Coded] 使用代码化源文件存储可重用代码 — 普通
    .cs
    文件,无需
    CodedWorkflow
    继承,无入口点。

XAML-Specific Rules

XAML特定规则

  1. [XAML] Activity docs are the source of truth — check
    {projectRoot}/.local/docs/packages/{PackageId}/
    first. Always.
  2. [XAML] MUST understand project structure — read
    project.json
    , check expression language, scan existing patterns. NEVER generate XAML blind.
  3. [XAML] Batch-author, single gate — author the complete workflow in one pass, sourcing each activity card → memory → Rule 21 triple (precedence in execution-maps-guide.md). Then per-file
    validate
    to clean, then one project
    build
    (Rule 3 cadence, 5-attempt caps unchanged); for observable-output workflows the gate ends with one
    run
    + output check (execution-maps-guide.md § Gate ≠ runtime proof). On failure: fix by error category (Rule 19); card-covered activities stay card-sourced — a gate failure does NOT reopen
    activities find
    /
    get-default-xaml
    ; >2 errors with ambiguous origin → bisect (stub out half the new activities, re-validate).
  4. [XAML] Fix errors by category — Package → Structure → Type → Activity Properties → Logic.
  5. [XAML] Flowchart node structure + ViewState both decide whether a Flowchart renders. Structure first: every
    FlowStep
    /
    FlowDecision
    /
    FlowSwitch
    MUST be a direct child of
    <Flowchart>
    (only direct children are added to the
    Flowchart.Nodes
    collection), wired through
    Flowchart.StartNode
    /
    FlowStep.Next
    /branches with
    <x:Reference>
    +
    x:Name
    . NEVER build the flow as a nested chain — one
    FlowStep
    physically nested inside the previous one's
    <FlowStep.Next>
    — because nested-only steps are absent from
    Flowchart.Nodes
    and the designer renders almost nothing, regardless of ViewState. Then ViewState: when generating new Flowchart/StateMachine/ProcessDiagram workflows, per-node ViewState is MANDATORY —
    ShapeLocation
    +
    ShapeSize
    on every node (
    ConnectorLocation
    optional, Studio auto-routes). Without it Studio stacks every node at (0,0) so they overlap into what looks like a single node, and Studio does NOT auto-arrange on open (see canvas-layout-guide.md). When editing existing files, do NOT modify ViewState on nodes you are not changing. For Sequences, ViewState is optional.
  6. [XAML] Reading
    <Activity>.md
    from
    {PROJECT_DIR}/.local/docs/packages/...
    is a precondition for
    activities get-default-xaml
    — for every activity not on the common-activity card.
    • Card-listed activities and patterns: check references/common-activity-card.md and references/common-pattern-card.md first; on a card hit, author from the card entry alone — skip
      activities find
      , skip
      activities get-default-xaml
      , skip the per-activity MD read. Precedence: card → agent memory (execution-maps-guide.md § Cross-session memory) → full triple. A memory hit substitutes for the triple only;
      validate
      /
      build
      still gate.
    • All other activities: (1)
      activities find
      → class name, (2) read
      <Activity>.md
      first
      and extract a property checklist (required + use-case-relevant), (3)
      activities get-default-xaml
      → starter element, (4) diff your checklist against the starter and add what's missing — an empty checklist means you skipped step 2, go back.
    • Doc lookup order: primary
      {PROJECT_DIR}/.local/docs/packages/<PackageId>/activities/<Activity>.md
      ; fallback
      references/activity-docs/<PackageId>/<closest-version>/<Activity>.md
      for older package versions where
      .local/docs
      is empty. Exception —
      UiPath.UIAutomation.Activities
      has no bundled fallback:
      .local/docs
      (present only after the package is installed) is its sole activity-doc source. If it is absent, do not hunt for a bundled copy — follow Rule 7a (install with consent per § UIA Prerequisites, or use the Placeholder-Selector Stub Pattern — uia-starter-guide.md).
    • Trigger activities are special — read BOTH docs. When the class name ends in
      Trigger
      , the namespace contains
      .Triggers
      , or the description mentions "starts a job" / "Monitor Events" / "Trigger Scope", also read the bundled
      references/activity-docs/<PackageId>/<closest-version>/activities/<Activity>.md
      and the package's bundled
      overview.md
      . The auto-generated
      .local/docs
      version is sparse for triggers; the bundled hand-written docs carry placement guidance (entry-point vs.
      ui:TriggerScope
      ), deployment context, and cross-cutting namespace/assembly gotchas that the extractor does not capture. See Common Rule 12 and trigger-pattern-guide.md.
    • Skip-tax — concrete:
      activities get-default-xaml
      omits any property whose value equals the type default. For
      NGetText
      the starter is literally
      <uix:NGetText HealingAgentBehavior="SameAsCard" />
      with zero output properties — authoring from this alone produces
      NGetText.Value="..."
      (does not exist; the output member is
      TextString
      ), which
      validate
      accepts and
      build
      rejects. For
      NTypeInto
      that's 2 of 20 properties hidden.
    • Self-extending the card — "this activity feels simple, I'll add it to the card mentally" — is the failure mode. The card is the only allowlist; for non-card activities the MD read is the only check.
    • Full procedure: xaml/xaml-basics-and-rules.md § Activity Property Surface. 21a. [XAML] Built-in workflow activities: use the card only for this allowlist. Fast-path card activities are:
      Sequence
      ,
      If
      ,
      Switch<T>
      ,
      TryCatch
      ,
      While
      ,
      DoWhile
      ,
      ForEach<T>
      ,
      Assign
      ,
      LogMessage
      ,
      WriteLine
      ,
      Delay
      ,
      Throw
      ,
      Rethrow
      . If the activity is on this list, open references/common-activity-card.md and author from the card. If it is not on this list, check references/common-pattern-card.md next — its patterns cover e.g. text-file read/append/write, file copy, CSV, DataTable→CSV, queue publish, retry wrap,
      InvokeWorkflowFile
      , InvokeCode rows, HTTP→JSON — and follow full Rule 21 only when BOTH cards miss.
      Pick
      ,
      Parallel
      , and
      ParallelForEach<T>
      are intentionally on neither card; use full Rule 21. Studio's "While" / "Do While" / "For Each" toolbox items emit UiPath wraps (
      UiPath.Core.Activities.InterruptibleWhile
      /
      InterruptibleDoWhile
      /
      UiPath.Core.Activities.ForEach<T>
      ), not the framework
      System.Activities.Statements.While
      /
      DoWhile
      /
      ForEach<T>
      .
  7. [XAML] MUST read references/xaml/xaml-basics-and-rules.md before generating or editing any XAML — then vet the plan against references/xaml/common-pitfalls.md. common-pitfalls.md is a catalog of independent gotcha sections — do NOT read it end-to-end: list its headings (Grep
    ^##
    on the file), then Read every section whose heading matches an activity, property, or feature in the workflow you are about to author. Unsure whether a section applies → read it. This is an authoring-time gate, not only a troubleshooting resource — consulting it first is cheaper than debugging a gotcha
    validate
    cannot see.
  8. [XAML] NEVER change
    expressionLanguage
    or
    targetFramework
    on an existing project.
    Decide both proactively at init time (Common Rule 2a); this rule covers the immutability afterward. Both fields in
    project.json
    are fixed at creation time and apply to every XAML file in the project — flipping
    expressionLanguage
    (VisualBasic ↔ CSharp) invalidates every expression, and flipping
    targetFramework
    (Windows ↔ Portable/cross-platform, or Legacy) invalidates package references and activity compatibility. Do not attempt in-place conversion. If the user wants to convert an existing project, confirm with them, copy the project to a temporary folder, create a new project via
    uip rpa init --expression-language <VisualBasic|CSharp> --target-framework <Windows|Portable>
    (for a target of Windows - Legacy, create it in Legacy mode instead — modern
    init
    is not the legacy creation path), make sure all the defined workflows in the old project have an equivalent in the new project. Delete the copied project just after the new project has been successfully generated and the user agree with the changes.
  9. [XAML] Wrap every container-activity body/branch in
    <Sequence>
    — even single-activity bodies.
    Studio's designer expects the wrap as a drop zone; Studio's emitter produces it.
    validate
    and
    build
    accept the bare form, so neither catches missing wrappers. Applies to creation and editing alike. Slots include
    If.Then
    /
    If.Else
    ,
    While
    /
    DoWhile
    body,
    ForEach.Body
    ,
    TryCatch.Try
    /
    Catch
    /
    Finally
    ,
    Switch.Default
    + each case,
    PickBranch.Trigger
    /
    Action
    ,
    NApplicationCard.Body
    . Full table with examples: xaml/xaml-basics-and-rules.md § Container Activity Bodies — Wrap in Sequence.
  1. [XAML] 活动文档是权威来源 — 首先检查
    {projectRoot}/.local/docs/packages/{PackageId}/
    。始终如此。
  2. [XAML] 必须了解项目结构 — 阅读
    project.json
    ,检查表达式语言,扫描现有模式。切勿盲目生成XAML。
  3. [XAML] 批量创作,单次检查 — 一次性完成工作流创作,每个活动卡片 → 内存 → 规则21三重检查(优先级在execution-maps-guide.md中)。然后进行单文件
    validate
    以修复错误,再进行一次项目
    build
    (规则3节奏,5次尝试上限不变);对于有可观察输出的工作流,检查结束时需执行一次
    run
    + 输出检查(execution-maps-guide.md § Gate ≠ runtime proof)。失败时:按错误类别修复(规则19);卡片覆盖的活动保持卡片来源 — 检查失败不重新执行
    activities find
    /
    get-default-xaml
    ;>2个来源模糊的错误 → 二分法(存根化一半新活动,重新验证)。
  4. [XAML] 按类别修复错误 — 包 → 结构 → 类型 → 活动属性 → 逻辑。
  5. [XAML] 流程图节点结构 + ViewState共同决定流程图是否渲染结构优先: 每个
    FlowStep
    /
    FlowDecision
    /
    FlowSwitch
    必须是
    <Flowchart>
    的直接子元素(只有直接子元素会被添加到
    Flowchart.Nodes
    集合),通过
    Flowchart.StartNode
    /
    FlowStep.Next
    /分支使用
    <x:Reference>
    +
    x:Name
    连接。切勿将流程构建为嵌套链 — 一个
    FlowStep
    物理嵌套在前一个
    FlowStep
    <FlowStep.Next>
    内 — 因为仅嵌套的步骤不会出现在
    Flowchart.Nodes
    中,无论ViewState如何,设计器几乎不会渲染任何内容。然后是ViewState: 生成新的流程图/状态机/流程图表工作流时,每个节点的ViewState是必需的 — 每个节点都要有
    ShapeLocation
    +
    ShapeSize
    ConnectorLocation
    可选,Studio会自动路由)。没有ViewState,Studio会将每个节点堆叠在(0,0)位置,导致它们重叠成一个节点,且Studio打开时不会自动排列(请参阅canvas-layout-guide.md)。编辑现有文件时,切勿修改未更改节点的ViewState。对于Sequence,ViewState是可选的。
  6. [XAML] 对于所有不在通用活动卡片中的活动,读取
    {PROJECT_DIR}/.local/docs/packages/...
    中的
    <Activity>.md
    activities get-default-xaml
    的前置条件
    • 卡片列出的活动和模式: 首先检查references/common-activity-card.mdreferences/common-pattern-card.md;如果匹配卡片条目,仅根据卡片条目创作 — 跳过
      activities find
      activities get-default-xaml
      和每个活动的MD阅读。优先级:卡片 → 代理内存(execution-maps-guide.md § Cross-session memory)→ 完整三重检查。内存匹配仅替代三重检查;
      validate
      /
      build
      仍需检查。
    • 所有其他活动: (1)
      activities find
      → 类名,(2) 首先阅读
      <Activity>.md
      并提取属性清单(必填 + 与用例相关)
      ,(3)
      activities get-default-xaml
      → 起始元素,(4) 将你的清单与起始元素对比并添加缺失的内容 — 空清单表示你跳过了步骤2,请返回。
    • 文档查找顺序: 首选
      {PROJECT_DIR}/.local/docs/packages/<PackageId>/activities/<Activity>.md
      ;对于
      .local/docs
      为空的旧包版本,回退到
      references/activity-docs/<PackageId>/<closest-version>/<Activity>.md
      例外 —
      UiPath.UIAutomation.Activities
      无捆绑回退:
      .local/docs
      (仅在包安装后存在)是其唯一的活动文档来源。如果缺失,请勿寻找捆绑副本 — 遵循规则7a(根据§ UIA Prerequisites获得同意后安装,或使用Placeholder-Selector Stub Pattern — uia-starter-guide.md)。
    • 触发活动特殊 — 需阅读两个文档。当类名以
      Trigger
      结尾、命名空间包含
      .Triggers
      或描述提及"启动作业" / "监控事件" / "Trigger Scope"时,还需阅读捆绑的
      references/activity-docs/<PackageId>/<closest-version>/activities/<Activity>.md
      包的捆绑
      overview.md
      。自动生成的
      .local/docs
      版本对触发器的描述较为简略;捆绑的手写文档包含放置指南(入口点 vs
      ui:TriggerScope
      )、部署上下文以及提取器未捕获的跨领域命名空间/程序集陷阱。请参阅通用规则12和trigger-pattern-guide.md
    • 跳过成本 — 具体表现:
      activities get-default-xaml
      会省略任何值等于类型默认值的属性。对于
      NGetText
      ,起始元素实际上是
      <uix:NGetText HealingAgentBehavior="SameAsCard" />
      输出属性 — 仅从此创作会产生
      NGetText.Value="..."
      (不存在;输出成员是
      TextString
      ),
      validate
      会接受但
      build
      会拒绝。对于
      NTypeInto
      ,20个属性中有2个会被隐藏。
    • 自行扩展卡片 — "此活动看起来简单,我会将其添加到卡片中" — 是失败模式。卡片是唯一的允许列表;对于非卡片活动,MD阅读是唯一的检查方式。
    • 完整流程:xaml/xaml-basics-and-rules.md § Activity Property Surface。 21a. [XAML] 内置工作流活动:仅针对此允许列表使用卡片。快速路径卡片活动包括:
      Sequence
      If
      Switch<T>
      TryCatch
      While
      DoWhile
      ForEach<T>
      Assign
      LogMessage
      WriteLine
      Delay
      Throw
      Rethrow
      。如果活动在此列表中,请打开references/common-activity-card.md并根据卡片创作。如果不在此列表中,请接下来检查references/common-pattern-card.md — 其模式涵盖例如文本文件读取/追加/写入、文件复制、CSV、DataTable→CSV、队列发布、重试包装、
      InvokeWorkflowFile
      、InvokeCode行、HTTP→JSON — 仅当两个卡片都未命中时,才遵循完整规则21。
      Pick
      Parallel
      ParallelForEach<T>
      故意不在任何卡片中;请使用完整规则21。Studio的"While" / "Do While" / "For Each"工具箱项会生成UiPath包装器(
      UiPath.Core.Activities.InterruptibleWhile
      /
      InterruptibleDoWhile
      /
      UiPath.Core.Activities.ForEach<T>
      ),而非框架的
      System.Activities.Statements.While
      /
      DoWhile
      /
      ForEach<T>
  7. [XAML] 生成或编辑任何XAML前,必须阅读references/xaml/xaml-basics-and-rules.md — 然后根据references/xaml/common-pitfalls.md检查计划。common-pitfalls.md是独立陷阱章节的目录 — 请勿从头到尾阅读:列出其标题(对文件执行
    Grep ^##
    ),然后阅读标题与你即将创作的工作流中的活动、属性或功能匹配的每个章节。不确定章节是否适用 → 阅读它。这是创作时的检查点,而非仅用于故障排除 — 先查阅它比调试
    validate
    无法检测到的陷阱更划算。
  8. [XAML] 切勿更改现有项目的
    expressionLanguage
    targetFramework
    。在init时主动决定两者(通用规则2a);本规则涵盖创建后的不可变性。
    project.json
    中的两个字段在创建时固定,并适用于项目中的每个XAML文件 — 翻转
    expressionLanguage
    (VisualBasic ↔ CSharp)会使所有表达式无效,翻转
    targetFramework
    (Windows ↔ Portable/跨平台,或Legacy)会使包引用和活动兼容性无效。请勿尝试就地转换。如果用户想要转换现有项目,请与他们确认,将项目复制到临时文件夹,通过
    uip rpa init --expression-language <VisualBasic|CSharp> --target-framework <Windows|Portable>
    创建新项目(对于Windows - Legacy目标,在旧版模式中创建 — 现代
    init
    不是旧版创建路径),确保旧项目中所有定义的工作流在新项目中都有等效项。新项目成功生成且用户同意更改后,删除复制的项目。
  9. [XAML] 将每个容器活动的主体/分支包装在
    <Sequence>
    中 — 即使是单活动主体
    。Studio设计器期望此包装作为放置区域;Studio的发射器会生成它。
    validate
    build
    接受裸形式,因此两者都不会捕获缺失的包装器。适用于创建和编辑。插槽包括
    If.Then
    /
    If.Else
    While
    /
    DoWhile
    主体、
    ForEach.Body
    TryCatch.Try
    /
    Catch
    /
    Finally
    Switch.Default
    + 每个案例、
    PickBranch.Trigger
    /
    Action
    NApplicationCard.Body
    。包含示例的完整表格:xaml/xaml-basics-and-rules.md § Container Activity Bodies — Wrap in Sequence

Task Navigation

任务导航

I need to...ModeRead these
Work in a Legacy (.NET 4.6.1) projectLegacylegacy/legacy-mode-guide.md — entry point. Modern-mode rules below do not apply.
Plan the build's turn structureBothexecution-maps-guide.md — read first for any build/edit journey
Choose coded vs XAMLBothcoded-vs-xaml-guide.md
Work in a hybrid projectHybridcoded-vs-xaml-guide.mdenvironment-setup.md § Designing Project Structure
Create a new projectBothenvironment-setup.md
Add/edit a coded workflowCodedcoded/operations-guide.md — includes § Coding Guidelines
Add a coded test caseCodedcoded/operations-guide.md — remember: register in
fileInfoCollection
(Common Rule 10)
Set up data-driven testingBothtesting-guide.md § Data-Driven Testing — remember: register in
fileInfoCollection
(Common Rule 10)
Create XAML test case (Given-When-Then)XAMLtesting-guide.md § XAML Test Case Structure — remember: register in
fileInfoCollection
(Common Rule 10)
Use mock testingXAMLtesting-guide.md § Mock Testing (WIP) — requires CLI command not yet available
Use XAML test activitiesXAMLtesting-guide.md § XAML Test Activities
Use execution templatesXAMLtesting-guide.md § Execution Templates
Set up Test Manager for the project (server URL + default project)Bothcli-reference.md § Test Manager
uip rpa tm connect
/
set-default-project
Create/edit XAML workflowXAMLxaml/xaml-basics-and-rules.md — authoring workflow + anatomy + safety rules
Add error handling / resilience (Try/Catch, Retry Scope, BusinessRuleException, ContinueOnError, screenshot-on-error, Global Exception Handler, recover app state, transaction boundary, idempotency / avoid duplicate creates, queue vs local retry ownership)Botherror-handling-guide.md
Use a common activity (
Sequence
/
If
/
Switch<T>
/
TryCatch
/
While
/
DoWhile
/
ForEach<T>
/
Assign
/
LogMessage
/
WriteLine
/
Delay
/
Throw
/
Rethrow
)
XAMLcommon-activity-card.md
Author a common multi-activity pattern (text file read/append/write · file copy · CSV · DataTable→CSV · queue publish · retry wrap · invoke workflow · InvokeCode rows · HTTP→JSON)XAMLcommon-pattern-card.md — read alongside the activity card, not instead of it
Create/edit FlowchartXAMLxaml/canvas-layout-guide.md — § Flowchart Structure & Wiring, then § Flowchart Layout
Create StateMachineXAMLxaml/xaml-basics-and-rules.md § State Machinexaml/canvas-layout-guide.md § State Machine Layout
Create/edit Long Running Workflow (ProcessDiagram)XAMLxaml/long-running-workflow-guide.mdxaml/canvas-layout-guide.md
Write UI automationBothUIA package guide
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
(Rule 7)
Build multi-screen UIA XAML workflowXAMLUIA package guide (Rule 7) § Multi-Screen Authoring
Share Object Repository selectors across projects (UI Library)Bothuia-starter-guide.md § Object Repository as a Published UI Library
Run / debug a UIA workflowBothuia-starter-guide.md § Running UI Automation Workflows — baseline, debug session, window cleanup, selector recovery
Drive a captured control (date inputs, native vs custom dropdowns, buttons disabled during async)BothUIA package guide § Control-Specific Interaction Patterns
Use Excel/Word/Mail/etc.BothService table below →
.local/docs/packages/{PackageId}/
→ fallback:
references/activity-docs/{PackageId}/{closest}/
Manipulate data (DataTable/LINQ, strings, RegEx, DateTime, collections, JSON)Bothdata-manipulation-guide.md
Use Data Fabric entitiesXAMLxaml/xaml-basics-and-rules.mdactivity-docs overview
Query Data Fabric with filtersXAMLdata-service-filter-builder-guide.mdQueryEntityRecords
Call an IS connector (coded)Codedcoded/integration-service-guide.md
Call an IS connector (XAML)XAMLis-connector-xaml-guide.md — includes connector discovery + connection lifecycle
Build an event-triggered workflow (O365 / Gmail / Salesforce / Jira / Slack / ServiceNow / time / queue / file watcher / UI click)XAMLtrigger-pattern-guide.md
activity-docs/{PackageId}/{closest}/activities/<TriggerActivity>.md
Inspect Integration Service trigger lifecycle (webhook vs. polling, filter fields, webhook URL retrieval)Bothtrigger-pattern-guide.md § Connection Handling and § Server-Side Filtering
Read or edit an existing
ui:TriggerScope
workflow
XAMLtrigger-pattern-guide.md § Reading and Editing Existing TriggerScope XAML
Build/run/validateBothcli-reference.md — includes § Validation Iteration Loop + § Smoke Test
Profile a slow workflow / verify UI automation correctnessBothdebugging.md § Profiling Workflow Performance
Pack & publish project to OrchestratorBothcli-reference.md § Pack & Publish to Orchestrator
List project best-practice / analyzer rulesBothcli-reference.md § analyzer-rules list
Add a NuGet packageCodedcoded/operations-guide.md § Add Dependencycoded/codedworkflow-reference.md § Third-Party NuGet Packages
Find / reuse existing tenant librariesBothtenant-library-search-guide.md
Extract reusable logic into a libraryBothlibrary-authoring-guide.md — public-workflow contract, argument naming, private helpers
Publish a libraryBothlibrary-authoring-guide.md § Pack & Publish — tenant libraries feed, versioning
Invoke a PowerShell script from a workflowBothpowershell-interop-guide.md
List / install Data Fabric entitiesBothcli-reference.md § Data Fabric Entities
Discover activity APIsCodedcoded/codedworkflow-reference.md § Inspect NuGet Package Tool
Troubleshoot coded errorsCodedcoded/operations-guide.md § Common Issues and Fixes
Troubleshoot XAML errorsXAMLxaml/common-pitfalls.mdcli-reference.md § Validation Iteration Loop
Understand project structureBothenvironment-setup.md § Project Structure Reference
我需要...模式阅读这些文件
在旧版(.NET 4.6.1)项目中工作旧版legacy/legacy-mode-guide.md — 入口点。下文的现代模式规则不适用。
规划构建的回合结构两种模式execution-maps-guide.md — 任何构建/编辑旅程都请首先阅读
选择代码化还是XAML两种模式coded-vs-xaml-guide.md
在混合项目中工作混合coded-vs-xaml-guide.mdenvironment-setup.md § Designing Project Structure
创建新项目两种模式environment-setup.md
添加/编辑代码化工作流代码化coded/operations-guide.md — 包括§ Coding Guidelines
添加代码化测试用例代码化coded/operations-guide.md — 请记住:在
fileInfoCollection
中注册(通用规则10)
设置数据驱动测试两种模式testing-guide.md § Data-Driven Testing — 请记住:在
fileInfoCollection
中注册(通用规则10)
创建XAML测试用例(Given-When-Then)XAMLtesting-guide.md § XAML Test Case Structure — 请记住:在
fileInfoCollection
中注册(通用规则10)
使用模拟测试XAMLtesting-guide.md § Mock Testing (WIP) — 需要尚未可用的CLI命令
使用XAML测试活动XAMLtesting-guide.md § XAML Test Activities
使用执行模板XAMLtesting-guide.md § Execution Templates
为项目设置测试管理器(服务器URL + 默认项目)两种模式cli-reference.md § Test Manager
uip rpa tm connect
/
set-default-project
创建/编辑XAML工作流XAMLxaml/xaml-basics-and-rules.md — 工作流创作 + 结构 + 安全规则
添加错误处理/弹性(Try/Catch、Retry Scope、BusinessRuleException、ContinueOnError、错误时截图、全局异常处理程序、恢复应用状态、事务边界、幂等性/避免重复创建、队列 vs 本地重试所有权)两种模式error-handling-guide.md
使用通用活动
Sequence
/
If
/
Switch<T>
/
TryCatch
/
While
/
DoWhile
/
ForEach<T>
/
Assign
/
LogMessage
/
WriteLine
/
Delay
/
Throw
/
Rethrow
XAMLcommon-activity-card.md
创作通用多活动模式(文本文件读取/追加/写入 · 文件复制 · CSV · DataTable→CSV · 队列发布 · 重试包装 · 调用工作流 · InvokeCode行 · HTTP→JSON)XAMLcommon-pattern-card.md — 请与活动卡片一起阅读,而非替代
创建/编辑流程图XAMLxaml/canvas-layout-guide.md — § Flowchart Structure & Wiring,然后§ Flowchart Layout
创建状态机XAMLxaml/xaml-basics-and-rules.md § State Machinexaml/canvas-layout-guide.md § State Machine Layout
创建/编辑长期运行工作流(ProcessDiagram)XAMLxaml/long-running-workflow-guide.mdxaml/canvas-layout-guide.md
编写UI自动化两种模式UIA包指南
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
(规则7)
构建多屏幕UIA XAML工作流XAMLUIA包指南(规则7)§ Multi-Screen Authoring
跨项目共享对象库选择器(UI库)两种模式uia-starter-guide.md § Object Repository as a Published UI Library
运行/调试UIA工作流两种模式uia-starter-guide.md § Running UI Automation Workflows — 基线、调试会话、窗口清理、选择器恢复
驱动捕获的控件(日期输入、原生 vs 自定义下拉菜单、异步期间禁用的按钮)两种模式UIA包指南 § Control-Specific Interaction Patterns
使用Excel/Word/Mail等两种模式下方服务表 →
.local/docs/packages/{PackageId}/
→ 回退:
references/activity-docs/{PackageId}/{closest}/
操作数据(DataTable/LINQ、字符串、正则表达式、DateTime、集合、JSON)两种模式data-manipulation-guide.md
使用Data Fabric实体XAMLxaml/xaml-basics-and-rules.mdactivity-docs overview
使用过滤器查询Data FabricXAMLdata-service-filter-builder-guide.mdQueryEntityRecords
调用IS连接器(代码化)代码化coded/integration-service-guide.md
调用IS连接器(XAML)XAMLis-connector-xaml-guide.md — 包括连接器发现 + 连接生命周期
构建事件触发的工作流(O365 / Gmail / Salesforce / Jira / Slack / ServiceNow / 时间 / 队列 / 文件监视器 / UI点击)XAMLtrigger-pattern-guide.md
activity-docs/{PackageId}/{closest}/activities/<TriggerActivity>.md
检查集成服务触发器生命周期(Webhook vs 轮询、过滤器字段、Webhook URL检索)两种模式trigger-pattern-guide.md § Connection Handling§ Server-Side Filtering
读取或编辑现有
ui:TriggerScope
工作流
XAMLtrigger-pattern-guide.md § Reading and Editing Existing TriggerScope XAML
构建/运行/验证两种模式cli-reference.md — 包括§ Validation Iteration Loop + § Smoke Test
分析缓慢的工作流 / 验证UI自动化正确性两种模式debugging.md § Profiling Workflow Performance
打包并发布项目到Orchestrator两种模式cli-reference.md § Pack & Publish to Orchestrator
列出项目最佳实践/分析器规则两种模式cli-reference.md § analyzer-rules list
添加NuGet包代码化coded/operations-guide.md § Add Dependencycoded/codedworkflow-reference.md § Third-Party NuGet Packages
查找/复用现有租户库两种模式tenant-library-search-guide.md
将可重用逻辑提取到库中两种模式library-authoring-guide.md — 公共工作流契约、参数命名、私有助手
发布库两种模式library-authoring-guide.md § Pack & Publish — 租户库源、版本控制
从工作流调用PowerShell脚本两种模式powershell-interop-guide.md
列出/安装Data Fabric实体两种模式cli-reference.md § Data Fabric Entities
发现活动API代码化coded/codedworkflow-reference.md § Inspect NuGet Package Tool
排查代码化错误代码化coded/operations-guide.md § Common Issues and Fixes
排查XAML错误XAMLxaml/common-pitfalls.mdcli-reference.md § Validation Iteration Loop
了解项目结构两种模式environment-setup.md § Project Structure Reference

Coded Workflows Quick Reference

代码化工作流快速参考

Coded workflows use standard C# development: create file → write code → validate → run. Activity discovery (
activities find
,
activities get-default-xaml
) is XAML-specific — for coded mode, check
{projectRoot}/.local/docs/packages/{PackageId}/coded/coded-api.md
first for service API docs, then fall back to
packages inspect
, then to the bundled per-package coded docs at
references/activity-docs/<PackageId>/<closest-version>/coded/
. See coded/codedworkflow-reference.md § Inspect NuGet Package Tool.
代码化工作流使用标准C#开发:创建文件 → 编写代码 → 验证 → 运行。活动发现(
activities find
activities get-default-xaml
)是XAML特定的 — 对于代码化模式,请首先检查
{projectRoot}/.local/docs/packages/{PackageId}/coded/coded-api.md
获取服务API文档,然后回退到
packages inspect
,再回退到捆绑的每个包的代码化文档
references/activity-docs/<PackageId>/<closest-version>/coded/
。请参阅coded/codedworkflow-reference.md § Inspect NuGet Package Tool

Three Types of .cs Files

三种.cs文件类型

TypeBase ClassAttributeEntry PointPurpose
Coded Workflow
CodedWorkflow
[Workflow]
Process onlyExecutable automation logic
Coded Test Case
CodedWorkflow
[TestCase]
Process onlyAutomated test with assertions
Coded Source FileNone (plain C#)NoneNoReusable models, helpers, utilities, hooks
类型基类属性入口点用途
代码化工作流
CodedWorkflow
[Workflow]
仅流程项目可执行自动化逻辑
代码化测试用例
CodedWorkflow
[TestCase]
仅流程项目带断言的自动化测试
代码化源文件无(普通C#)可重用模型、助手、工具、钩子

Service-to-Package Mapping

服务到包的映射

Each service on
CodedWorkflow
requires its NuGet package in
project.json
. Without it:
CS0103
.
Service PropertyRequired Package
system
UiPath.System.Activities
testing
UiPath.Testing.Activities
uiAutomation
UiPath.UIAutomation.Activities
excel
UiPath.Excel.Activities
word
UiPath.Word.Activities
powerpoint
UiPath.Presentations.Activities
mail
UiPath.Mail.Activities
office365
UiPath.MicrosoftOffice365.Activities
google
UiPath.GSuite.Activities
For infrastructure/cloud packages (azure, gcp, aws, azureAD, citrix, hyperv, etc.), see coded/codedworkflow-reference.md.
For IS connectors from coded workflows via
ConnectorConnection.ExecuteAsync
:
UiPath.IntegrationService.Activities
— see coded/integration-service-guide.md.
CodedWorkflow
上的每个服务都需要
project.json
中的NuGet包。无包时会出现
CS0103
错误。
服务属性必需包
system
UiPath.System.Activities
testing
UiPath.Testing.Activities
uiAutomation
UiPath.UIAutomation.Activities
excel
UiPath.Excel.Activities
word
UiPath.Word.Activities
powerpoint
UiPath.Presentations.Activities
mail
UiPath.Mail.Activities
office365
UiPath.MicrosoftOffice365.Activities
google
UiPath.GSuite.Activities
对于基础设施/云包(azure、gcp、aws、azureAD、citrix、hyperv等),请参阅coded/codedworkflow-reference.md
对于通过
ConnectorConnection.ExecuteAsync
从代码化工作流调用IS连接器:需要
UiPath.IntegrationService.Activities
— 请参阅coded/integration-service-guide.md

CodedWorkflow Base Class

CodedWorkflow基类

All workflow/test case files inherit from
CodedWorkflow
, providing built-in methods (
Log
,
Delay
,
RunWorkflow
), service properties, and the
workflows
property for strongly-typed invocation. Extendable with Before/After hooks via
IBeforeAfterRun
.
Full reference: coded/codedworkflow-reference.md
所有工作流/测试用例文件都继承自
CodedWorkflow
,提供内置方法(
Log
Delay
RunWorkflow
)、服务属性和用于强类型调用的
workflows
属性。可通过
IBeforeAfterRun
扩展Before/After钩子。
完整参考:coded/codedworkflow-reference.md

Templates

模板

  • assets/codedworkflow-template.md — Workflow, test case, helper-class, and Before/After-hooks boilerplate (all coded templates)
  • assets/json-template.md
    entryPoints
    and
    fileInfoCollection
    snippets
  • environment-setup.md § Designing Project Structure — Project structure design guidelines (mode-agnostic)
  • assets/codedworkflow-template.md — 工作流、测试用例、助手类和Before/After钩子的模板(所有代码化模板)
  • assets/json-template.md
    entryPoints
    fileInfoCollection
    片段
  • environment-setup.md § Designing Project Structure — 项目结构设计指南(模式无关)

XAML Workflows Quick Reference

XAML工作流快速参考

XAML workflows follow a discovery-first, phase-based approach: Discovery → Generate/Edit → Validate & Fix → Response. See xaml/xaml-basics-and-rules.md § Authoring Workflow for the full phase workflow.
XAML工作流遵循发现优先、分阶段方法:发现 → 生成/编辑 → 验证与修复 → 响应。请参阅xaml/xaml-basics-and-rules.md § Authoring Workflow获取完整阶段工作流。

Workflow Types

工作流类型

TypeWhen to Use
SequenceLinear step-by-step logic; most common for simple automations
FlowchartBranching/looping logic with multiple decision points
State MachineLong-running processes with distinct states and transitions
Long Running WorkflowBPMN-style horizontal flow; event-driven processes with long waits. Requires
UiPath.FlowchartBuilder.Activities
— see xaml/long-running-workflow-guide.md
类型使用场景
Sequence线性分步逻辑;最适用于简单自动化
Flowchart带有多个决策点的分支/循环逻辑
State Machine具有不同状态和转换的长期运行流程
Long Running WorkflowBPMN风格的水平流程;带有长时间等待的事件驱动流程。需要
UiPath.FlowchartBuilder.Activities
— 请参阅xaml/long-running-workflow-guide.md

Expression Language

表达式语言

Check
expressionLanguage
in
project.json
. VB.NET uses
[brackets]
for expressions; C# uses
CSharpValue<T>
/
CSharpReference<T>
. Default for new XAML projects is VB.NET.
检查
project.json
中的
expressionLanguage
。VB.NET使用
[brackets]
表示表达式;C#使用
CSharpValue<T>
/
CSharpReference<T>
。新XAML项目默认使用VB.NET。

Key CLI Commands

关键CLI命令

CommandPurpose
activities find --query "<keyword>"
Discover activities by keyword
activities get-default-xaml --activity-class-name "<class>"
Get starter XAML for an activity
analyzer-rules list --project-dir "<dir>"
List enabled Workflow Analyzer rules — on demand only (user asks about project rules, or repeated violations of one rule family);
validate
/
build
enforce the rules without it
validate --file-path "<file>"
Per-file static validation (structure, references, analyzer rules)
build "<PROJECT_DIR>"
Compile-time validation (member names, enum values, JIT expressions) — run after
validate
is clean
命令用途
activities find --query "<keyword>"
通过关键词发现活动
activities get-default-xaml --activity-class-name "<class>"
获取活动的起始XAML
analyzer-rules list --project-dir "<dir>"
列出启用的工作流分析器规则 — 仅按需使用(用户询问项目规则,或同一规则家族重复违规);
validate
/
build
无需此命令即可强制执行规则
validate --file-path "<file>"
单文件静态验证(结构、引用、分析器规则)
build "<PROJECT_DIR>"
编译时验证(成员名称、枚举值、JIT表达式) — 在
validate
通过后运行

Common Activities

通用活动

ActivityPackagePurpose
UI automation (Use Application/Browser, Click, Type Into, Get Text, Select Item, …)
UiPath.UIAutomation.Activities
Never author from memory or from this row. Selectors and targets are captured, not hand-written — read the UIA package guide (
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
) in full first (Rule 7).
Ifbuilt-inConditional branching
Assignbuilt-inSet variable/argument values
For Eachbuilt-inIterate over a collection
Invoke Workflow Filebuilt-inCall another workflow file
Create Entity Record
UiPath.DataService.Activities
Create a Data Fabric entity record
Query Entity Records
UiPath.DataService.Activities
Query Data Fabric records with filters — see filter builder guide
活动用途
UI自动化(Use Application/Browser、Click、Type Into、Get Text、Select Item等)
UiPath.UIAutomation.Activities
切勿凭记忆或本行内容创作。选择器和目标是捕获的,而非手动编写 — 请首先完整阅读UIA包指南(
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/ui-automation-guide.md
)(规则7)。
If内置条件分支
Assign内置设置变量/参数值
For Each内置遍历集合
Invoke Workflow File内置调用另一个工作流文件
Create Entity Record
UiPath.DataService.Activities
创建Data Fabric实体记录
Query Entity Records
UiPath.DataService.Activities
使用过滤器查询Data Fabric记录 — 请参阅过滤器构建指南

XAML File Anatomy

XAML文件结构

The XAML file anatomy template (namespace declarations, root Activity element, body structure) is in xaml/xaml-basics-and-rules.md — read it before generating or editing any XAML.
XAML文件结构模板(命名空间声明、根Activity元素、主体结构)位于xaml/xaml-basics-and-rules.md — 生成或编辑任何XAML前请阅读。

Key References

关键参考

  • xaml/xaml-basics-and-rules.md — XAML anatomy, safety rules, editing operations (read before any XAML work)
  • xaml/common-pitfalls.md — Activity gotchas, scope requirements, property conflicts
  • data-manipulation-guide.md — DataTable LINQ (filter/sort/group/join/diff), strings, RegEx, DateTime, type conversion, collections, JSON; VB + C# forms
  • error-handling-guide.md — Modern-mode error handling & resilience: exception taxonomy, Try/Catch discipline, Retry Scope, ContinueOnError, Throw/Rethrow, screenshot-on-error, Global Exception Handler (scaffold + registration + verdict logic), state recovery before retry, transaction boundaries, idempotent/compensating writes (duplicate-create safety), sensitive-data redaction, and retry ownership across layers
  • reframework-guide.md — REFramework execution modes, SetTransactionStatus queue-guard fix, Config.xlsx leftover trap
  • xaml/csharp-activity-binding-guide.md — Canonical C# binding forms per common activity property (flat lookup table + recipes) + § C# Expression Pitfalls (attribute-form VB JIT, ThrowIfNotInTree, OutArgument parse errors)
  • xaml/canvas-layout-guide.md — Flowchart node vocabulary, structure & wiring, node registration, forbidden nested-chain pattern + Flowchart/State Machine/LRW canvas layout with ViewState
  • xaml/long-running-workflow-guide.md — LRW package dependency, node vocabulary, gateway patterns, suspend/resume persistence
  • xaml/jit-custom-types-schema.md — JIT custom type discovery
  • library-authoring-guide.md — Produce reusable libraries: public-workflow contract, activity layout sidecar (display name, icon, widgets), error contract, SemVer, pack & publish to the libraries feed
  • xaml/xaml-basics-and-rules.md — XAML结构、安全规则、编辑操作(任何XAML工作前请阅读)
  • xaml/common-pitfalls.md — 活动陷阱、范围要求、属性冲突
  • data-manipulation-guide.md — DataTable LINQ(过滤/排序/分组/连接/差异)、字符串、正则表达式、DateTime、类型转换、集合、JSON;VB + C#形式
  • error-handling-guide.md — 现代模式错误处理与弹性:异常分类、Try/Catch规范、Retry Scope、ContinueOnError、Throw/Rethrow、错误时截图、全局异常处理程序(搭建 + 注册 + 裁决逻辑)、重试前状态恢复、事务边界、幂等/补偿写入(重复创建安全)、敏感数据脱敏以及跨层重试所有权
  • reframework-guide.md — REFramework执行模式、SetTransactionStatus队列保护修复、Config.xlsx遗留陷阱
  • xaml/csharp-activity-binding-guide.md — 通用活动属性的标准C#绑定形式(扁平查找表 + 方案) + § C#表达式陷阱(属性形式VB JIT、ThrowIfNotInTree、OutArgument解析错误)
  • xaml/canvas-layout-guide.md — 流程图节点词汇、结构与连接、节点注册、禁止的嵌套链模式 + 流程图/状态机/LRW画布布局与ViewState
  • xaml/long-running-workflow-guide.md — LRW包依赖、节点词汇、网关模式、暂停/恢复持久化
  • xaml/jit-custom-types-schema.md — JIT自定义类型发现
  • library-authoring-guide.md — 生成可重用库:公共工作流契约、活动布局侧载(显示名称、图标、小部件)、错误契约、语义化版本控制、打包并发布到库源

Multi-Screen UI Automation Workflows

多屏幕UI自动化工作流

For XAML workflows spanning multiple capture screens, default to author-once-after-capture with a single
validate
+
build
gate (Rule 18); per-screen authoring interleave only on long captures (5+ screens). Turn structure: execution-maps-guide.md § Journey: UIA capture + build. Capture loop and the Complete-then-advance rule: UIA package guide § Multi-Screen Authoring (Rule 7) — it mandates the target-capture orchestration reference to read IN FULL first.
对于跨多个捕获屏幕的XAML工作流,默认捕获完成后一次性创作,进行单次
validate
+
build
检查(规则18);仅在长捕获(5+屏幕)时才逐屏交替创作。回合结构:execution-maps-guide.md § Journey: UIA capture + build。捕获循环和完成后推进规则:UIA包指南§ Multi-Screen Authoring(规则7)— 它规定了需首先完整阅读的目标捕获编排参考。

Resolving Packages & Activity Docs

解析包与活动文档

Follow this flow whenever you need to use an activity package:
每当需要使用活动包时,请遵循此流程:

Step 1 — Ensure the package is installed

步骤1 — 确保包已安装

Check
project.json
dependencies
for the required package.
Always query versions with
--include-prerelease
.
Many UiPath activity packages ship as
-preview
between stable releases, and the latest preview routinely contains new activities, fixed signatures, and updated
.local/docs
content that activity generation depends on. Without the flag, the listing hides these and the agent will pick a stale stable.
  • If present → note the installed version. Then list available versions with
    --include-prerelease
    and compare:
    • If a newer version (stable or preview) exists, inform the user: state the installed version, the latest available version, and that newer packages offer the best support for activity generation (latest activity surface, accurate
      .local/docs
      , fewer signature mismatches). Ask whether to upgrade. Never force-upgrade an already-installed package.
    • If the installed version is already the latest, proceed to Step 2.
  • If absent → install the latest version returned by
    packages versions --include-prerelease
    (preview is acceptable):
bash
uip rpa packages versions --package-id <PackageId> --include-prerelease --project-dir "<PROJECT_DIR>" --output json
uip rpa packages install --packages 'id=<PackageId>,version=<LATEST_VERSION>' --project-dir "<PROJECT_DIR>" --output json
检查
project.json
dependencies
中是否存在所需包。
始终使用
--include-prerelease
查询版本
。许多UiPath活动包在稳定版本之间以
-preview
形式发布,最新预览版通常包含活动生成依赖的新活动、修复的签名和更新的
.local/docs
内容。如果没有此标志,列表会隐藏这些版本,代理会选择陈旧的稳定版。
  • 如果已存在 → 记录已安装版本。然后使用
    --include-prerelease
    列出可用版本并比较:
    • 如果存在更新版本(稳定或预览),告知用户:说明已安装版本、最新可用版本,以及新版本为活动生成提供的最佳支持(最新活动界面、准确的
      .local/docs
      、更少的签名不匹配)。询问用户是否升级。切勿强制升级已安装的包。
    • 如果已安装版本已是最新,继续步骤2。
  • 如果不存在 → 安装
    packages versions --include-prerelease
    返回的最新版本(预览版可接受):
bash
uip rpa packages versions --package-id <PackageId> --include-prerelease --project-dir "<PROJECT_DIR>" --output json
uip rpa packages install --packages 'id=<PackageId>,version=<LATEST_VERSION>' --project-dir "<PROJECT_DIR>" --output json

Step 2 — Find activity docs (priority order)

步骤2 — 查找活动文档(优先级顺序)

  1. Check
    {PROJECT_DIR}/.local/docs/packages/{PackageId}/
    — auto-generated, most accurate. Use
    Glob
    +
    Read
    (not
    Grep
    .local/
    is gitignored).
  2. Fall back to bundled references at
    references/activity-docs/{PackageId}/
    — pick the version folder closest to what is installed.
  1. 检查
    {PROJECT_DIR}/.local/docs/packages/{PackageId}/
    — 自动生成,最准确。使用
    Glob
    +
    Read
    (不要使用
    Grep
    .local/
    已被git忽略)。
  2. 回退到捆绑参考
    references/activity-docs/{PackageId}/
    — 选择与已安装版本最接近的版本文件夹。

UI Automation References

UI自动化参考

UIA references live in two locations. Always cite by location so the reader knows which tree to open:
  • This skill (
    references/
    , relative to this SKILL.md) — policy this skill owns: prerequisites/version gating, run/debug orchestration, stub-mode deliverables, UI Library publishing.
  • UIA activity pack (
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/
    , installed via
    uip rpa packages install
    ) — the UIA authoring guide, target-capture orchestration, single-purpose task guides, concrete
    uip rpa uia
    CLI syntax, per-activity property surfaces, coded API surface, and the UIA skill internal procedures. Co-versioned with the package, so always source-of-truth over anything in this skill when they diverge.
UIA参考位于两个位置。请始终按位置引用,以便读者知道打开哪个目录:
  • 本技能
    references/
    ,相对于本SKILL.md)— 本技能负责的策略:前置条件/版本控制、运行/调试编排、存根模式交付物、UI库发布。
  • UIA活动包
    {PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/
    ,通过
    uip rpa packages install
    安装)— UIA创作指南、目标捕获编排、单任务指南、具体
    uip rpa uia
    CLI语法、每个活动的属性界面、代码化API界面以及UIA技能内部流程。与包版本同步,因此当与本技能内容冲突时,始终以此为权威来源。

In this skill (
references/
, relative to this SKILL.md)

本技能中(
references/
,相对于本SKILL.md)

  • uia-starter-guide.mdread first for any UIA work (Rule 7). Mandates the package guide read, then owns the skill-side UIA policies: run/debug procedure (baseline → debug → cancel → window cleanup) + profiling + runtime selector failure recovery, the placeholder-stub deliverable pattern, and UI Library publishing. Version gating and upgrade consent: SKILL.md § UIA Prerequisites.
  • uia-starter-guide.md任何UIA工作都请首先阅读(规则7)。规定了包指南的阅读要求,然后负责技能端的UIA策略:运行/调试流程(基线 → 调试 → 取消 → 窗口清理)+ 分析 + 运行时选择器失败恢复、占位符存根交付物模式和UI库发布。版本控制和升级同意:SKILL.md § UIA Prerequisites。

In the UIA activity pack (
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/
)

UIA活动包中(
{PROJECT_DIR}/.local/docs/packages/UiPath.UIAutomation.Activities/

  • ui-automation-guide.md
    the entry point for all UIA authoring (Rule 7; read in full first — also the Rule 7a availability probe). Window baseline, capture orchestration, common pitfalls, control-specific interaction, coded and XAML patterns. Its § Documentation routes to everything else in the pack: target-capture orchestration, task guides, CLI command inventory, per-activity property surfaces, coded API surface, and the UIA skills (
    uia-configure-target
    ,
    uia-improve-selector
    ).
  • ui-automation-guide.md
    所有UIA创作的入口点(规则7;请首先完整阅读 — 也是规则7a的可用性探测)。窗口基线、捕获编排、常见陷阱、控件特定交互、代码化和XAML模式。其§ Documentation指向包中的所有其他内容:目标捕获编排、任务指南、CLI命令清单、每个活动的属性界面、代码化API界面以及UIA技能(
    uia-configure-target
    uia-improve-selector
    )。

Completion Output

完成输出

Before reporting "done", verify the plan is complete. If a plan file at
docs/plans/*.md
drove this work:
  1. Re-read the plan and scan its task checkboxes.
  2. If any
    [ ]
    boxes remain AND the plan's header says
    Execution autonomy: autonomous
    AND no
    Stop conditions
    item was hit — do not report done. Resume execution on the next unchecked task.
  3. If unchecked boxes remain because a Stop condition was hit, name the exact stop-condition item in the report.
  4. If the plan is fully checked off, or execution autonomy is
    interactive
    , proceed to the report format below.
Then, if the harness provides persistent memory, save validated patterns per execution-maps-guide.md § Cross-session memory before reporting.
When you finish a task, report to the user:
  1. What was done — files created, edited, or deleted (list file paths)
  2. Validation status — per-file
    validate
    result (all files passed, or remaining errors) and project-level
    uip rpa build
    result. Both must be clean to claim verification —
    validate
    clean alone is insufficient (it does not detect unknown member names or invalid enum values). If
    build
    has not run since the last edit, say so explicitly rather than claiming success.
  3. Plan completion — which task checkboxes in
    docs/plans/*.md
    are now
    [x]
    ; list any still
    [ ]
    and, for each, the Stop-condition item that interrupted it (or "not reached" if execution was cut short another way)
  4. How to run — the
    uip rpa run
    (or
    uip rpa debug start
    ) command (if applicable)
  5. Next steps — follow-up actions (configure connections, add OR elements, fill placeholders)
  6. Trouble? — if the user hit issues during this session, mention: "If something didn't work as expected, use
    /uipath-feedback
    to send a report."
Do NOT use framing like "complete", "done", "finished", or "the automation is built" unless every plan task is checked off. "Partial", "stopped at <task N>", or "blocked by <stop condition>" is the honest framing otherwise.
报告"完成"前,请验证计划已完成。如果
docs/plans/*.md
中的计划文件驱动了本次工作:
  1. 重新阅读计划并扫描其任务复选框。
  2. 如果任何
    [ ]
    复选框仍存在,且计划标题包含
    Execution autonomy: autonomous
    ,且未触发
    Stop conditions
    中的项 — 请勿报告完成。继续执行下一个未勾选的任务。
  3. 如果未勾选的任务存在是因为触发了停止条件,请在报告中明确说明触发的停止条件项。
  4. 如果计划已完全勾选,或执行自主性为
    interactive
    ,请继续下文的报告格式。
然后,如果工具提供持久内存,请在报告前根据execution-maps-guide.md § Cross-session memory保存已验证的模式。
完成任务后,向用户报告:
  1. 已完成的工作 — 创建、编辑或删除的文件(列出文件路径)
  2. 验证状态 — 单文件
    validate
    结果(所有文件通过,或剩余错误)以及项目级
    uip rpa build
    结果。两者都必须通过才能声称已验证 — 仅
    validate
    通过不足够(它无法检测未知成员名称或无效枚举值)。如果自上次编辑后未运行
    build
    ,请明确说明,而非声称成功。
  3. 计划完成情况
    docs/plans/*.md
    中的哪些任务复选框现在为
    [x]
    ;列出仍为
    [ ]
    的任务,以及每个任务被中断的停止条件项(或"未执行",如果执行因其他原因中断)
  4. 运行方式
    uip rpa run
    (或
    uip rpa debug start
    )命令(如适用)
  5. 下一步 — 后续操作(配置连接、添加OR元素、填充占位符)
  6. 遇到问题? — 如果用户在本次会话中遇到问题,请提及:"如果某些内容未按预期工作,请使用
    /uipath-feedback
    发送报告。"
除非所有计划任务都已勾选,否则请勿使用"完成"、"done"、"finished"或"自动化已构建"等表述。否则请使用"部分完成"、"在<任务N>处停止"或"被<停止条件>阻塞"等诚实表述。",