Agent skill

Abp Multi Tenancy

by abpframework in abpframework/abp

ABP Multi-Tenancy - IMultiTenant interface, CurrentTenant, CurrentTenant.Change(), DataFilter.Disable(IMultiTenant), tenant resolution order, database-per-tenant.

LGPL-3.0Auto-check passedBackend & APIs

Install Abp Multi Tenancy

skills CLI
$ npx skills add abpframework/abp --skill abp-multi-tenancy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install abpframework/abp abp-multi-tenancy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/abpframework/abp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/abp-multi-tenancy .claude/skills/abp-multi-tenancy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
abp-multi-tenancy
GitHub stars
14k
Token cost
~1.2k tokens
SKILL.md length
245 words
Files
1
Skills in repo
18
Repo updated
First seen
Licence
LGPL-3.0

At a glance

ABP Multi-Tenancy - IMultiTenant interface, CurrentTenant, CurrentTenant.Change(), DataFilter.Disable(IMultiTenant), tenant resolution order, database-per-tenant.

  • Works in 6 steps: Always implement IMultiTenant for… → Never manually filter by TenantId - ABP… → Don't change TenantId after creation -… → …
  • Working with multi-tenant features
  • SKILL.md covers Making Entities Multi-Tenant, Accessing Current Tenant, Switching Tenant Context and Disabling Multi-Tenant Filter, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Abp Multi Tenancy is an agent skill from abpframework/abp. ABP Multi-Tenancy - IMultiTenant interface, CurrentTenant, CurrentTenant.Change(), DataFilter.Disable(IMultiTenant), tenant resolution order, database-per-tenant. Use when working with multi-tenant features, tenant-specific data isolation, or switching tenant context.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Multi-tenancy. The repository describes itself as: Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides… The licence is LGPL-3.0.

When your agent uses it

  • Working with multi-tenant features
  • Tenant-specific data isolation
  • Switching tenant context

Example prompts

  • “/abp-multi-tenancy”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Always implement IMultiTenant for tenant-specific entities
  2. Never manually filter by TenantId - ABP does it automatically
  3. Don't change TenantId after creation - it moves entity between tenants
  4. Use Change() scope carefully - nested scopes are supported
  5. Test both host and tenant contexts - ensure proper data isolation
  6. Consider nullable TenantId - entity may be host-only or shared

What it can do on your machine

Read from SKILL.md and the folder at commit a54b599. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • abp.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Abp Multi Tenancy loads about 1.2k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 245 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from abpframework/abp at commit a54b599, republished under its LGPL-3.0 licence (© abpframework). 245 words, ~1,184 tokens.

