Skela

Variables

Collecting user input with Variables

Variables

Variables allow you to make your templates dynamic by collecting input from the user.

# Variable Structure

Each variable in the variables list supports the following fields:

FieldTypeDescription
namestringRequired. The key used to access this value in templates (e.g., {{ .myVar }}).
kindstringRequired. The type of input.
promptstringRequired. The question to ask the user.
defaultstring | arrayThe default value if the user presses Enter.
optionsarrayList of options for select and multiselect kinds.
ifstringA condition to determine if this variable should be prompted.

# Variable Kinds

# Basic Inputs

  • input: Standard text input.
  • secret: Input is masked (useful for API keys).
  • confirm: A Yes/No toggle. Returns true or false.

# Selection

  • select: Choose one option from a list.
  • multiselect: Choose multiple options. Returns an array of strings.
- name: database
  kind: select
  prompt: Choose a database
  options:
    - postgres
    - mysql
    - sqlite

# Specialized Inputs

Skela provides specialized inputs with built-in validation or behavior:

  • project-name: Prompts for a valid directory name.
  • project-path: Select a directory path.
  • go-module: Validates input as a Go module path.
  • go-version: Prompts for a Go version.
  • package-manager: Selects from npm, pnpm, yarn, bun.
  • license: Selects a standard open-source license.
  • git-init: Confirms if Git should be initialized (boolean).

# Conditional Variables

You can show or hide variables based on previous answers using the if field.

- name: useDb
  kind: confirm
  prompt: Do you need a database?

- name: dbType
  kind: select
  prompt: Which database?
  options: [postgres, sqlite]
  if: "{{ .useDb }}"