skills/docker-compose-config/SKILL.md
# 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, pas
npx skillsauth add landim32/awesome-ai-skills skills/docker-compose-configInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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: ``
.envAll 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.
.env.example as documentationA .env.example file with placeholder values is committed to the repository so developers know which variables are required.
.env is gitignoredThe .env file must be listed in .gitignore. Verify it's present; if not, add it.
__ conventionIn 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"
}
}
AddEnvironmentVariables("PREFIX") in codeThe 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.
appsettings.json or appsettings.example.json — Identify all configuration sections and propertiesdocker-compose.yml — Check current environment variable mappingAddEnvironmentVariables with prefixes.gitignore — Verify .env is ignored.env.example — Check if it exists and is up to date.env.exampleList 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.com
Guidelines:
UPPER_SNAKE_CASEyour_secure_password_here, not xxx)DB_PORT=5432) for conveniencedocker-compose.yml.gitignoreEnsure these entries exist:
.env
*.env
!.env.example
docker-compose.ymlMap .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:
Section__Property — must match appsettings.json structure exactly (PascalCase)${ENV_VAR} referencing the .env file (UPPER_SNAKE_CASE)${VARS}${VAR:-default} syntax for non-secret settingsAddEnvironmentVariables("PREFIX") from codeSearch 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.
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).
.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
*.suo
Add project-specific exclusions as needed (e.g., **/appsettings.json, **/output/).
| 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).
| # | 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 |
__ separator (e.g., GitHub__Token not GITHUB__TOKEN).env vars inlinedotnet build after changestools
Guides how to integrate the zTools package for ChatGPT, DALL-E image generation, file upload (S3), slug generation, email sending, and document validation in a .NET 8 project. Use when the user wants to use AI features, upload files, generate slugs, send emails, or understand zTools integration.
documentation
Generates a comprehensive, standardized README.md for any project. Use when the user wants to create or regenerate a README file following the project's documentation standard.
development
Create modal dialogs in the frontend using a custom Modal component built on top of Radix UI Dialog. Use this skill whenever the user asks to create, add, or modify a modal, dialog, popup, or confirmation prompt in the React application.
development
Create the complete frontend architecture for a new entity in the React application. Generates TypeScript types, service class, context provider, custom hook, and registers the provider in main.tsx. Use this skill when the user asks to create a new entity, feature module, or domain area in the frontend.