Command Palette

Search for a command to run...

Назад к скиллам
скилл № 86169

twelve-factor

Guide for 12-Factor cloud-native applications. Use when designing microservices, configuring containers, deploying to Kubernetes, or following cloud-native…

БесплатноБез исполняемых скриптов
vinnie357от vinnie357★ 30 звёзд на GitHub

Установить twelve-factor в Claude Code и Claude Desktop

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

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

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

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

12-Factor App Methodology

Guide for building scalable, maintainable, and portable cloud-native applications following the 12-Factor App principles and modern extensions.

Anti-fabrication

This skill follows core:anti-fabrication. The 12 factors themselves are the
methodology cited in sources.md (12factor.net) — a stable, versionless reference, so
naming a factor correctly is low-risk. The risk sits in the worked examples: the
Kubernetes manifests, runtime.exs snippets, and Docker Compose configs in
references/kubernetes.md and references/factor-examples.md assert real API fields
(e.g. livenessProbe, ConfigMap keys) that do change across Kubernetes versions —
verify a manifest field against current API docs before asserting it applies, rather
than assuming an older example still matches the current API.

The 12 Factors

I. Codebase

One codebase tracked in revision control, many deploys

  • Single Git repository for the application; every environment deploys from it
  • Environment-specific config lives outside the code
  • Use GitOps (ArgoCD, Flux) for deployment automation

Violations: multiple repositories for one application, per-environment codebases, copying code between repositories. Fix: consolidate to one repository and move the differences into environment config.

II. Dependencies

Explicitly declare and isolate dependencies

  • Declare every dependency in the package manager manifest; never rely on system-wide packages
  • Commit lock files for reproducible builds (package-lock.json, mix.lock, Cargo.lock, go.sum)
  • Multi-stage container builds isolate build-time dependencies from the runtime image

Worked Dockerfile and per-language manifest list: references/factor-examples.md.

III. Config

Store config in the environment

All configuration comes from environment variables — anything that varies between deploys: credentials, hostnames, ports, pool sizes, backing service URLs, model names.

# Elixir - config/runtime.exs
config :my_app, MyApp.Repo,
  hostname: System.get_env("DATABASE_HOST") || "localhost",
  password: System.fetch_env!("DATABASE_PASSWORD"),
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")

What makes a violation, and the smallest correct fix:

  • Hardcoded value that differs (or could differ) between deploys → read it from an environment variable, with a default only when a safe dev default exists
  • Hardcoded model name, API endpoint, or service hostname → environment variable; model names are config, not code
  • Config file with real values committed to version control → environment variables plus a committed .example template
  • Environment-specific code path (if env == "production") → one code path driven by a config value

Litmus test from 12factor.net: the codebase could be made open source at any moment without compromising any credentials.

Kubernetes ConfigMap/Secret wiring: references/kubernetes.md.

IV. Backing Services

Treat backing services as attached resources

  • Databases, queues, caches, and third-party APIs all attach via URLs in environment variables
  • No distinction between local and third-party services
  • Swapping a backing service is a configuration change only — never a code change

V. Build, Release, Run

Strictly separate build and run stages

  1. Build: convert code to executable bundle
  2. Release: combine build with config
  3. Run: execute in target environment
  • Releases are immutable and uniquely identified (git SHA, semver)
  • Roll back by redeploying a previous release, never by modifying one
  • Build artifacts stay separate from runtime config

CI/CD pipeline example: references/factor-examples.md.

VI. Processes

Execute the app as one or more stateless processes

  • Processes are stateless and share-nothing; persistent state lives in backing services
  • No sticky sessions, no local filesystem for persistent data
  • Violation: in-memory session or state store → move it to Redis or the database

Session-store example: references/factor-examples.md. Deployment manifest: references/kubernetes.md.

VII. Port Binding

Export services via port binding

  • Bind to 0.0.0.0, never localhost; take the port number from the environment
  • HTTP server library embedded in the app — no reliance on runtime injection (Apache, Nginx)

VIII. Concurrency

Scale out via the process model

  • Scale horizontally by adding processes, not vertically by enlarging them
  • Distinct process types (web, worker, scheduler) scale independently
  • The OS or platform process manager owns processes — never daemonize or write PID files

IX. Disposability

Maximize robustness with fast startup and graceful shutdown

  • Minimize startup time (under 10 seconds ideal) — fast startup enables rapid scaling
  • Handle SIGTERM: finish in-flight requests, close connections, then exit
  • Stay robust against sudden
Полный SKILL.md на GitHub

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

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

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

Вложенные файлы

  • references/factor-examples.md
  • references/infrastructure-conventions.md
  • references/kubernetes.md
  • references/modern-extensions.md
  • references/operations.md

FAQ

Что делает скилл twelve-factor?

Guide for 12-Factor cloud-native applications. Use when designing microservices, configuring containers, deploying to Kubernetes, or following cloud-native patterns.

Как установить скилл twelve-factor?

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

Скилл twelve-factor запускает скрипты?

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

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

Сравнить twelve-factor с