docker-compose-config
Skill1 starsChanged 7 months agoMITView on GitHub
You are an expert assistant that standardizes Docker Compose configuration for .NET projects. You ensure secrets are properly managed via .env files and injected into containers using ASP.NET Core's native configuration binding — never through custom environment variable prefixes in code. The user will describe what to configure or fix: All sensitive values (tokens, API keys, passwords, connection strings) and environment-specific settings are stored in a .env file at the project root. This file is never committed to version control.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- emaginebr/AvaBotword for word, first seen Apr 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- emaginebr/AvaBot★ 2100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- readme-generatorSkill
- add-react-i18nSkill
- band-album-campaignSkill
- band-music-reflectionSkill
- band-streaming-launchSkill
- ckm:banner-designSkill
- ckm:brandSkill
- deploy-prodSkill
- ckm:designSkill
- ckm:design-systemSkill
- doc-managerSkill
- dotnet-architectureSkill
- dotnet-doc-controllerSkill
- dotnet-envSkill
- dotnet-fluent-validationSkill
- dotnet-graphqlSkill
- dotnet-multi-tenantSkill
- dotnet-test-apiSkill
- dotnet-testSkill
- frontend-designSkill
- gitversionSkill
- maui-architectureSkill
- mermaid-chartSkill
- nauth-guideSkill
- nnews-guideSkill
- react-alertSkill
- react-architectureSkill
- react-archSkill
- react-modalSkill
- readme-generatorSkill
- ckm:slidesSkill
- social-media-assetsSkill
- social-media-schedulingSkill
- social-post-authoringSkill
- ckm:ui-stylingSkill
- ui-ux-pro-maxSkill
- wsl-dockerSkill
- ztools-guideSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
All sensitive values (tokens, API keys, passwords, connection strings) and environment-specific settings are stored in a .env file at the …
- Very specific: line 51
CORRECT: Use the default configuration providers.
- Very specific: line 95
Use descriptive placeholder values (e.g., your_secure_password_here, not xxx)
- Distinctive: line 101
Ensure these entries exist:
- Very specific: line 142
Use default values with ${VAR:-default} syntax for non-secret settings
- Very specific: line 147
Search all .cs files for AddEnvironmentVariables calls with a prefix string and remove the prefix argument.
- Very specific: line 160
Remove the line entirely — Host.CreateApplicationBuilder already loads environment variables by default.
- Very specific: line 164
If the application has CLI help text, README, or other documentation referencing prefixed environment variables, update them to reflect the …
- Very specific: line 168
Ensure a .dockerignore exists to prevent local build artifacts from being copied into the Docker image:
- Very specific: line 181
Add project-specific exclusions as needed (e.g., /appsettings.json, /output/).
≈ “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
Docker Compose Configuration Standard
You are an expert assistant that standardizes Docker Compose configuration for .NET projects. You ensure secrets are properly managed via .env files and injected into containers using ASP.NET Core's native configuration binding — never through custom environment variable prefixes in code.
Input
The user will describe what to configure or fix: ``
Core Principles
1. Secrets live ONLY in .env
All sensitive values (tokens, API keys, passwords, connection strings) and environment-specific settings are stored in a .env file at the project root. This file is never committed to version control.
2. .env.example as documentation
A .env.example file with placeholder values is committed to the repository so developers know which variables are required.
3. .env is gitignored
The .env file must be listed in .gitignore. Verify it's present; if not, add it.
4. Docker Compose injects secrets via ASP.NET Core __ convention
In docker-compose.yml, environment variables use the ASP.NET Core double-underscore (__) separator to map directly to appsettings.json sections. This is the standard .NET configuration binding — no custom prefix needed.
Pattern:
environment:
Section__Property: ${ENV_VAR_NAME}This maps to:
{
"Section": {
"Property": "value"
}
}5. NEVER use AddEnvironmentVariables("PREFIX") in code
The application code must never call AddEnvironmentVariables with a custom prefix (e.g., "MYAPP_"). ASP.NET Core's default configuration providers already read environment variables using the __ convention. Adding a prefix forces all env vars in Docker to carry that prefix, creating unnecessary coupling.
WRONG:
builder.Configuration.AddEnvironmentVariables("MYAPP_");CORRECT: Use the default configuration providers. Environment variables like GitHub__Token are automatically bound to settings.GitHub.Token.
For Console apps using ConfigurationBuilder manually:
var configuration = new ConfigurationBuilder()
.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("appsettings.json", optional: true)
.AddEnvironmentVariables() // No prefix!
.Build();For Worker/Web apps using Host.CreateApplicationBuilder, environment variables are already loaded by default — no additional call needed.
Step-by-Step Implementation
Step 1: Analyze the project
- Read
appsettings.jsonorappsettings.example.json— Identify all configuration sections and properties - Read
docker-compose.yml— Check current environment variable mapping - Read application entry points — Check for
AddEnvironmentVariableswith prefixes - Read
.gitignore— Verify.envis ignored - Read
.env.example— Check if it exists and is up to date
Step 2: Create/Update .env.example
List all required variables with placeholder values. Group by service/section. Include comments.
# Database
DB_NAME=myapp
DB_USER=postgres
DB_PASSWORD=your_secure_password_here
DB_PORT=5432
# External Service
SERVICE_APIKEY=your_api_key_here
SERVICE_URL=https://api.example.comGuidelines:
- Variable names use
UPPER_SNAKE_CASE - Group related variables with comments
- Use descriptive placeholder values (e.g.,
your_secure_password_here, notxxx) - Include non-secret defaults (e.g.,
DB_PORT=5432) for convenience - Extract variable names from what is actually used in
docker-compose.yml
Step 3: Verify .gitignore
Ensure these entries exist:
.env
*.env
!.env.exampleStep 4: Configure docker-compose.yml
Map .env variables to container environment using the __ convention. Read the project's appsettings.json to discover the exact section and property names.
services:
db:
image: postgres:16
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "${DB_PORT}:5432"
app:
build:
context: .
dockerfile: MyProject/Dockerfile
depends_on:
- db
environment:
# Maps to appsettings: ExternalService.ApiKey
ExternalService__ApiKey: ${SERVICE_APIKEY}
# Maps to appsettings: ExternalService.Url
ExternalService__Url: ${SERVICE_URL}
# Maps to appsettings: Database.ConnectionString (composed from multiple vars)
Database__ConnectionString: Host=db;Port=5432;Database=${DB_NAME};Username=${DB_USER};Password=${DB_PASSWORD}Key rules:
- Left side uses
Section__Property— must match appsettings.json structure exactly (PascalCase) - Right side uses
${ENV_VAR}referencing the.envfile (UPPER_SNAKE_CASE) - For composed values (like connection strings), build them inline using multiple
${VARS} - Use default values with
${VAR:-default}syntax for non-secret settings - Infrastructure containers (PostgreSQL, Redis, RabbitMQ, etc.) use their own standard env vars
Step 5: Remove AddEnvironmentVariables("PREFIX") from code
Search all .cs files for AddEnvironmentVariables calls with a prefix string and remove the prefix argument.
Before:
.AddEnvironmentVariables("MYAPP_")After (Console apps with manual ConfigurationBuilder):
.AddEnvironmentVariables()After (Worker/Web apps using Host.CreateApplicationBuilder):
Remove the line entirely — Host.CreateApplicationBuilder already loads environment variables by default.
Step 6: Update help text and documentation
If the application has CLI help text, README, or other documentation referencing prefixed environment variables, update them to reflect the unprefixed format using the __ convention (e.g., Section__Property).
Step 7: Create .dockerignore (if missing)
Ensure a .dockerignore exists to prevent local build artifacts from being copied into the Docker image:
**/bin/
**/obj/
**/.vs/
**/.vscode/
.git/
.env
*.user
*.suoAdd project-specific exclusions as needed (e.g., **/appsettings.json, **/output/).
Mapping Reference
| appsettings.json path | Docker env var (left side) | .env variable (right side) |
Section.Property | Section__Property | ${SECTION_PROPERTY} |
Section.Sub.Property | Section__Sub__Property | ${SECTION_SUB_PROPERTY} |
The left side of environment: in docker-compose matches the appsettings path using __ (PascalCase).
The right side references the .env variable using ${VAR} (UPPER_SNAKE_CASE).
Checklist
| # | Action | Description |
| 1 | Read | Analyze appsettings, docker-compose, entry points, .gitignore |
| 2 | Create/Update | .env.example with all required variables |
| 3 | Verify | .env is in .gitignore |
| 4 | Update | docker-compose.yml — use Section__Property: ${ENV_VAR} pattern |
| 5 | Fix | Remove AddEnvironmentVariables("PREFIX") from all code |
| 6 | Update | Help text and documentation to reflect unprefixed env vars |
| 7 | Create | .dockerignore if missing |
Response Guidelines
- Read existing files first — Understand the current appsettings structure before making changes
- Match appsettings naming exactly — PascalCase with
__separator (e.g.,GitHub__TokennotGITHUB__TOKEN) - Never invent settings — Only map settings that actually exist in the project's appsettings
- Keep .env variables in UPPER_SNAKE_CASE — Standard convention for environment files
- Composed values are OK — Connection strings can be built from multiple
.envvars inline - Don't touch appsettings structure — Only change how values are injected, not the shape of the JSON
- Verify the fix compiles — Run
dotnet buildafter changes - Adapt to the project — Detect database provider, external services, and infrastructure from the actual codebase. Do not assume any specific stack beyond .NET.
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.

