| name | GitLab Stack Validator |
| description | Validates GitLab stack projects before deployment, ensuring proper architecture patterns, directory structure, secrets management, .env configuration, and Docker best practices. Use when users ask to validate a stack, check stack configuration, verify stack architecture, audit stack setup, or ensure stack deployment readiness. |
GitLab Stack Validator
This skill validates GitLab stack projects to ensure they follow proper architecture patterns and are ready for deployment. It focuses on detection and reporting of issues, working alongside companion skills (stack-creator, secrets-manager) for remediation.
When to Use This Skill
Activate this skill when the user requests:
- Validate a GitLab stack project
- Check stack configuration before deployment
- Verify stack architecture and structure
- Audit stack for best practices compliance
- Ensure stack follows proper patterns
- Pre-deployment validation checks
- Stack health check or readiness verification
Core Validation Principles
This skill validates stacks that follow these architecture principles:
- Configuration Management: All configuration through docker-compose.yml and ./config directory
- Secrets Management: Secrets stored in ./secrets and referenced via Docker secrets
- Environment Variables: .env file with matching .env.example template
- Minimal Custom Scripts: docker-entrypoint.sh only when containers don't support native secrets
- Proper Ownership: No root-owned files (all files owned by Docker user)
- Temporary Files: _temporary directory for transient files that are cleaned up after use
- Docker Best Practices: Leverage docker-validation skill for Docker-specific checks
Validation Workflow
When a user requests stack validation, follow this comprehensive workflow:
Phase 1: Pre-flight Checks
Step 1: Verify Stack Project
- Check if current directory appears to be a stack project
- Look for key indicators:
- docker-compose.yml exists
- Presence of ./config, ./secrets, or ./_temporary directories
- .env file exists
- If not a stack project, report findings and ask if user wants to initialize one
Step 2: Gather Context
- Ask user for validation scope (if needed):
- Full validation or targeted checks?
- Strict mode or permissive mode?
- Output format preference (text report vs JSON)?
- Check if .stack-validator.yml exists for custom rules
- Note the working directory for reporting
Phase 2: Directory Structure Validation
Step 1: Required Directories
- Check for required directories:
./config- Configuration files directory./secrets- Secrets storage directory./_temporary- Temporary files directory
- For each missing directory, record:
- Directory name
- Purpose and why it's required
- Impact on stack functionality
Step 2: Directory Permissions
- Check ./secrets has restricted permissions (700 or 600)
- Verify other directories have appropriate permissions
- Report any permission issues with security implications
Step 3: Directory Ownership
- Scan all project directories for ownership
- Flag any root-owned directories:
- Directory path
- Current owner
- Expected owner (current user or docker user)
- Flag any files with unexpected ownership
Step 4: .gitignore Validation
- Check if .gitignore exists
- Verify it excludes:
./secretsor./secrets/*./_temporaryor./_temporary/*.env(should not be in git)
- Report missing exclusions with security implications
Phase 3: Environment Variables Validation
Step 1: .env File Validation
- Check if .env file exists
- Parse .env file for:
- Syntax errors
- Duplicate variable definitions
- Empty values that might be required
- Record all environment variable names found
Step 2: .env.example Validation
- Check if .env.example exists
- If missing, this is a critical issue - document why it's needed
- Parse .env.example for variable names
Step 3: .env Synchronization Check
- Compare variables in .env with .env.example:
- Variables in .env but NOT in .env.example
- Variables in .env.example but NOT in .env
- This is a critical validation point - they must match
- Report any mismatches with specific variable names
Step 4: Environment Variable Security
- Scan .env for potential secrets:
- Variables with names containing: password, secret, key, token, api
- Base64-encoded looking values
- Long random strings
- If secrets detected in .env, flag as security issue
- Suggest moving to ./secrets and Docker secrets instead
Phase 4: Docker Configuration Validation
Step 1: Invoke docker-validation Skill
- Use the docker-validation skill to validate:
- docker-compose.yml syntax and best practices
- Dockerfile(s) if present
- Multi-stage builds
- Security configurations
- Collect all findings from docker-validation
- Integrate into overall stack validation report
Step 2: Stack-Specific Docker Checks
- Review docker-compose.yml for stack patterns:
- Secrets are defined in top-level
secrets:section - Services reference secrets via
secrets:key (not environment variables) - Volume mounts follow patterns (./config, ./secrets, ./_temporary)
- Networks are properly defined if multi-service
- Service dependencies use
depends_oncorrectly
- Secrets are defined in top-level
Step 3: Version Check
- Ensure docker-compose.yml does NOT have version field at top
- This follows modern Docker Compose specification
- If version field present, flag for removal
Phase 5: Secrets Management Validation
Step 1: Secrets Directory Check
- Verify ./secrets directory exists
- Check permissions are restrictive (700)
- Verify it's excluded from git
Step 2: Docker Secrets Validation
- Parse docker-compose.yml for secrets definitions
- For each secret definition:
- Verify the secret file exists in ./secrets
- Check file permissions (600 or 400)
- Verify not tracked by git
- Report missing secret files
Step 3: Secret References Validation
- Check each service's
secrets:section - Verify referenced secrets are defined in top-level secrets
- Flag any undefined secret references
Step 4: Environment Variables vs Secrets
- Scan service environment variables for potential secrets
- Look for patterns like:
- *_PASSWORD
- *_SECRET
- *_KEY
- *_TOKEN
- API_*
- If sensitive data in environment, suggest using secrets instead
Step 5: Secret Exposure Check
- Check for secrets in:
- docker-compose.yml (hardcoded values)
- .env file (should be in ./secrets instead)
- Configuration files in ./config
- Any shell scripts
- Report any exposed secrets as critical security issues
Phase 6: Configuration Files Validation
Step 1: Config Directory Structure
- List all files in ./config directory
- Organize by service (if applicable)
- Check for proper organization
Step 2: Config File Validation
- For common config file types, validate syntax:
- YAML files (.yml, .yaml)
- JSON files (.json)
- INI files (.ini, .conf)
- TOML files (.toml)
- Report any syntax errors
Step 3: Config vs Secrets Separation
- Scan config files for potential secrets
- Look for hardcoded passwords, tokens, keys
- Flag any secrets that should be in ./secrets instead
Step 4: Config Ownership
- Check all config files for ownership
- Flag any root-owned config files
- Report expected ownership (current user)
Phase 7: Script Validation
Step 1: docker-entrypoint.sh Detection
- Search for docker-entrypoint.sh files
- For each found:
- Document location
- Check if truly necessary
- Validate it's only used when container doesn't support native secrets
Step 2: Script Permissions
- Check docker-entrypoint.sh is executable (chmod +x)
- Verify ownership (should not be root)
- Report permission issues
Step 3: Script Content Validation
- Scan script for:
- Hardcoded secrets (critical issue)
- Proper secret handling from /run/secrets/
- Error handling
- Syntax errors (if bash/sh)
- Report any issues found
Step 4: Necessity Check
- Review if docker-entrypoint.sh is truly needed
- Check if service supports native Docker secrets
- Suggest removal if unnecessary
Phase 8: Temporary Directory Validation
Step 1: Directory Check
- Verify ./_temporary exists
- Check it's in .gitignore
- Verify permissions
Step 2: Content Check
- List contents of ./_temporary
- Check for:
- Leftover files that should be cleaned
- Large files consuming space
- Old files (> 7 days old)
- Report if not empty with details
Step 3: Usage Validation
- Check if ./_temporary is properly mounted in docker-compose.yml
- Verify services use it for temporary files
- Flag if not being utilized
Phase 9: File Ownership Audit
Step 1: Comprehensive Ownership Scan
- Use
find . -type f -user root 2>/dev/nullto find root-owned files - Exclude expected directories (.git, node_modules, vendor)
- List all root-owned files found
Step 2: Categorize Issues
- Group by directory:
- ./config files owned by root
- ./secrets files owned by root
- Application files owned by root
- Report with specific paths
Step 3: Impact Assessment
- For each root-owned file:
- Explain why this is problematic
- Impact on stack operations
- Potential errors that may occur
Phase 10: Report Generation
Step 1: Compile All Findings
- Organize findings by category:
- Directory Structure
- Environment Variables (.env sync)
- Docker Configuration
- Secrets Management
- Configuration Files
- Scripts (docker-entrypoint.sh)
- Temporary Directory
- File Ownership
- Assign severity levels:
- ❌ CRITICAL: Security issues, missing required components, .env mismatch
- ⚠️ WARNING: Best practice violations, potential issues
- ✅ PASS: No issues found
Step 2: Generate Validation Report
Create a comprehensive report with this structure:
🔍 GitLab Stack Validation Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Stack: [directory name]
Date: [timestamp]
Mode: [strict/permissive]
📊 SUMMARY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Passed: [count]
⚠️ Warnings: [count]
❌ Critical: [count]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 DETAILED FINDINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[For each validation category]
[Category Icon] [Category Name]: [STATUS]
[If issues found:]
❌ [Issue description]
Location: [file/directory path]
Impact: [what this affects]
Details: [specific information]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 OVERALL STATUS: [PASSED/FAILED/WARNINGS]
[If failures or warnings:]
🔧 RECOMMENDED ACTIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Prioritized list of actions needed]
1. [Most critical action]
2. [Next action]
...
💡 NEXT STEPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Use stack-creator skill to fix structural issues
- Use secrets-manager skill to properly configure secrets
- Re-run validation after fixes
Step 3: Provide Actionable Guidance
- For each issue, provide:
- Clear description of the problem
- Why it matters
- Which companion skill can help fix it
- General guidance (but not actual fix commands)
- Prioritize issues by severity
- Group related issues together
Step 4: Export Options
- If user requested JSON output, export as:
{ "stack": "directory-name", "timestamp": "ISO-8601", "summary": { "passed": 5, "warnings": 2, "critical": 1, "status": "failed" }, "findings": [ { "category": "environment-variables", "status": "critical", "issues": [...] } ] }
Validation Categories Reference
1. Directory Structure
- Required directories exist
- Proper permissions
- .gitignore coverage
- Ownership correctness
2. Environment Variables
- .env file exists and valid
- .env.example exists
- CRITICAL: .env and .env.example are synchronized
- No secrets in .env
3. Docker Configuration
- docker-compose.yml valid (via docker-validation skill)
- No version field
- Secrets properly defined
- Volumes follow patterns
- Service dependencies correct
4. Secrets Management
- ./secrets directory secure
- All referenced secrets exist
- Proper permissions
- No exposed secrets
- Environment variables don't contain secrets
5. Configuration Files
- Proper organization
- Valid syntax
- No embedded secrets
- Correct ownership
6. Scripts
- docker-entrypoint.sh only when necessary
- Executable permissions
- No hardcoded secrets
- Proper secret handling
7. Temporary Directory
- Exists and in .gitignore
- Empty or contains only expected transient files
- Properly utilized in compose file
8. File Ownership
- No root-owned files
- Consistent ownership
- Proper user/group
Integration with Companion Skills
stack-creator
- Recommend for: Creating missing directories, initializing structure
- Handles: Setting up new stacks, fixing structural issues
secrets-manager
- Recommend for: Secrets configuration, secret file management
- Handles: Creating/updating secrets, proper secret setup
docker-validation
- Used directly during validation for Docker-specific checks
- Provides: Docker Compose and Dockerfile validation
- Integrated into stack validation report
Validation Modes
Standard Mode (Default)
- Report all issues as warnings or errors
- Provide comprehensive findings
- Suggest improvements
Strict Mode
- Fail on warnings
- Require all best practices
- Zero tolerance for deviations
Permissive Mode
- Only fail on critical issues
- Allow warnings
- More lenient on best practices
Configuration Support
If .stack-validator.yml exists in project root, respect these settings:
# Validation mode
strict_mode: false
# Whether warnings should fail validation
fail_on_warnings: false
# Paths to exclude from validation
exclude_paths:
- ./vendor
- ./node_modules
- ./_temporary/cache
# Custom validation scripts to run
custom_checks:
- ./scripts/custom-validation.sh
# Specific checks to skip
skip_checks:
- temporary-directory-empty
Communication Style
When reporting validation results:
- Be Clear and Direct: State issues plainly without hedging
- Be Specific: Include exact file paths, line numbers, variable names
- Be Actionable: Explain what needs to be done (without doing it)
- Be Helpful: Point to companion skills that can fix issues
- Be Organized: Group related issues, prioritize by severity
- Be Educational: Explain why something is an issue
- Be Concise: Don't overwhelm with details, but be thorough
Critical Validation Points
These are must-pass criteria for production stacks:
- ✅ .env and .env.example are fully synchronized
- ✅ No secrets in docker-compose.yml environment variables
- ✅ ./secrets directory exists and has restrictive permissions
- ✅ All referenced secrets exist
- ✅ ./secrets and ./_temporary are in .gitignore
- ✅ No root-owned files
- ✅ docker-compose.yml passes docker-validation
- ✅ No secrets exposed in git
- ✅ .env file is not tracked by git
Important Notes
- Read-Only: This skill NEVER modifies files - validation only
- Detection-Focused: Report issues, don't fix them
- Comprehensive: Check all aspects systematically
- Fast: Complete validation in seconds
- Integrative: Use docker-validation skill for Docker checks
- Companion-Aware: Direct users to appropriate skills for fixes
Example Validation Flow
User: "Validate my stack"
1. Check if docker-compose.yml exists ✅
2. Verify directory structure
- ./config ✅
- ./secrets ✅
- ./_temporary ⚠️ (not in .gitignore)
3. Validate .env configuration
- .env exists ✅
- .env.example exists ❌ CRITICAL
4. Run docker-validation skill
- docker-compose.yml syntax ✅
- Secrets configuration ⚠️ (using environment vars)
5. Check secrets management
- ./secrets permissions ✅
- Secret files exist ✅
6. Scan for ownership issues
- Found 3 root-owned files in ./config ❌
7. Generate report with findings
8. Suggest: Use stack-creator to add .env.example and fix .gitignore
This skill ensures stack quality, security, and deployment readiness through comprehensive validation.