Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Template Validation

БесплатноБез исполняемых скриптовНе проверен

Validate Cookiecutter templates, Terraform modules, and Harness pipelines

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

Template Validation Skill

When to Use This Skill

Use this skill when you need to:

  • Validate Cookiecutter template syntax and structure
  • Check Terraform module validity and best practices
  • Verify Harness pipeline YAML schemas
  • Ensure variable references are correct and consistent
  • Catch errors before template generation or deployment
  • Perform quality checks on generated templates
  • Validate template dependencies and integrations
  • Check for security vulnerabilities in templates

Validation Capabilities

1. Jinja2 Syntax Validation

What We Validate:

  • Template syntax correctness
  • Variable interpolation {{ cookiecutter.variable }}
  • Control structures {% if %}, {% for %}
  • Filter usage {{ variable | filter }}
  • Macro definitions and calls
  • Template inheritance
  • Whitespace control

Validation Method:

from jinja2 import Environment, FileSystemLoader, TemplateSyntaxError

def validate_jinja2(template_path):
    try:
        env = Environment(loader=FileSystemLoader('.'))
        template = env.get_template(template_path)
        return {"valid": True, "errors": []}
    except TemplateSyntaxError as e:
        return {
            "valid": False,
            "errors": [{
                "line": e.lineno,
                "message": e.message,
                "file": template_path
            }]
        }

2. Terraform HCL Validation

What We Validate:

  • HCL syntax correctness
  • Resource block structure
  • Variable declarations and types
  • Output definitions
  • Module references
  • Provider configurations
  • Terraform version constraints
  • Resource dependencies

Validation Commands:

# Format check
terraform fmt -check -recursive

# Validation
terraform validate

# Security scanning
tfsec .

# Best practices
tflint --recursive

3. YAML Schema Validation

What We Validate:

  • YAML syntax correctness
  • Harness pipeline schema compliance
  • Required field presence
  • Data type correctness
  • Enum value validation
  • Array/object structure
  • Custom schema rules

Validation Method:

import yaml
from jsonschema import validate, ValidationError

def validate_harness_pipeline(pipeline_path, schema_path):
    with open(pipeline_path) as f:
        pipeline = yaml.safe_load(f)

    with open(schema_path) as f:
        schema = yaml.safe_load(f)

    try:
        validate(instance=pipeline, schema=schema)
        return {"valid": True, "errors": []}
    except ValidationError as e:
        return {
            "valid": False,
            "errors": [{
                "path": list(e.path),
                "message": e.message
            }]
        }

4. Variable Reference Checking

What We Check:

  • All referenced variables are defined
  • Variable types match usage
  • Default values are appropriate
  • Required variables are documented
  • No unused variables
  • Consistent naming conventions
  • Cross-template variable consistency

Validation Checklists

Cookiecutter Template Validation

Check Description Command
Structure Required files present ls cookiecutter.json hooks/ {{cookiecutter.project_slug}}/
JSON Schema cookiecutter.json valid python -m json.tool cookiecutter.json
Jinja2 Syntax All templates parse python -c "from jinja2 import Environment, FileSystemLoader; env = Environment(loader=FileSystemLoader('.')); [env.get_template(t) for t in templates]"
Variables All refs defined grep -r "cookiecutter\." --include="*.jinja" | awk '{print $2}' | sort | uniq
Hooks Pre/post hooks work python hooks/pre_gen_project.py && python hooks/post_gen_project.py
Tests Template generates cookiecutter . --no-input
Docs README complete grep -q "## Variables" README.md

Terraform Module Validation

Check Description Command
Syntax HCL format correct terraform fmt -check -recursive
Init Module initializes terraform init
Validate Configuration valid terraform validate
Variables All declared/used terraform-docs markdown . --output-file VALIDATION.md
Outputs All defined properly grep -r "output \"" *.tf
Security No vulnerabilities tfsec . --minimum-severity MEDIUM
Lint Best practices tflint --recursive --config .tflint.hcl
Docs Auto-generated terraform-docs markdown table --output-file README.md .

Harness Pipeline Validation

Check Description Command
YAML Syntax Valid YAML yamllint pipeline.yaml
Schema Harness schema harness pipeline validate --file pipeline.yaml
Variables All defined yq '.pipeline.variables' pipeline.yaml
Stages Valid structure yq '.pipeline.stages[].stage.type' pipeline.yaml
Services Service refs exist `harness service l
Полный SKILL.md на GitHub

Установить Template Validation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Template Validation?

Validate Cookiecutter templates, Terraform modules, and Harness pipelines

Как установить скилл Template Validation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Template Validation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Template Validation с