agentleFS
andy-dendy-repoandy-dendy-repo/govern/.claude/skills/add-infra-concern/SKILL.md

add-infra-concern

Skill2 starsChanged 33 days agoMITView on GitHub

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.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

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

    line 13
  2. Very specific:

    Put the messages and models it uses in Application.Common/Models/.

    line 17
  3. Very specific:

    If the application can't work without it, add a health check (services.AddHealthChecks().Add...(name, tags: ["ready"])).

    line 27
  4. Very specific:

    If the concern calls out to external services or handles credentials, run the security-auditor agent.

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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

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.

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.