Download SKILL.mdSave it as .claude/skills/abp-multi-tenancy/SKILL.md (or your agent's skills folder).
name
abp-multi-tenancy
description
ABP Multi-Tenancy - IMultiTenant interface, CurrentTenant, CurrentTenant.Change(), DataFilter.Disable(IMultiTenant), tenant resolution order, database-per-tenant. Use when working with multi-tenant features, tenant-specific data isolation, or switching tenant context.

ABP Multi-Tenancy

Docs: https://abp.io/docs/latest/framework/architecture/multi-tenancy

Making Entities Multi-Tenant

Implement IMultiTenant interface to make entities tenant-aware:

csharp
public class Product : AggregateRoot<Guid>, IMultiTenant
{
    public Guid? TenantId { get; set; } // Required by IMultiTenant

    public string Name { get; private set; }
    public decimal Price { get; private set; }

    protected Product() { }

    public Product(Guid id, string name, decimal price) : base(id)
    {
        Name = name;
        Price = price;
        // TenantId is automatically set from CurrentTenant.Id
    }
}

Key points:

  • TenantId is nullable - null means entity belongs to Host
  • ABP automatically filters queries by current tenant
  • ABP automatically sets TenantId when creating entities

Accessing Current Tenant

Use CurrentTenant property (available in base classes) or inject ICurrentTenant:

csharp
public class ProductAppService : ApplicationService
{
    public async Task DoSomethingAsync()
    {
        // Available from base class
        var tenantId = CurrentTenant.Id;        // Guid? - null for host
        var tenantName = CurrentTenant.Name;    // string?
        var isAvailable = CurrentTenant.IsAvailable; // true if Id is not null
    }
}

// In other services
public class MyService : ITransientDependency
{
    private readonly ICurrentTenant _currentTenant;
    public MyService(ICurrentTenant currentTenant) => _currentTenant = currentTenant;
}

Switching Tenant Context

Use CurrentTenant.Change() to temporarily switch tenant (useful in host context):

csharp
public class ProductManager : DomainService
{
    private readonly IRepository<Product, Guid> _productRepository;

    public async Task<long> GetProductCountAsync(Guid? tenantId)
    {
        // Switch to specific tenant
        using (CurrentTenant.Change(tenantId))
        {
            return await _productRepository.GetCountAsync();
        }
        // Automatically restored to previous tenant after using block
    }

    public async Task DoHostOperationAsync()
    {
        // Switch to host context
        using (CurrentTenant.Change(null))
        {
            // Operations here are in host context
        }
    }
}

Important: Always use Change() with a using statement.

Disabling Multi-Tenant Filter

To query all tenants' data (only works with single database):

csharp
public class ProductManager : DomainService
{
    public async Task<long> GetAllProductCountAsync()
    {
        // DataFilter is available from base class
        using (DataFilter.Disable<IMultiTenant>())
        {
            return await _productRepository.GetCountAsync();
            // Returns count from ALL tenants
        }
    }
}

Note: This doesn't work with separate databases per tenant.

Database Architecture Options

ApproachDescriptionUse Case
Single DatabaseAll tenants share one databaseSimple, cost-effective
Database per TenantEach tenant has dedicated databaseData isolation, compliance
HybridMix of shared and dedicatedFlexible, premium tenants

Connection strings are configured per tenant in Tenant Management module.

Best Practices

  1. Always implement IMultiTenant for tenant-specific entities
  2. Never manually filter by TenantId - ABP does it automatically
  3. Don't change TenantId after creation - it moves entity between tenants
  4. Use Change() scope carefully - nested scopes are supported
  5. Test both host and tenant contexts - ensure proper data isolation
  6. Consider nullable TenantId - entity may be host-only or shared

Enabling Multi-Tenancy

csharp
Configure<AbpMultiTenancyOptions>(options =>
{
    options.IsEnabled = true; // Enabled by default in ABP templates
});

Check MultiTenancyConsts.IsEnabled in your solution for centralized control.

Tenant Resolution

ABP resolves current tenant from (in order):

  1. Current user's claims
  2. Query string (?__tenant=...)
  3. Route (/{__tenant}/...)
  4. HTTP header (__tenant)
  5. Cookie (__tenant)
  6. Domain/subdomain (if configured)

For subdomain-based resolution:

csharp
Configure<AbpTenantResolveOptions>(options =>
{
    options.AddDomainTenantResolver("{0}.mydomain.com");
});

© abpframework, LGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/abp-multi-tenancy of abpframework/abp.

Open the folder on GitHubat commit a54b599

Compare with similar skills

Abp Multi Tenancy next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Abp Multi Tenancy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Abp Multi Tenancy this skillabpframework/abp14k—~1.2kAutomated safety check: PassLGPL-3.0
PR Review Provideryansongda/pay5.4k—~2.4kAutomated safety check: PassMIT
Django Access Reviewgetsentry/skills1k3 repos~2.6kAutomated safety check: NotesApache-2.0
Backend Dev Guidelineslitefuse/litefuse1001 repos~5.8kAutomated safety check: PassCustom licence
Ecto Persistence Patternsgeorgeguimaraes/elixir-agent-tools184—~1.2kAutomated safety check: PassApache-2.0
Rails Security Multitenancymarckohlbrugge/37signals-skills724—~1.7kAutomated safety check: PassNone

Similar skills

  • PR Review Provider

    yansongda/pay

    A skill your agent uses when reviewing PRs that add or modify a payment Provider in yansongda/pay - covers plugin pipeline, multi-tenant safety, signature verification, docs, and naming conventions.

    5.4k GitHub stars~2.4k tokensUpdated 10 days ago
    Backend & APIsAuto-check passed
  • Django Access Review

    getsentry/skills

    Official

    Django access control and IDOR security review. An agent skill from getsentry/skills.

    1k GitHub starsUsed in 3 repos~2.6k tokens
    Backend & APIsAuto-check: notes
  • Backend Dev Guidelines

    litefuse/litefuse

    Comprehensive backend development guide for Litefuse's Next.js 14/tRPC/Express/TypeScript monorepo.

    100 GitHub starsUsed in 1 repo~5.8k tokens
    Backend & APIsAuto-check passed
  • Ecto Persistence Patterns

    georgeguimaraes/elixir-agent-tools

    Designs and debugs Elixir persistence with Ecto: schemas, changesets, queries, preloads, migrations and multi-tenancy, kept within application contexts.

    184 GitHub stars~1.2k tokensUpdated 18 days ago
    Backend & APIsAuto-check passed
  • Rails Security Multitenancy

    marckohlbrugge/37signals-skills

    Apply Rails security and multi-tenant safety practices including scoped queries, SSRF defenses, rate limiting, and tenant-scoped realtime updates.

    724 GitHub stars~1.7k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Decides whether a feature belongs in the application or in one of five shared Arandu modules before adding permissions, wallets, tags, Markdown rendering or API docs.

    281 GitHub stars~1.8k tokensUpdated 4 days ago
    Backend & APIsAuto-check passed

More from abpframework/abp

All 18 skills in this repo
  • Abp Angular

    abpframework/abp

    ABP Angular UI patterns - generate-proxy, ListService, PermissionGuard, abpLocalization pipe, ConfirmationService, ToasterService, ConfigStateService.

    14k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Abp App Nolayers

    abpframework/abp

    ABP Single-Layer (No-Layers / nolayers) application template - single project structure, feature-based file organization, no separate Domain/Application.Contracts projects.

    14k GitHub stars~575 tokensUpdated today
    Auto-check passed
  • Abp Application Layer

    abpframework/abp

    ABP Application Services, DTOs, CRUD service, object mapping (Mapperly/AutoMapper), validation, error handling.

    14k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Abp Authorization

    abpframework/abp

    ABP permission system - PermissionDefinitionProvider, [Authorize] attribute, CheckPolicyAsync, IsGrantedAsync, ICurrentUser, IPermissionManager, multi-tenancy side.

    14k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Abp Blazor

    abpframework/abp

    ABP Blazor UI patterns - AbpComponentBase, AbpCrudPageBase, DataGrid, IMenuContributor, Message/Notify, Validations, JavaScript interop.

    14k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Abp CLI

    abpframework/abp

    ABP CLI commands - generate-proxy, install-libs, add-package-ref, new-module, install-module, abp update, abp clean, abp suite generate.

    14k GitHub stars~633 tokensUpdated today
    Auto-check passed

Categories

Questions about Abp Multi Tenancy

What does Abp Multi Tenancy do?

ABP Multi-Tenancy - IMultiTenant interface, CurrentTenant, CurrentTenant.Change(), DataFilter.Disable(IMultiTenant), tenant resolution order, database-per-tenant. Abp Multi Tenancy is an agent skill from abpframework/abp.Disable(IMultiTenant), tenant resolution order, database-per-tenant.

When should I use Abp Multi Tenancy?

Abp Multi Tenancy fits situations like: working with multi-tenant features; tenant-specific data isolation; switching tenant context.

How do I install Abp Multi Tenancy in Claude Code?

Run `npx skills add abpframework/abp --skill abp-multi-tenancy -a claude-code`. Or copy the skill folder (.agents/skills/abp-multi-tenancy in abpframework/abp) into .claude/skills/abp-multi-tenancy in your project. Claude Code loads it when a task matches its description.

How do I install Abp Multi Tenancy in Codex?

Run `npx skills add abpframework/abp --skill abp-multi-tenancy -a codex`. Or copy the skill folder (.agents/skills/abp-multi-tenancy in abpframework/abp) into .agents/skills/abp-multi-tenancy in your project. Codex loads it when a task matches its description.

Can I use Abp Multi Tenancy in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add abpframework/abp --skill abp-multi-tenancy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/abp-multi-tenancy, .gemini/skills/abp-multi-tenancy, .github/skills/abp-multi-tenancy and .opencode/skills/abp-multi-tenancy in your project.

What does Abp Multi Tenancy need to run?

SKILL.md names no scripts, command-line tools or credentials: Abp Multi Tenancy is instructions for the agent only.

Does Abp Multi Tenancy access the network?

SKILL.md names 1 domain. As links in the text: abp.io. This is read from the text; nothing was executed.

Is Abp Multi Tenancy safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Abp Multi Tenancy use?

Abp Multi Tenancy is published under the LGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Abp Multi Tenancy use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Abp Multi Tenancy?

Skills that share tags, products or a category with Abp Multi Tenancy: PR Review Provider (yansongda/pay, 5.4k stars), Django Access Review (getsentry/skills, 1k stars), Backend Dev Guidelines (litefuse/litefuse, 100 stars) and Ecto Persistence Patterns (georgeguimaraes/elixir-agent-tools, 184 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Abp Multi Tenancy?

abpframework (a GitHub organization) maintains it in abpframework/abp, which has 14,443 GitHub stars. The repository holds 18 skills in this directory. The repository was last updated on October 8, 2026.

Source: abpframework/abp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.