nocobase-v2-flow-upgrade
NocoBase V2 Flow Upgrade
Use this skill for existing NocoBase plugin migrations from v1 frontend patterns under src/client/ to v2 model-based flow architecture. Default to behavior parity; do not introduce product changes unless the user asks.
Start Here
Confirm:
- Plugin name and root path.
- Plugin type: action, field, or mixed.
- Whether core flow editor files may be changed.
- Whether backend payloads and persisted settings must remain compatible.
Load references only when needed:
references/feature-inventory-template.mdfor v1 capability inventory.references/v1-to-v2-flow-mapping.mdfor owner mapping.references/verification-checklist.mdbefore closing.
Workflow
- Inventory v1 behavior from
src/client/: capabilities, settings, APIs, roles, locale keys, runtime components. - Classify each capability as
must-have,optional, ordropwith reason. - Map each v1 capability to one v2 owner:
action,model,uiSchema,hook/resource,locale, orruntime component. - Lock API and persistence parity before coding. Preserve request shape and stored values unless explicitly changed.
- Implement in
src/client/models/when possible, then register actions/models in the plugin client entry. - Validate add/edit/run paths, ACL, i18n, persistence, and request counts.
Implementation Rules
- Prefer the smallest migration that preserves current product behavior.
- Keep backend endpoints and data schema unchanged unless there is a hard gap.
- Do not keep both v1
SchemaSettingsand v2 model settings active unless dual-path compatibility is explicitly required. - Put persisted configuration in model flows and steps (
registerFlow,steps,defaultParams,uiMode,uiSchema). - Use
beforeParamsSave/afterParamsSavefor save-time normalization or side effects. - Keep handler output shape stable for downstream flow steps.
- Use plugin namespace translations for plugin UI text, especially
tExpr(..., { ns })in FlowModel titles and step labels.
Plugin Type Rules
For action plugins:
- Define flow actions with explicit scene, params UI, lifecycle hooks, handler, and registration.
- Preserve v1 request helpers and payload shape, such as
resource('x').updateOrCreate({ filterKeys, values }).
For field plugins:
- Prefer
FieldModel/DisplayItemModelsubclasses undersrc/client/models/. - Bind models to the field interface and register them with
flowEngine.registerModels(...). - Move canonical field settings to model-level flows.
- Preserve editor mode, read-only mode, props, database types, filterability, and settings.
Common Pitfalls
- Payload drift: preserve legacy fields such as
collectionName,dataSourceKey,responseType, roles, and response handling. - i18n drift: audit en-US and zh-CN keys, namespace usage, and case-sensitive key mismatches.
- Flow variables: schema-setting variable components may need flow-setting registration or a flow-native equivalent.
- Rich editors: if CodeMirror reports duplicate extension errors, prefer direct
EditorView/EditorStateintegration and keep the editor instance stable. - Quick settings: put defaults on each step's
defaultParamswhen the UI must display saved defaults.
Discovery Commands
From repo root, adapt <plugin> as needed:
rg --files packages/plugins/@nocobase/<plugin>/src/client
rg "defineAction|beforeParamsSave|afterParamsSave|uiSchema|registerActions|registerModels|bindModelToInterface" packages/plugins/@nocobase/<plugin>/src/client -n
rg "SchemaSettings|x-settings|updateOrCreate|roles|collectionName|dataSourceKey|responseType" packages/plugins/@nocobase/<plugin>/src -n
rg "tExpr|lang\\(|useTranslation|ctx\\.t|CodeMirror|EditorView|EditorState" packages/plugins/@nocobase/<plugin>/src/client -n
Reference core patterns:
rg "defineAction\\(|registerFlow\\(|uiMode\\(|defaultParams|bindModelToInterface" packages/core/client/src/flow packages/core/flow-engine -n
Output
End with:
- v1 inventory summary and v2 support scope.
- Capability mapping: v1 source -> v2 owner.
- API payload parity notes.
- Implemented changes and intentional behavior changes, if any.
- Validation summary for create/edit/run, ACL, i18n, persistence, and known gaps.
More from jiannx/agent-skills
nocobase-bugfix
Diagnose and fix NocoBase v2 bugs, especially flow, FlowModel, client-v2, and plugin client issues. Use for issue reproduction, root-cause analysis, targeted fixes, regression checks, or narrow v2 feature completion based on nearby v1 behavior. Default to v2-only changes unless the user explicitly asks for v1.
9fe-quality-operations
Prepare frontend projects for reliable delivery with testing, performance review, observability, release strategy, and production-readiness checks.
2fe-data-mock-state
Design frontend data layers, server-state handling, adapters, mock strategies, and state ownership with stable contracts and low integration churn.
2fe-routing-permission
Design frontend navigation, route ownership, URL state, auth boundaries, and permission systems with explicit access rules and user-state handling.
2fe-design-implementation
Implement product-grade frontend UI from design artifacts with consistent interaction patterns, theme-driven styling, responsive behavior, and design verification.
2fe-product-development
Build product-grade frontend projects with implementation guidance optimized for React ecosystems. Covers bootstrap, architecture, design implementation, data flow, testing, observability, release strategy, and long-term maintainability.
2