agentleFS
LeanMeanCleanAppsLeanMeanCleanApps/CleanModelContextProtocol/.agents/skills/configuration-and-environments/SKILL.md

configuration-and-environments

Skill1 starsChanged 7 days agoMITView on GitHub

How settings are layered with appsettings files and environment variables, what the local and docker environments are, and how to add a new setting. Use when adding configuration, a connection string or environment-specific behaviour.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 0 are distinctive, and 6 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.

  • 6

    Very specific

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

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

    Put the safe default in appsettings.json.

    line 33
  2. Very specific:

    Read a single value with configuration.GetValue<T>("Section:Key").

    line 35
  3. Very specific:

    Document the key in docs/RUN.md if someone running the app might change it.

    line 36
  4. Very specific:

    Put secrets, passwords or tokens in any appsettings*.json file.

    line 41
  5. Very specific:

    Check IsEnvironment("local") for behaviour that should be a setting.

    line 42
  6. Very specific:

    Read Environment.GetEnvironmentVariable directly.

    line 43

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

Configuration and environments

The rule

Settings come from appsettings.json, then appsettings.<environment>.json, then environment variables (Section__Key). The base file holds safe defaults for anywhere; the environment files hold what's only true for that environment.

The Lambda template has no appsettings files or environments. Its startup builds configuration from environment variables alone, so the same keys are set as ConnectionStrings__MovieReviews and Database__SeedSampleData, and the defaults live in Startup.

EnvironmentSet byUsed for
locallaunchSettings.json (DOTNET_ENVIRONMENT=local)dotnet run on a developer machine: console logs, sample data on
dockerdocker-compose.yml and the Dockerfiledocker compose up: telemetry over OTLP through the collector to the Aspire dashboard, database in /app/data, sample data on
anything elsethe hostReal deployments: base settings only, sample data off, HSTS on

Settings that exist today:

KeyMeaning
ConnectionStrings:MovieReviewsSQLite connection string. Data Source=Name;Mode=Memory;Cache=Shared keeps everything in memory.
Database:SeedSampleDataSeed sample data into an empty database (sample-data).
Authentication:Authority, Authentication:AudienceOnly in a solution created with --include-auth: turn on token authentication (optional-token-auth). MCP also has Authentication:Scopes, published in its protected resource metadata.
Serilog:*Logging (serilog).

Steps

  1. Put the safe default in appsettings.json. If the default is "off" or empty, still write the key so people can find it.
  2. Override it only in the environment files that need a different value.
  3. Read a single value with configuration.GetValue<T>("Section:Key"); read a group into a settings class with a SectionName constant and a FromConfiguration(IConfiguration) method, like AuthenticationSettings in a solution with authentication.
  4. Document the key in docs/RUN.md if someone running the app might change it.
  5. Tests override settings in memory (integration-tests), never by editing the JSON.

Don't

  • Put secrets, passwords or tokens in any appsettings*.json file. Use environment variables or user secrets.
  • Check IsEnvironment("local") for behaviour that should be a setting. Add a setting instead.
  • Read Environment.GetEnvironmentVariable directly. Go through IConfiguration.

Check

dotnet test

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.