npx skills add ...
npx skills add rknall/claude-skills --skill gitlab-stack-config-generator
Generates service-specific configuration files for GitLab stack projects in ./config directory, using .env as the primary configuration source. Creates nginx, PostgreSQL, Redis, and custom service configs with strict validation for secrets, paths, and Docker best practices. Use when setting up service configurations, creating config templates, or ensuring configs follow stack patterns.
npx skills add rknall/claude-skills --skill gitlab-stack-config-generator
This skill generates and manages service-specific configuration files for GitLab stack projects, ensuring configurations follow proper patterns, use .env for all variables, and never contain secrets.
Activate this skill when the user requests:
CRITICAL RULES:
./config/service-name/ directoryStep 1: Determine What to Generate
Ask the user (or infer):
Step 2: Check Current State
Step 1: Create ./config Directory
Step 2: Create Service Directories
For each service (e.g., nginx, postgres, redis):
Directory Structure:
Principles:
CRITICAL: Always ensure these files exist
Step 1: Generate CLAUDE.md
Create CLAUDE.md in project root:
CRITICAL: When creating commit messages, NEVER mention "Claude" or "Claude Code" in the commit message.
Good commit messages:
Bad commit messages:
All files must be owned by the current user (not root):
Before deployment, always run:
Last updated: [date]
Step 3: Generate .dockerignore
Common Services: nginx, PostgreSQL, Redis
For each service, follow this pattern:
Step 1: Determine Configuration Needs
Ask user:
Step 2: Identify Required .env Variables
For each service, list all .env variables needed:
Example for nginx:
Step 3: Generate Configuration File
CRITICAL: Use environment variable placeholders (${VAR_NAME})
Example nginx.conf:
Step 4: Update .env
Add all required variables:
Step 5: Update .env.example
CRITICAL: Must match .env exactly:
Step 6: Update docker-compose.yml
Add volume mount for config:
Step 1: Syntax Validation
For each config file type:
Nginx:
PostgreSQL:
Redis:
Step 2: Secret Detection (CRITICAL)
Scan all config files for secrets:
Step 3: Path Validation
Check that all referenced paths exist:
Step 4: .env Synchronization (CRITICAL)
Step 5: Docker Validation
CRITICAL: Use docker-validation skill:
Address all findings before completing.
Step 1: Offer Templates
For nginx, PostgreSQL, Redis, offer these options:
Nginx Templates:
Simple Reverse Proxy (default)
SSL Termination
Static + Proxy
Custom
PostgreSQL Templates:
Basic (default)
Production
With Extensions
Custom
Redis Templates:
Cache (default)
Persistent
Pub/Sub
Custom
Step 2: Generate from Template
Based on user selection, generate appropriate config with:
After generation, provide comprehensive report:
Always include:
Never include:
Example variables:
Always include:
Never include:
Example variables:
Always include:
Never include:
Example variables:
When to call:
When to call:
When to call:
This skill generates service configurations following GitLab stack patterns with strict validation._
./config/
├── nginx/
│ ├── nginx.conf
│ ├── ssl/
│ │ └── (SSL configs, not certificates)
│ └── conf.d/
│ └── default.conf
├── postgres/
│ ├── postgresql.conf
│ └── init.sql
├── redis/
│ └── redis.conf
└── app/
└── settings.yml# Git
.git/
.gitignore
# Environment
.env
.env.*
# Secrets
secrets/
# Temporary
_temporary/
# Documentation
*.md
CLAUDE.md
# IDE
.vscode/
.idea/
# OS
.DS_Store
Thumbs.db
# Dependencies (if not needed in build)
node_modules/
vendor/
# Logs
*.log
logs/# Nginx Configuration
# Loads variables from .env
upstream app {
server ${APP_HOST}:${APP_PORT};
}
server {
listen ${NGINX_PORT};
server_name ${NGINX_HOST};
# SSL configuration
# SSL certificates loaded from Docker secrets
# ssl_certificate /run/secrets/ssl_cert;
# ssl_certificate_key /run/secrets/ssl_key;
location / {
proxy_pass http://app;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}# Nginx Configuration
NGINX_PORT=80
NGINX_HOST=localhost
NGINX_SSL_ENABLED=false
APP_HOST=app
APP_PORT=8080# Nginx Configuration
NGINX_PORT=80
NGINX_HOST=localhost
NGINX_SSL_ENABLED=false
APP_HOST=app
APP_PORT=8080services:
nginx:
image: nginx:alpine
ports:
- "${NGINX_PORT}:80"
volumes:
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
environment:
# Variables loaded from .env automatically
NGINX_HOST: ${NGINX_HOST}
APP_HOST: ${APP_HOST}
APP_PORT: ${APP_PORT}# Test nginx config
docker run --rm -v $(pwd)/config/nginx:/etc/nginx:ro nginx:alpine nginx -t# Check SQL syntax
# Parse init.sql for syntax errors# Test redis config
docker run --rm -v $(pwd)/config/redis:/usr/local/etc/redis:ro redis:alpine redis-server --test-memory 1024# Check for common secret patterns
grep -r -iE "(password|secret|key|token|api_key)" ./config/
# If found, this is CRITICAL SECURITY ISSUE
# Must use secrets-manager to fix# Extract variable names from .env
env_vars=$(grep -E "^[A-Z_]+" .env | cut -d'=' -f1 | sort)
# Extract from .env.example
example_vars=$(grep -E "^[A-Z_]+" .env.example | cut -d'=' -f1 | sort)
# Compare
diff <(echo "$env_vars") <(echo "$example_vars")
# If any difference, this is CRITICAL ERROR"Validate docker-compose.yml using docker-validation skill"📝 Configuration Generation Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Meta Files
✅ CLAUDE.md created
✅ .gitignore updated
✅ .dockerignore created
✅ Directory Structure
✅ ./config/nginx created
✅ ./config/postgres created
✅ ./config/redis created
📄 Generated Configurations
Nginx (Simple Reverse Proxy):
✅ ./config/nginx/nginx.conf
✅ Variables added to .env (3)
✅ .env.example synced
✅ docker-compose.yml updated
✅ Syntax validation: PASS
PostgreSQL (Basic):
✅ ./config/postgres/postgresql.conf
✅ ./config/postgres/init.sql
✅ Variables added to .env (5)
✅ .env.example synced
✅ docker-compose.yml updated
Redis (Cache):
✅ ./config/redis/redis.conf
✅ Variables added to .env (2)
✅ .env.example synced
✅ docker-compose.yml updated
🔐 Security Validation
✅ No secrets in config files
✅ All secrets in ./secrets (via secrets-manager)
✅ Configs use .env variables only
✅ Path Validation
✅ All referenced paths exist
✅ Volume mounts valid
✅ .env Synchronization
✅ .env and .env.example match (10 variables)
🐳 Docker Validation
✅ docker-compose.yml syntax valid
✅ All volume mounts exist
✅ No deprecated syntax
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Configuration generation complete!
Next Steps:
1. Review generated configurations
2. Customize as needed
3. Run: docker compose config (validate)
4. Run: docker compose up -dNGINX_PORT=80
NGINX_HOST=localhost
NGINX_WORKER_PROCESSES=auto
NGINX_WORKER_CONNECTIONS=1024
APP_BACKEND_HOST=app
APP_BACKEND_PORT=8080POSTGRES_DB=myapp_db
POSTGRES_USER=myapp_user
# POSTGRES_PASSWORD in ./secrets/db_password
POSTGRES_MAX_CONNECTIONS=100
POSTGRES_SHARED_BUFFERS=256MBREDIS_PORT=6379
REDIS_MAXMEMORY=256mb
REDIS_MAXMEMORY_POLICY=allkeys-lru
REDIS_SAVE_ENABLED=falseUser: "Generate nginx and PostgreSQL configs"
1. Check current state
- ./config missing → create it
- .env exists
- .env.example exists
- CLAUDE.md missing → create it
2. Generate meta files
- Create CLAUDE.md
- Update .gitignore
- Create .dockerignore
3. Ask user for templates
"Which templates would you like?
- Nginx: [Simple Reverse Proxy], SSL Termination, Static + Proxy, Custom
- PostgreSQL: [Basic], Production, With Extensions, Custom"
4. User selects: Simple Reverse Proxy, Basic
5. Generate nginx config
- Create ./config/nginx/nginx.conf
- Add variables to .env
- Sync .env.example
- Update docker-compose.yml
- Validate syntax
6. Generate PostgreSQL config
- Create ./config/postgres/postgresql.conf
- Create ./config/postgres/init.sql
- Add variables to .env
- Sync .env.example
- Update docker-compose.yml
7. Run validations
- Secret detection: PASS
- Path validation: PASS
- .env sync check: PASS
- Docker validation (via docker-validation skill): PASS
8. Generate report
- Show all created files
- List .env variables added
- Confirmation that validations passed
9. Next steps
- Suggest testing: docker compose config
- Recommend: docker compose up -d