Implements cooperative cancellation in ABP applications via ICancellationTokenProvider, covering ambient token propagation, HttpContext.RequestAborted integration, and explicit CancellationToken passing through services and repositories.
Ships in abp-infrastructure. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Prefer an explicit CancellationToken parameter at public async boundaries and pass it through every cancellable call. Use ICancellationTokenProvider when ABP ambient cancellation must reach code that does not receive a token directly.
HttpContext.RequestAborted token indirectly.public class ProductAppService : ApplicationService
{
private readonly IRepository<Product, Guid> _productRepository;
private readonly IExternalCatalog _externalCatalog;
public ProductAppService(
IRepository<Product, Guid> productRepository,
IExternalCatalog externalCatalog)
{
_productRepository = productRepository;
_externalCatalog = externalCatalog;
}
public async Task RefreshAsync(
Guid productId,
CancellationToken cancellationToken = default)
{
var product = await _productRepository.GetAsync(
productId,
cancellationToken: cancellationToken);
var details = await _externalCatalog.GetAsync(
product.ExternalId,
cancellationToken);
product.Update(details);
await _productRepository.UpdateAsync(
product,
cancellationToken: cancellationToken);
}
}
Do not replace a received token with CancellationToken.None, and do not stop propagation at a repository or external API call.
ICancellationTokenProvider exposes:
CancellationToken Token { get; }
IDisposable Use(CancellationToken cancellationToken);
public class CatalogImporter : ITransientDependency
{
private readonly ICancellationTokenProvider _cancellationTokenProvider;
public CatalogImporter(ICancellationTokenProvider cancellationTokenProvider)
{
_cancellationTokenProvider = cancellationTokenProvider;
}
public async Task ImportAsync()
{
var token = _cancellationTokenProvider.Token;
token.ThrowIfCancellationRequested();
await ImportCoreAsync(token);
}
}
Read the provider token near the operation and pass that captured token through the call chain.
AbpThreadingModule registers the singleton NullCancellationTokenProvider.Instance. Its token is CancellationToken.None unless an ambient override is active.HttpContextCancellationTokenProvider replaces that service. It returns the override token first, otherwise HttpContext.RequestAborted, otherwise CancellationToken.None when no HTTP context exists.ABP repository bases expose GetCancellationToken(preferredValue), which calls FallbackToProvider. A supplied cancellable token wins; default and CancellationToken.None fall back to the provider token. EF Core and MongoDB unit-of-work infrastructure use the same pattern.
Use stores an ambient override and returns a scope that must be disposed:
using (_cancellationTokenProvider.Use(cancellationToken))
{
await RunPipelineAsync();
}
The override flows through the ambient async context. Keep the scope as narrow as possible and never forget using.
RequestAborted.CancellationToken.None unless explicitly overridden.Use restores the previous token after disposal, including nested async calls.CancellationToken.None.CancellationToken.None expecting to suppress ambient cancellation — FallbackToProvider treats it like default and uses the provider token.Use without disposing the returned scope — the override can leak into later work in the same ambient context.OperationCanceledException as a normal failure — preserve cancellation semantics unless the boundary explicitly translates them.CancellationTokenSource without linking the caller token — it disconnects the operation from upstream cancellation.What SKILL.md sets; muted values are Claude Code's defaults
16 skills in this plugin
/check-simple-stateComposable ABP simple-state conditions on definitions and UI state objects. USE FOR: ISimpleStateChecker, ISimpleStateCheckerManager, permission/feature/authentication conditions on IHasSimpleStateCheckers. DO NOT USE FOR: tenant/edition feature values (manage-settings-and-features); permission authorization of a service call (permissions-and-authorization); startup-time module capabilities (toggle-global-features)./configure-audit-loggingABP audit logging: per-request log of requests, actions, entity change history, exceptions. USE FOR: enabling/disabling auditing, GET request logging, entity change history, AuditLogContributors, ignoring types, [Audited]/[DisableAuditing], manual scopes with IAuditingManager. DO NOT USE FOR: general application/UI logging or Serilog (configure-logging); setting/feature values (manage-settings-and-features); background jobs/workers/handlers (background-jobs-and-events)./configure-loggingABP startup, runtime, exception logging, and the startup-template Serilog bridge. USE FOR: typed ILogger in ABP services; IInitLoggerFactory/GetInitLogger startup buffering; ABP exceptions via LogException; Serilog via UseSerilog. DO NOT USE FOR: audit-log persistence and entity history (configure-audit-logging); distributed traces and metrics (out of scope, wire the OpenTelemetry .NET SDK directly); exception-to-HTTP response details (handle-validation-and-errors)./abp-infrastructure:use-cancellation-tokensfrom abp-infrastructure
npx claudepluginhub abpframework/abp-skills --plugin abp-infrastructureOther plugins' skills for the same job