agentleFS
isabelle-barpisabelle-barp/agent-brain/skills/stack-azure/SKILL.md

stack-azure

Skill0 starsChanged 5 months agoApache-2.0View on GitHub

Azure implementation patterns for agents working in projects whose docs/TECH_STACK.md lists `azure`. Load when implementing, testing, reviewing, or deploying code on this stack.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    DON'T use connection strings with embedded keys where AAD auth exists (Service Bus, Blob, Key Vault, Cosmos all support it).

    line 22
  2. Distinctive:

    Dead-letter queues are mandatory: Every consumer declares max delivery count and a DLQ handling/monitoring strategy.

    line 28
  3. Distinctive:

    DON'T hit real cloud resources from tests.

    line 54
  4. Very specific:

    All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md.

    line 80

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Stack: Azure

Seeded entirely from best practice — no Azure usage exists in the workspace yet; refine via repository-discovery when a project adopts it. Where the host project's docs/ARCHITECTURE.md/docs/DEV_SETUP.md contradict a default below, the generated docs win.

When this applies

Detection markers (any of):

  • docs/TECH_STACK.md ## Detected stacks lists azure
  • Dependencies: @azure/identity, @azure/service-bus, @azure/storage-blob, @azure/keyvault-secrets, @azure/cosmos, @azure/functions
  • Files: *.bicep, azure-pipelines.yml, host.json/function.json (Azure Functions), Terraform with the azurerm provider
  • CI/CD env: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID referenced in pipeline or .env.example

Implementation patterns

Credentials (non-negotiable)

  • DefaultAzureCredential everywhere. Managed identity in cloud, az login locally — one code path, zero secrets in config.
  • DON'T use connection strings with embedded keys where AAD auth exists (Service Bus, Blob, Key Vault, Cosmos all support it). A connection string in code or .env is a review BLOCKER, not a style nit.
  • Key Vault is wired through the config layer (a ConfigService-backed provider that resolves secrets at boot), never env-baked at build time. Build artifacts must be environment-agnostic.

Service Bus discipline

  • Peek-lock processing only — explicit completeMessage/abandonMessage; never receive-and-delete for anything the spec calls durable.
  • Handlers are idempotent. Delivery is at-least-once; a redelivered message must not double-apply. Idempotency key from messageId (or a business key), checked at the persistence boundary — same pattern as the DB stacks' idempotencyKey unique index.
  • Dead-letter queues are mandatory. Every consumer declares max delivery count and a DLQ handling/monitoring strategy. A consumer with no DLQ story silently loses poison messages.
  • Ordered per-entity processing uses sessions (sessionId = the entity key). Ordering claims without sessions are fiction under concurrent consumers.
  • Map transport errors to typed domain errors at the adapter boundary; the repository/handler layer never sees raw ServiceBusError.

Blob Storage

  • SAS tokens are short-lived, scoped to container + permission actually needed (user-delegation SAS preferred — backed by AAD, not account keys).
  • Lifecycle management (tiering, retention, deletion) is declared in IaC alongside the container — not left to "we'll clean it up later".

Compute choice

  • Azure Functions for event-driven, bursty, per-message work (queue triggers, timers, webhooks). Cold start and 10-min-ish execution caps are the constraints to design around.
  • Container Apps for long-running NestJS services (persistent connections, warm DI container, WebSockets, steady traffic). Don't contort a NestJS monolith into Functions; don't run an always-on container for a nightly timer.
  • Record the choice and its rationale per service in docs/ARCHITECTURE.md.

Infrastructure as Code (non-negotiable)

  • All Azure resources exist in Bicep or Terraform — pick one per project, record it in docs/TECH_STACK.md. Portal changes are drift and drift is a violation; if a portal hotfix happens, it is backported to IaC in the same working day.
  • Least-privilege RBAC per service: each workload gets its own managed identity with role assignments scoped to the exact resources it touches (Storage Blob Data Contributor on one container, not Contributor on the subscription). Role assignments live in IaC next to the resource.

Multi-tenant orientation

  • Tenant isolation is enforced at the platform layer, never only in code: RBAC scoping per tenant boundary, plus per-tenant resource naming or partitioning (per-tenant containers/queues, or partition keys prefixed with tenant id) — pick per project, record in docs/ARCHITECTURE.md.
  • A query/message path where forgetting a tenant filter in application code still reaches another tenant's data is a design BLOCKER — same last-line-of-defense posture as RLS on the PostgreSQL stack.

Testing on this stack

  • Unit: @azure/* clients are mocked at the service seam (the adapter/repository boundary) — never deep-mock SDK internals. The seam is yours; the SDK is not.
  • Integration: Azurite emulator (blob/queue/table) via Testcontainers — real SDK client against a real emulator, per the same discipline as .claude/rules/TESTING_INTEGRATION.md (tests own their data, tests clean up, concurrency ACs fire parallel operations).
  • Service Bus has no emulator worth trusting — stub the transport at the seam and assert the contract instead: deliver the same message twice through the handler, assert single application (idempotency); deliver a poison message, assert it is abandoned/dead-lettered, not swallowed.
  • DON'T hit real cloud resources from tests. Ever. Tests that need a subscription are deploy-time smoke checks (below), not part of the suite.

Spec validation checks

Stack-specific checks the spec validators delegate here:

CheckSeverity
Secrets/connection strings appear in spec, code, or .env committed materialBLOCKER
Queue/topic consumers without declared idempotency strategy + DLQ handlingBLOCKER
Infra the spec mandates (queue, container, function, role assignment) with no IaC definitionBLOCKER
Storage containers without lifecycle/retention policy statedWARNING
Ordered-processing requirements without a session strategyWARNING
No alerting/dead-letter monitoring stated for async pathsWARNING

Live validation commands

R-VAL-02 matrix adapted to Azure — exact invocations live in docs/DEV_SETUP.md; obligations:

CheckTypical shape
IaC compiles/plans clean before commitaz bicep build --file <main>.bicep / terraform plan (no errors, plan reviewed)
Deploy to the dev resource groupdeploy target per DEV_SETUP
Smoke with read-only az CLIaz servicebus queue show, az functionapp list, az storage container list per DEV_SETUP
Integration tests against Azuriteaffected test target per DEV_SETUP

All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.