Loading...
Loading...
Bitwarden server code conventions for C# and .NET. Use when working in the server repo, creating commands, queries, services, or API endpoints.
npx skill4agent add bitwarden/ai-plugins writing-server-codeserversrc/Apisrc/Identitysrc/Coresrc/InfrastructureCipherServiceCreateCipherCommandGetOrganizationApiKeyQueryRotateOrganizationApiKeyCommandIFusionCacheIDistributedCacheCoreHelpers.GenerateComb()Guid.NewGuid()TryAdd*TryAddScopedTryAddTransientnamespace Bit.Core.Vault;namespace Bit.Core.Vault { ... }!requiredAsyncCreateAsyncCreateTaskActionResult<T>IActionResultT[Theory, BitAutoData][AutoData]SutProvider<T>Substitute.For<T>()// CORRECT — sequential COMB prevents index fragmentation
var id = CoreHelpers.GenerateComb();
// WRONG — random GUIDs fragment clustered indexes
var id = Guid.NewGuid();// CORRECT — idempotent, won't duplicate
services.TryAddScoped<ICipherService, CipherService>();
// WRONG — silently duplicates registration, last-wins causes subtle bugs
services.AddScoped<ICipherService, CipherService>();// CORRECT — file-scoped
namespace Bit.Core.Vault.Commands;
// WRONG — block-scoped
namespace Bit.Core.Vault.Commands
{
// ...
}