home / skills / ehtbanton / claudeskillsrepo / yaml-config-builder

yaml-config-builder skill

/yaml-config-builder

This skill generates complete, production-ready YAML configurations with sensible defaults and comments for quick customization.

npx playbooks add skill ehtbanton/claudeskillsrepo --skill yaml-config-builder

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
7.0 KB
---
name: yaml-config-builder
description: Generate properly structured YAML configuration files for applications, services, and infrastructure with correct syntax and common patterns. Triggers on "create YAML config", "generate YAML for", "YAML configuration file", "config.yml for".
---

# YAML Config Builder

Generate properly structured, production-ready YAML configuration files for various applications and services.

## Output Requirements

**File Output:** `.yaml` or `.yml` files
**Naming Convention:** `{service-name}.yaml` or `config.yaml`
**Indentation:** 2 spaces (never tabs)
**Encoding:** UTF-8

## When Invoked

Immediately generate a complete, valid YAML configuration file. Include sensible defaults and comments for customization.

## YAML Syntax Rules

### Formatting
- 2-space indentation, consistent throughout
- No tabs ever
- Blank lines between major sections
- Comments with `#` for documentation

### Strings
- Quote strings containing special characters: `":"`, `"#"`, `"{"`, etc.
- Quote strings that look like numbers or booleans: `"true"`, `"123"`
- Multi-line strings use `|` (literal) or `>` (folded)

### Lists and Maps
```yaml
# List syntax
items:
  - first
  - second
  - third

# Map syntax
config:
  key: value
  nested:
    deep: value
```

## Configuration Templates

### Application Configuration
```yaml
# Application Configuration
# Environment: production

app:
  name: my-application
  version: 1.0.0
  environment: production
  debug: false

server:
  host: 0.0.0.0
  port: 8080
  timeout: 30s
  max_connections: 1000

database:
  host: localhost
  port: 5432
  name: app_production
  username: ${DB_USERNAME}
  password: ${DB_PASSWORD}
  pool:
    min: 5
    max: 20
    idle_timeout: 300s

cache:
  enabled: true
  provider: redis
  host: localhost
  port: 6379
  ttl: 3600

logging:
  level: info
  format: json
  output:
    - stdout
    - file:/var/log/app/app.log

features:
  feature_x: true
  feature_y: false
  experimental:
    new_ui: false
```

### Docker Compose
```yaml
version: "3.8"

services:
  app:
    image: myapp:latest
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      - NODE_ENV=production
      - DATABASE_URL=${DATABASE_URL}
    volumes:
      - ./data:/app/data
    depends_on:
      - db
      - redis
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: appdb
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data

volumes:
  postgres_data:
  redis_data:

networks:
  default:
    name: app-network
```

### CI/CD Pipeline (GitHub Actions)
```yaml
name: CI/CD Pipeline

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

env:
  NODE_VERSION: "20"
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: "npm"

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm test

      - name: Run linting
        run: npm run lint

  build:
    needs: test
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v4

      - name: Build and push Docker image
        uses: docker/build-push-action@v5
        with:
          push: true
          tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
```

### Kubernetes Deployment
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  namespace: production
  labels:
    app: my-app
    version: v1
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
        version: v1
    spec:
      containers:
        - name: my-app
          image: myregistry/my-app:1.0.0
          ports:
            - containerPort: 8080
          env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: app-secrets
                  key: database-url
          resources:
            requests:
              memory: "256Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: my-app-service
  namespace: production
spec:
  selector:
    app: my-app
  ports:
    - port: 80
      targetPort: 8080
  type: ClusterIP
```

### ESLint Configuration
```yaml
root: true

env:
  browser: true
  es2022: true
  node: true

extends:
  - eslint:recommended
  - plugin:@typescript-eslint/recommended
  - plugin:react/recommended
  - plugin:react-hooks/recommended
  - prettier

parser: "@typescript-eslint/parser"

