Automated summary
Generates Shesha workflow artifacts including instances, definitions, managers, service tasks, extension methods, and database migrations for .NET applications using ABP framework with NHibernate.
Strengths
- Automates generation of all required workflow components in a consistent folder structure.
- Supports various artifact types such as instance, definition, manager, service tasks, and migrations.
- Integrates with ABP framework and NHibernate ORM, ensuring compatibility with Shesha projects.
Limitations
- Only applicable to Shesha projects using ABP and NHibernate, not generic .NET workflows.
- Requires the user to have knowledge of Shesha domain conventions to guide generation correctly.
- May generate boilerplate that still needs manual refinement for complex business logic.
Use when you need to scaffold or update workflow artifacts in a Shesha/.NET/ABP/NHibernate application, especially when creating new workflows or adding steps.
Avoid if not working with Shesha framework or if you need ad-hoc, non-standard workflow implementations outside the provided templates.
Security analysis
SafeThis skill purely generates boilerplate C# source code files for a .NET framework; it does not execute any commands, handle secrets, or perform any potentially destructive actions. No security risks are present.
No concerns found
How this analysis is madeExamples
Create a new workflow called 'ApprovalWorkflow' with start, approve, and reject steps. Include the instance, definition, manager, service tasks for each step, and a database migration.Add a service task for sending an email notification in the 'OrderWorkflow'. The service task should accept an Order ID and an email address as arguments.Generate a batch workflow manager for 'InvoiceWorkflow' that allows initiating multiple instances at once, along with a Hangfire background job for scheduled batch initiation.name: shesha-workflow description: Generates Shesha workflow artifacts for .NET applications using ABP framework with NHibernate. Creates workflow instances, definitions, managers, service tasks, extension methods, and FluentMigrator database migrations. Use when the user asks to create, scaffold, or update workflow-related classes, workflow steps, workflow conditions, or workflow database tables in a Shesha project.
Shesha Workflow Code Generation
Generate workflow artifacts for a Shesha/.NET/ABP/NHibernate application based on $ARGUMENTS.
Instructions
- Inspect nearby files to determine the correct namespace root.
- Use
Guidas entity ID type. All domain properties must bevirtual. - Every workflow requires at minimum: Workflow Instance + Workflow Definition (domain layer).
- Generate a new GUID for
[DiscriminatorValue]attributes. - Place files according to the folder structure below.
Artifact catalog
| # | Artifact | Layer | Template | |---|----------|-------|----------| | 1 | Workflow Instance | Domain | domain-artifacts.md §1 | | 2 | Workflow Definition | Domain | domain-artifacts.md §2 | | 3 | Workflow Manager | Domain | domain-artifacts.md §3 | | 4 | Lifecycle Operations (Suspend/Resume/Cancel/Start) | Domain | domain-artifacts.md §4 | | 5 | Batch Workflow Manager (cycle-based bulk initiation) | Domain | domain-artifacts.md §5 | | 6 | Service Task | Application | service-tasks.md §1 | | 7 | Service Task with Typed Arguments | Application | service-tasks.md §2 | | 8 | Generic Base Service Task | Application | service-tasks.md §3 | | 9 | External-System Await / Auto-Completion Helper | Application | service-tasks.md §4 | | 10 | Workflow Extensions | Application | service-tasks.md §5 | | 11 | Hangfire Background Job for Batch Initiation | Application | service-tasks.md §6 | | 12 | Database Migration | Domain | migrations.md |
When generating multiple artifacts, always create the Instance + Definition pair first, then add Service Tasks per workflow step.
Folder structure
{Module}.Domain/
Domain/{WorkflowName}Workflows/
{WorkflowName}Workflow.cs ← Instance (§1)
{WorkflowName}WorkflowDefinition.cs ← Definition (§2)
{WorkflowName}WorkflowManager.cs ← Manager + lifecycle ops (§3, §4)
{WorkflowName}BatchWorkflowManager.cs ← Batch manager when needed (§5)
Migrations/
M{YYYYMMDDHHmmss}.cs
{Module}.Application/
Jobs/
Initiate{WorkflowName}WorkflowsJob.cs ← Hangfire background job (§6)
Services/
{ExternalSystem}/
{ExternalSystem}WorkflowHelper.cs ← External-trigger helper (§4)
Workflows/
Common/
{TaskName}ServiceTaskBase.cs ← Generic base task (§3)
{WorkflowNamePlural}/
{TaskName}ServiceTask.cs ← Service task (§1 or §2)
{WorkflowName}WorkflowExtensions.cs ← Extension methods (§5)
Quick reference
Base classes
| Artifact | Base Class |
|----------|-----------|
| Workflow Instance | WorkflowInstanceWithTypedDefinition<TDefinition> (Shesha.Workflow.Domain) |
| Workflow Definition | WorkflowDefinition |
| Workflow Manager | DomainService |
| Batch Workflow Manager | DomainService with generic params <TDef, TInstance, TModel> |
| Service Task | AsyncServiceTask<TWorkflow> + ITransientDependency |
| Service Task with Args | AsyncServiceTask<TWorkflow, TArgs> + ITransientDependency |
| Generic Base Task | AsyncServiceTask<TWorkflow> where TWorkflow : WorkflowInstance |
| Gateway condition ext. | static class on WorkflowInstance → returns bool |
| Action ext. methods | static class on typed {WorkflowName}Workflow → returns Task |
| Background Job | ITransientDependency (NOT ScheduledJobBase) |
| DB Migration | Migration or OneWayMigration |
Key dependencies
| Interface / Class | Namespace | Use |
|-------------------|-----------|-----|
| ServiceTaskExecutionContext<T> | Shesha.Workflow.Tasks | Service task RunAsync parameter |
| ServiceTaskExecutionContext<T, TArgs> | Shesha.Workflow.Tasks | Typed-args task RunAsync parameter |
| IProcessDomainService | Shesha.Workflow.DomainServices | Start by name, complete user tasks |
| ProcessAppService | Shesha.Workflow.AppServices.Processes | Suspend / Resume / Cancel |
| IWorkflowHelper | Shesha.Workflow | Resume user task, emit message, get variables |
| WorkflowExecutionLogItem | Shesha.Workflow.Domain | External-trigger auto-completion |
| IRepository<WorkflowInstance, Guid> | Abp.Domain.Repositories | Manager manual instance creation |
| ILogger<T> | Microsoft.Extensions.Logging | Structured logging in service tasks |
Key attributes
| Attribute | Used On |
|-----------|---------|
| [JoinedProperty("TableName")] | Instance, Definition |
| [Prefix(UsePrefixes = false)] | Instance |
| [Entity(TypeShortAlias = "...")] | Instance |
| [DiscriminatorValue("slug")] | Definition |
| [ServiceTaskArguments("slug")] | Typed-args service task class |
| [Display(Name, Description)] | Definition, Service Task |
| [Migration(YYYYMMDDHHmmss)] | Migration class |
Service task method signature
// CORRECT — override RunAsync, return Task (void), access workflow via context
public override async Task RunAsync(ServiceTaskExecutionContext<{WorkflowName}Workflow> context)
{
var workflow = context.WorkflowInstance; // typed workflow instance
// context.Pvc → IReadWriteVariables (process variable container)
await _workflowRepository.UpdateAsync(workflow);
}
// With typed arguments:
public override async Task RunAsync(
ServiceTaskExecutionContext<{WorkflowName}Workflow, {TaskName}Args> context)
{
var workflow = context.WorkflowInstance;
var args = context.Arguments; // populated by the BPMN designer
}
Common patterns
Refresh workflow (NHibernate stale state fix):
var sessionProvider = StaticContext.IocManager.Resolve<ISessionProvider>();
sessionProvider.Session.Refresh(workflow);
Sync SubStatus to Model Status:
workflow.Model.Status = ({RefListStatusEnum}?)workflow.SubStatus;
Resolve dependency in extension methods:
var repo = IocManager.Instance.Resolve<IRepository<{Entity}, Guid>>();
Check definition config in a service task:
if (workflow.Definition?.{ConfigFlag} != true)
return; // feature disabled — skip silently
Suspend a workflow:
await _processAppService.SuspendAsync(new SuspendProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Paused pending external action"
});
Resume a workflow:
await _processAppService.ResumeAsync(new ResumeProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Resumed after external action completed"
});
Cancel a workflow:
await _processAppService.CancelAsync(new CancelProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Cancelled — reason here"
});
Start a workflow by name (programmatic):
await _processDomainService.StartByNameAsync<{WorkflowDefinition}, {WorkflowInstance}>(
new WorkflowDefinitionIdentifier({ModuleName}.Name, "{discriminator-slug}"),
async (instance) =>
{
instance.Model = myEntity;
instance.Subject = "Workflow subject text";
});
Auto-complete a workflow step from an external trigger:
// Find the active log item by step name, then complete it:
var logItem = _logItemRepo.GetAll()
.FirstOrDefault(i => i.WorkflowTask.ActionText == stepName
&& i.CompletedOn == null
&& i.IsLast == true
&& i.Status == RefListWorkflowLogItemStatus.Active);
if (logItem != null)
await _workflowHelper.ResumeUserTaskAsync(logItem.WorkflowTask,
new UserTaskResponse { Decision = "{decision-uid}", Comment = "Auto-completed" });
Check active workflow guard:
var hasActive = await _workflowRepo.CountAsync(w =>
w.Model.Id == modelId &&
w.Status == RefListWorkflowStatus.InProgress) > 0;
if (hasActive)
throw new UserFriendlyException("An active workflow already exists.");
Enqueue batch initiation to Hangfire:
BackgroundJob.Enqueue<Initiate{WorkflowName}WorkflowsJob>(
j => j.ExecuteAsync(initiateDto));
Migration table naming
| Artifact | Table Name | FK Target |
|----------|-----------|-----------|
| Instance | {Prefix}_{WorkflowName}Workflows | workflow.workflow_instances |
| Definition | {Prefix}_{WorkflowName}WorkflowDefinitions | workflow.workflow_definitions |
Use the project's established module prefix (e.g. Leave_, Pmds_, Hcm_) — inspect nearby migrations to determine the correct prefix for the target module.
Now generate the requested workflow artifact(s) based on: $ARGUMENTS
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/shesha-workflow-code-generation-mmbizkts' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/shesha-workflow-code-generation-mmbizkts/download' --output '.skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md.part' && mv '.skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md.part' '.skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Quick reference
Base classes
| Artifact | Base Class |
|---|---|
| Workflow Instance | WorkflowInstanceWithTypedDefinition<TDefinition> (Shesha.Workflow.Domain) |
| Workflow Definition | WorkflowDefinition |
| Workflow Manager | DomainService |
| Batch Workflow Manager | DomainService with generic params <TDef, TInstance, TModel> |
| Service Task | AsyncServiceTask<TWorkflow> + ITransientDependency |
| Service Task with Args | AsyncServiceTask<TWorkflow, TArgs> + ITransientDependency |
| Generic Base Task | AsyncServiceTask<TWorkflow> where TWorkflow : WorkflowInstance |
| Gateway condition ext. | static class on WorkflowInstance → returns bool |
| Action ext. methods | static class on typed {WorkflowName}Workflow → returns Task |
| Background Job | ITransientDependency (NOT ScheduledJobBase) |
| DB Migration | Migration or OneWayMigration |
Key dependencies
| Interface / Class | Namespace | Use |
|---|---|---|
ServiceTaskExecutionContext<T> | Shesha.Workflow.Tasks | Service task RunAsync parameter |
ServiceTaskExecutionContext<T, TArgs> | Shesha.Workflow.Tasks | Typed-args task RunAsync parameter |
IProcessDomainService | Shesha.Workflow.DomainServices | Start by name, complete user tasks |
ProcessAppService | Shesha.Workflow.AppServices.Processes | Suspend / Resume / Cancel |
IWorkflowHelper | Shesha.Workflow | Resume user task, emit message, get variables |
WorkflowExecutionLogItem | Shesha.Workflow.Domain | External-trigger auto-completion |
IRepository<WorkflowInstance, Guid> | Abp.Domain.Repositories | Manager manual instance creation |
ILogger<T> | Microsoft.Extensions.Logging | Structured logging in service tasks |
Key attributes
| Attribute | Used On |
|---|---|
[JoinedProperty("TableName")] | Instance, Definition |
[Prefix(UsePrefixes = false)] | Instance |
[Entity(TypeShortAlias = "...")] | Instance |
[DiscriminatorValue("slug")] | Definition |
[ServiceTaskArguments("slug")] | Typed-args service task class |
[Display(Name, Description)] | Definition, Service Task |
[Migration(YYYYMMDDHHmmss)] | Migration class |
Service task method signature
// CORRECT — override RunAsync, return Task (void), access workflow via context
public override async Task RunAsync(ServiceTaskExecutionContext<{WorkflowName}Workflow> context)
{
var workflow = context.WorkflowInstance; // typed workflow instance
// context.Pvc → IReadWriteVariables (process variable container)
await _workflowRepository.UpdateAsync(workflow);
}
// With typed arguments:
public override async Task RunAsync(
ServiceTaskExecutionContext<{WorkflowName}Workflow, {TaskName}Args> context)
{
var workflow = context.WorkflowInstance;
var args = context.Arguments; // populated by the BPMN designer
}
Common patterns
Refresh workflow (NHibernate stale state fix):
var sessionProvider = StaticContext.IocManager.Resolve<ISessionProvider>();
sessionProvider.Session.Refresh(workflow);
Sync SubStatus to Model Status:
workflow.Model.Status = ({RefListStatusEnum}?)workflow.SubStatus;
Resolve dependency in extension methods:
var repo = IocManager.Instance.Resolve<IRepository<{Entity}, Guid>>();
Check definition config in a service task:
if (workflow.Definition?.{ConfigFlag} != true)
return; // feature disabled — skip silently
Suspend a workflow:
await _processAppService.SuspendAsync(new SuspendProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Paused pending external action"
});
Resume a workflow:
await _processAppService.ResumeAsync(new ResumeProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Resumed after external action completed"
});
Cancel a workflow:
await _processAppService.CancelAsync(new CancelProcessInput
{
WorkflowInstanceId = workflowInstance.Id,
Comments = "Cancelled — reason here"
});
Start a workflow by name (programmatic):
await _processDomainService.StartByNameAsync<{WorkflowDefinition}, {WorkflowInstance}>(
new WorkflowDefinitionIdentifier({ModuleName}.Name, "{discriminator-slug}"),
async (instance) =>
{
instance.Model = myEntity;
instance.Subject = "Workflow subject text";
});
Auto-complete a workflow step from an external trigger:
// Find the active log item by step name, then complete it:
var logItem = _logItemRepo.GetAll()
.FirstOrDefault(i => i.WorkflowTask.ActionText == stepName
&& i.CompletedOn == null
&& i.IsLast == true
&& i.Status == RefListWorkflowLogItemStatus.Active);
if (logItem != null)
await _workflowHelper.ResumeUserTaskAsync(logItem.WorkflowTask,
new UserTaskResponse { Decision = "{decision-uid}", Comment = "Auto-completed" });
Check active workflow guard:
var hasActive = await _workflowRepo.CountAsync(w =>
w.Model.Id == modelId &&
w.Status == RefListWorkflowStatus.InProgress) > 0;
if (hasActive)
throw new UserFriendlyException("An active workflow already exists.");
Enqueue batch initiation to Hangfire:
BackgroundJob.Enqueue<Initiate{WorkflowName}WorkflowsJob>(
j => j.ExecuteAsync(initiateDto));
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md' && test -s '.skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/shesha-workflow' && cp -R '.skill-downloads/shesha-workflow-code-generation-mmbizkts' '.claude/skills/shesha-workflow'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/shesha-workflow-code-generation-mmbizkts'openskills read 'shesha-workflow-code-generation-mmbizkts'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/shesha-workflow-code-generation-mmbizkts/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.