Skip to content
Back to skills

Add Infra Concern

ASecurity

Adds an external integration to Govern (email provider, cache, Telegram, storage, HTTP API client…): abstraction in Application.Common, implementation folder in Infrastructure, options, DI, health check, test fake. Use when a feature needs to talk to something outside the process.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 19, 2026
developmentgoazureapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 19, 2026

npx -y skills add andy-dendy-repo/govern --skill add-infra-concern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Infra Concern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Infra Concern
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/andy-dendy-repo-add-infra-concern/badge)](https://www.skillsdirectory.com/skills/andy-dendy-repo-add-infra-concern)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-infra-concern
description: >
  Adds an external integration to Govern (email provider, cache, Telegram, storage, HTTP API client…):
  abstraction in Application.Common, implementation folder in Infrastructure, options, DI, health check, test fake.
  Use when a feature needs to talk to something outside the process.
---

# Add an infrastructure concern

Reference implementation: email (`IEmailService` → `Infrastructure/Emailing/Services/LoggingEmailService.cs`, faked by `tests/Govern.IntegrationTests/Fixtures/FakeEmailService.cs`).

Read first: `architecture.md` (Infrastructure template), `security.md` (secrets), `logging.md`.

## 1. Abstraction: `src/Govern.Application.Common/Abstractions/I[Concern]Service.cs`
- Describe what the application needs ("send an email"), not the vendor API. Keep it small, async, with a `CancellationToken`.
- Put the messages and models it uses in `Application.Common/Models/`.

## 2. Implementation: `src/Govern.Infrastructure/[Concern]/`
- The folder uses only UF sub-folders: `Services/[Vendor][Concern]Service.cs` (`internal sealed`), `Options/[Concern]Options.cs`, `Models/`, and so on.
- **Options:** bound from the `[Concern]` config section with `ValidateDataAnnotations().ValidateOnStart()`. Secrets (API keys) come from user-secrets locally and Key Vault in Azure. Add them to `infra/modules/keyVault.bicep` and the Web App app settings as Key Vault references. Never put them in appsettings.
- **HTTP APIs:** a typed `HttpClient` via `services.AddHttpClient<...>()`, with a timeout and resilience (`Microsoft.Extensions.Http.Resilience`, added with `dotnet add package`). Never `new HttpClient()`.
- **Logging:** `[LoggerMessage]`, with no secrets or personal data in logs.

## 3. Registration
- In `src/Govern.Infrastructure/DependencyInjection.cs`, register the service. Match the lifetime to its dependencies: a singleton for stateless clients, scoped when it uses scoped services.
- If the application can't work without it, add a health check (`services.AddHealthChecks().Add...(name, tags: ["ready"])`).

## 4. Tests
- Integration tests never call the real external service. Add a fake in `tests/Govern.IntegrationTests/Fixtures/Fake[Concern]Service.cs` and swap it in `GovernApiFactory.ConfigureWebHost` (`RemoveAll` + `AddSingleton`). Assert on what the fake captured.
- Unit tests only if the logic lives in `Govern.Utils`.

## 5. Docs and infra
- `docs/operations/configuration.md`: the new config keys and where their values come from.
- `infra/`: the new Azure resources or secrets. Keep `az bicep build --file infra/main.bicep` clean.
- If the concern calls out to external services or handles credentials, run the `security-auditor` agent.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.