parserOptions:
  ecmaVersion: latest
  sourceType: module
  ecmaFeatures:
    jsx: true

plugins:
  - "@typescript-eslint"
  - react
  - react-hooks
  - import

rules:
  no-console: warn
  no-unused-vars: off
  "@typescript-eslint/no-unused-vars": error
  "@typescript-eslint/explicit-function-return-type": off
  react/react-in-jsx-scope: off
  import/order:
    - error
    - groups:
        - builtin
        - external
        - internal
        - parent
        - sibling
        - index

settings:
  react:
    version: detect
```

## Environment Variable Patterns

Use environment variable substitution syntax appropriate for the tool:
- Shell: `${VAR_NAME}` or `$VAR_NAME`
- Docker Compose: `${VAR_NAME:-default}`
- Kubernetes: `$(VAR_NAME)` or valueFrom references

## Validation Checklist

Before outputting, verify:
- [ ] Valid YAML syntax (parseable)
- [ ] Consistent 2-space indentation
- [ ] No tabs
- [ ] Proper quoting of special strings
- [ ] Comments are helpful, not redundant
- [ ] Sensitive values use environment variables
- [ ] Required fields are present for the target tool

## Example Invocations

**Prompt:** "Create docker-compose.yml for a Node.js app with PostgreSQL and Redis"
**Output:** Complete `docker-compose.yml` with all three services configured.

**Prompt:** "Generate GitHub Actions workflow for Python project with testing and deployment"
**Output:** Complete `.github/workflows/ci.yml` with test and deploy jobs.

**Prompt:** "YAML config for a REST API application"
**Output:** Complete `config.yaml` with server, database, logging, and feature flag sections.

Overview

This skill generates complete, production-ready YAML configuration files for applications, services, CI/CD pipelines, Docker Compose, Kubernetes, and tooling. It enforces 2-space indentation, UTF-8 encoding, sensible defaults, and helpful comments so outputs are immediately usable. Files are named using standard conventions like config.yaml or {service-name}.yaml.

How this skill works

On trigger phrases like "create YAML config" or "generate YAML for", the skill produces a full, valid .yaml/.yml file tailored to the requested target. It applies consistent YAML syntax rules, quotes special strings, substitutes environment variables where appropriate, and includes commented customization hints. Before returning, the output is validated for parseability, indentation consistency, and presence of required fields for the chosen tool.

When to use it

  • Create application config files (server, database, cache, logging).
  • Generate docker-compose.yml for multi-service local setups.
  • Produce Kubernetes manifests for deployments, services, and probes.
  • Create CI/CD workflows (GitHub Actions) for build/test/deploy pipelines.
  • Create linting or tooling configs (ESLint, formatter) in YAML format.

Best practices

  • Always use 2-space indentation and never tabs to ensure consistent parsing.
  • Keep secrets out of YAML; reference environment variables or secret stores instead.
  • Quote strings that look like numbers, booleans, or contain special characters.
  • Include brief comments for non-obvious settings and sensible defaults for quick start.
  • Validate generated YAML with a linter or parser before applying in production.

Example use cases

  • Create docker-compose.yml for a Node.js app with PostgreSQL and Redis, including healthchecks and volumes.
  • Generate a Kubernetes Deployment + Service YAML with liveness/readiness probes and resource limits.
  • Produce a GitHub Actions workflow for Node or Python that runs tests, linting, and builds/pushes images.
  • Build a config.yaml for a REST API with server, database, cache, and feature flag sections.
  • Generate an ESLint YAML config tuned for TypeScript and React projects.

FAQ

Will the skill include secrets in the generated YAML?

No. Sensitive values are referenced as environment variables or secret references by default; placeholders and guidance are provided to inject real secrets securely.

Does the output guarantee valid YAML for the target runtime?

The skill validates syntax, indentation, and required fields for the requested target, but you should still run tool-specific validation (kubectl apply --dry-run, docker compose config, or CI lint) in your environment.