Diagnoses and implements ABP cross-cutting behavior via Castle dynamic proxies and IAbpInterceptor. Use when validation, unit of work, authorization, auditing, or feature interceptors are not running, or to add custom before/after logic.
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.
ABP attaches IAbpInterceptor implementations while services are registered, then the Autofac/Castle integration creates either an interface proxy or a class proxy. The call must cross that proxy for an interceptor to run.
[UnitOfWork], [Authorize], [Audited], or [RequiresFeature] is not taking effect on a service call.IServiceCollection.OnRegistered.IAbpMethodInvocation.Implement IAbpInterceptor.InterceptAsync(IAbpMethodInvocation) directly or derive from AbpInterceptor. Call ProceedAsync() exactly once to continue the chain. The invocation also exposes Arguments, ArgumentsDictionary, GenericArguments, TargetObject, Method, and ReturnValue.
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
public class ExecutionTimeInterceptor : AbpInterceptor, ITransientDependency
{
private readonly ILogger<ExecutionTimeInterceptor> _logger;
public ExecutionTimeInterceptor(ILogger<ExecutionTimeInterceptor> logger)
{
_logger = logger;
}
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
var stopwatch = Stopwatch.StartNew();
try
{
await invocation.ProceedAsync();
}
finally
{
_logger.LogInformation(
"{MethodName} completed in {ElapsedMilliseconds} ms",
invocation.Method.Name,
stopwatch.ElapsedMilliseconds);
}
}
}
Omitting ProceedAsync() intentionally short-circuits the target and all later interceptors. Use try/finally when after-logic must run for both success and failure.
Choose an explicit marker or attribute. A marker interface keeps the selector simple and avoids intercepting unrelated services.
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Collections;
using Volo.Abp.DependencyInjection;
public interface IExecutionTimeEnabled
{
}
public static class ExecutionTimeInterceptorRegistrar
{
public static void RegisterIfNeeded(IOnServiceRegistredContext context)
{
if (typeof(IExecutionTimeEnabled).IsAssignableFrom(context.ImplementationType))
{
context.Interceptors.TryAdd<ExecutionTimeInterceptor>();
}
}
}
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistered(ExecutionTimeInterceptorRegistrar.RegisterIfNeeded);
}
ExecutionTimeInterceptor is conventionally registered because it implements ITransientDependency. Register the OnRegistered callback early enough to observe the target services; PreConfigureServices is the safe module-level location.
Each built-in module installs an OnRegistered callback. Its registrar tests the implementation type and adds an interceptor only when needed:
| Concern | Registrar trigger |
|---|---|
| Validation | Type implements IValidationEnabled and is not in DynamicProxyIgnoreTypes. |
| Unit of work | UnitOfWorkHelper.IsUnitOfWorkType(...) returns true and the type is not ignored. |
| Authorization | Type or any method has [Authorize] and the type is not ignored. |
| Auditing | The type is auditable by default, has [Audited], implements IAuditingEnabled, or has an audited method, subject to ignore rules. |
| Features | Type or any method has [RequiresFeature] and the type is not ignored. |
The registrar decision only attaches the interceptor to the service registration. The interceptor itself performs the runtime check and behavior.
All of these must hold:
OnRegistered callback is active.new bypasses the proxy.virtual, non-sealed class).DisableAbpClassInterceptors, a selector, or DisableAbpFeaturesAttribute.DisableInterceptors.AbpAutofacModule depends on AbpCastleCoreModule; the latter registers the async interceptor adapter.For an interface proxy, inject and call the interface. For a class proxy, make the intercepted public/protected method virtual. A non-virtual class method executes normally but Castle cannot override it.
IServiceScope; do not instantiate it directly.finally logic runs.virtual — class proxies cannot intercept it. Inject an exposed interface or make the method overridable.new — only the container-resolved proxy carries interceptors.PreConfigureServices.ImplementationType — IOnServiceRegistredContext.ImplementationType is what built-in registrars inspect.ProceedAsync() is called zero or multiple times — zero short-circuits execution; multiple calls execute the downstream chain repeatedly.DynamicProxyIgnoreTypes, DisableAbpClassInterceptors, and DisableAbpFeaturesAttribute before changing business code.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
abp, castle-dynamic-proxy, interceptor, cross-cutting-concerns, aop
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)./encrypt-stringsABP IStringEncryptionService with compatible passphrase, salt, IV, key-size options. USE FOR: reversible encryption used by ABP infra; AbpStringEncryptionOptions defaults and config keys; Encrypt/Decrypt null behavior; encrypted setting values. DO NOT USE FOR: password hashing, signing, token generation, or crypto protocol design; defining encrypted ABP settings (manage-settings-and-features)./generate-guidsABP IGuidGenerator entity IDs and sequential GUID layout for the active database provider. USE FOR: IGuidGenerator.Create; SequentialGuidGenerator; SimpleGuidGenerator; AbpSequentialGuidGeneratorOptions.DefaultSequentialGuidType; SequentialAtEnd / SequentialAsString / SequentialAsBinary. DO NOT USE FOR: cache keys and invalidation (cache-entities); cryptographic tokens or secrets (encrypt-strings); schema and repository design./handle-dates-and-timeABP DateTime, UTC normalization, time zones, persistence. USE FOR: IClock and AbpClockOptions; Utc/Local/Unspecified; Clock.Normalize; EF Core DateTime converters and DisableDateTimeNormalization; per-request tenant/user timezone; ITimezoneProvider Windows/IANA. DO NOT USE FOR: timezone settings (manage-settings-and-features); audit-log persistence (configure-audit-logging); multi-tenancy resolution (configure-multi-tenancy)./abp-infrastructure:use-interceptors-and-dynamic-proxyfrom abp-infrastructure
npx claudepluginhub abpframework/abp-skills --plugin abp-infrastructureOther plugins' skills for the same job