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
In this repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- flow-adoptionSkill
- flow-legacy-migrationSkill
- stack-awsSkill
- stack-design-systemSkill
- stack-gcpSkill
- stack-javaSkill
- stack-kafkaSkill
- stack-mongodbSkill
- stack-natsSkill
- stack-nestjsSkill
- stack-nextjs-reactSkill
- stack-nxSkill
- stack-playwrightSkill
- stack-postgresqlSkill
- stack-quarkusSkill
- stack-react-nativeSkill
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
- Very specific: line 22
DON'T use connection strings with embedded keys where AAD auth exists (Service Bus, Blob, Key Vault, Cosmos all support it).
- Distinctive: line 28
Dead-letter queues are mandatory: Every consumer declares max delivery count and a DLQ handling/monitoring strategy.
- Distinctive: line 54
DON'T hit real cloud resources from tests.
- Very specific: line 80
All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md.
≈ “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.
Files
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.mdcontradict a default below, the generated docs win.
When this applies
Detection markers (any of):
docs/TECH_STACK.md## Detected stackslistsazure- 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 theazurermprovider - CI/CD env:
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_SUBSCRIPTION_IDreferenced in pipeline or.env.example
Implementation patterns
Credentials (non-negotiable)
DefaultAzureCredentialeverywhere. Managed identity in cloud,az loginlocally — 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
.envis 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'idempotencyKeyunique 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 Contributoron one container, notContributoron 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:
| Check | Severity |
Secrets/connection strings appear in spec, code, or .env committed material | BLOCKER |
| Queue/topic consumers without declared idempotency strategy + DLQ handling | BLOCKER |
| Infra the spec mandates (queue, container, function, role assignment) with no IaC definition | BLOCKER |
| Storage containers without lifecycle/retention policy stated | WARNING |
| Ordered-processing requirements without a session strategy | WARNING |
| No alerting/dead-letter monitoring stated for async paths | WARNING |
Live validation commands
R-VAL-02 matrix adapted to Azure — exact invocations live in docs/DEV_SETUP.md; obligations:
| Check | Typical shape |
| IaC compiles/plans clean before commit | az bicep build --file <main>.bicep / terraform plan (no errors, plan reviewed) |
| Deploy to the dev resource group | deploy target per DEV_SETUP |
| Smoke with read-only az CLI | az servicebus queue show, az functionapp list, az storage container list per DEV_SETUP |
| Integration tests against Azurite | affected test target per DEV_SETUP |
All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md.
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
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.

