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.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-a-use-caseSkill
- api-conventionsSkill
- branches-and-pull-requestsSkill
- cancellationSkill
- ci-for-your-solutionSkill
- ci-pipelineSkill
- clean-architecture-layersSkill
- coverageSkill
- csharp-house-styleSkill
- data-access-ef-coreSkill
- database-migrationsSkill
- docker-and-composeSkill
- docs-and-voiceSkill
- errors-and-exceptionsSkill
- expose-a-use-caseSkill
- family-syncSkill
- health-checksSkill
- integration-testsSkill
- json-serializationSkill
- mapping-with-mapperlySkill
- mcp-inspectorSkill
- mediatorSkill
- optional-token-authSkill
- packages-and-dependenciesSkill
- pagingSkill
- presentation-integration-testsSkill
- releasesSkill
- sample-dataSkill
- security-findingsSkill
- serilogSkill
- telemetrySkill
- template-authoringSkill
- test-designSkill
- time-providerSkill
- unit-testsSkill
- validationSkill
- writing-a-skillSkill
- xml-docs-and-openapiSkill
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
- Very specific: line 33
Put the safe default in appsettings.json.
- Very specific: line 35
Read a single value with configuration.GetValue<T>("Section:Key").
- Very specific: line 36
Document the key in docs/RUN.md if someone running the app might change it.
- Very specific: line 41
Put secrets, passwords or tokens in any appsettings*.json file.
- Very specific: line 42
Check IsEnvironment("local") for behaviour that should be a setting.
- Very specific: line 43
Read Environment.GetEnvironmentVariable directly.
≈ “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.
Files
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.
| Environment | Set by | Used for |
local | launchSettings.json (DOTNET_ENVIRONMENT=local) | dotnet run on a developer machine: console logs, sample data on |
docker | docker-compose.yml and the Dockerfile | docker compose up: telemetry over OTLP through the collector to the Aspire dashboard, database in /app/data, sample data on |
| anything else | the host | Real deployments: base settings only, sample data off, HSTS on |
Settings that exist today:
| Key | Meaning |
ConnectionStrings:MovieReviews | SQLite connection string. Data Source=Name;Mode=Memory;Cache=Shared keeps everything in memory. |
Database:SeedSampleData | Seed sample data into an empty database (sample-data). |
Authentication:Authority, Authentication:Audience | Only 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
- Put the safe default in
appsettings.json. If the default is "off" or empty, still write the key so people can find it. - Override it only in the environment files that need a different value.
- Read a single value with
configuration.GetValue<T>("Section:Key"); read a group into a settings class with aSectionNameconstant and aFromConfiguration(IConfiguration)method, likeAuthenticationSettingsin a solution with authentication. - Document the key in
docs/RUN.mdif someone running the app might change it. - Tests override settings in memory (
integration-tests), never by editing the JSON.
Don't
- Put secrets, passwords or tokens in any
appsettings*.jsonfile. Use environment variables or user secrets. - Check
IsEnvironment("local")for behaviour that should be a setting. Add a setting instead. - Read
Environment.GetEnvironmentVariabledirectly. Go throughIConfiguration.
Check
dotnet testDoes 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.

