twelve-factor-app
About
This Claude Skill provides the Twelve-Factor App methodology, offering 51 rules across 12 categories for building portable, scalable cloud-native applications. Use it when designing backend services, APIs, or microservices to guide decisions on configuration, deployment, logging, and infrastructure. It's particularly helpful for containerization, setting up CI/CD, and planning scaling strategies.
Quick Install
Claude Code
Recommended/plugin add https://github.com/majiayu000/claude-skill-registrygit clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/twelve-factor-appCopy and paste this command in Claude Code to install this skill
Documentation
Community Cloud-Native Applications Best Practices
Comprehensive methodology for building modern software-as-a-service applications that are portable, scalable, and maintainable. Contains 51 rules across 12 categories, covering the entire application lifecycle from codebase management to production operations.
When to Apply
Reference these guidelines when:
- Designing new backend services or APIs
- Containerizing applications for Kubernetes or Docker
- Setting up CI/CD pipelines
- Managing configuration across environments
- Implementing logging and monitoring
- Planning application scaling strategy
- Debugging deployment or environment issues
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Codebase & Version Control | CRITICAL | code- |
| 2 | Dependencies | CRITICAL | dep- |
| 3 | Configuration | CRITICAL | config- |
| 4 | Backing Services | HIGH | svc- |
| 5 | Build, Release, Run | HIGH | build- |
| 6 | Processes & State | HIGH | proc- |
| 7 | Concurrency & Scaling | HIGH | scale- |
| 8 | Disposability | HIGH | disp- |
| 9 | Port Binding | MEDIUM | port- |
| 10 | Dev/Prod Parity | MEDIUM | parity- |
| 11 | Logging | MEDIUM | log- |
| 12 | Admin Processes | MEDIUM | admin- |
Quick Reference
1. Codebase & Version Control (CRITICAL)
code-single-codebase- Maintain one codebase per application in version controlcode-one-app-one-repo- Enforce one-to-one correlation between codebase and applicationcode-deploys-not-branches- Use deploys not branches to represent environmentscode-shared-as-libraries- Factor shared code into libraries managed by dependency manager
2. Dependencies (CRITICAL)
dep-explicit-declaration- Declare all dependencies explicitly in a manifest filedep-isolate-execution- Isolate dependencies to prevent system package leakagedep-no-system-tools- Never rely on implicit system tools being availabledep-deterministic-builds- Use lockfiles for deterministic dependency resolution
3. Configuration (CRITICAL)
config-separate-from-code- Strictly separate configuration from codeconfig-use-env-vars- Store configuration in environment variablesconfig-no-env-groups- Treat environment variables as granular controls not grouped environmentsconfig-validate-on-startup- Validate required configuration at application startupconfig-never-commit-secrets- Never commit secrets or credentials to version control
4. Backing Services (HIGH)
svc-as-attached-resources- Treat backing services as attached resourcessvc-connection-strings- Reference all backing services via connection URLs in configsvc-no-local-vs-remote- Make no distinction between local and third-party servicessvc-detach-attach-without-code- Design services to be detachable and attachable without code changes
5. Build, Release, Run (HIGH)
build-separate-stages- Strictly separate build, release, and run stagesbuild-immutable-releases- Create immutable releases with unique identifiersbuild-no-runtime-changes- Never modify code at runtime - changes require new releasebuild-complexity-in-build- Push complexity into build stage keep run stage minimalbuild-artifact-per-commit- Generate one build artifact per commit deploy same artifact everywhere
6. Processes & State (HIGH)
proc-stateless-processes- Execute the application as stateless processesproc-no-sticky-sessions- Never use sticky sessions - store session data in backing servicesproc-no-local-filesystem- Never assume local filesystem persists between requestsproc-compile-at-build- Perform asset compilation and bundling at build time not runtimeproc-share-nothing- Design processes to share nothing with each other
7. Concurrency & Scaling (HIGH)
scale-process-model- Scale out via the process model with multiple process typesscale-process-types- Assign workloads to appropriate process typesscale-no-daemonize- Never daemonize or write PID files let process manager handle itscale-horizontal-not-vertical- Design for horizontal scaling over vertical scalingscale-process-formation- Define process formation as declarative configuration
8. Disposability (HIGH)
disp-disposable-processes- Design processes to be disposable started or stopped at any momentdisp-fast-startup- Minimize startup time to enable rapid scaling and recoverydisp-graceful-shutdown- Implement graceful shutdown on SIGTERMdisp-crash-only- Design for crash-only software that recovers from sudden deathdisp-idempotent-operations- Make operations idempotent to safely retry after failures
9. Port Binding (MEDIUM)
port-self-contained- Make the application completely self-contained with embedded serverport-export-via-binding- Export services via port binding using PORT environment variableport-any-protocol- Use port binding to export any protocol not just HTTP
10. Dev/Prod Parity (MEDIUM)
parity-minimize-gaps- Minimize gaps between development and production environmentsparity-same-backing-services- Use the same type and version of backing services in all environmentsparity-deploy-frequently- Deploy frequently to minimize the time gapparity-developers-deploy- Involve developers in deployment to minimize personnel gap
11. Logging (MEDIUM)
log-event-streams- Treat logs as event streams not fileslog-no-routing- Never route or store logs from within the applicationlog-structured-format- Use structured logging for machine-readable event streamslog-unbuffered-stdout- Write logs unbuffered to stdout for real-time streaming
12. Admin Processes (MEDIUM)
admin-one-off-processes- Run admin tasks as one-off processes not special scriptsadmin-same-environment- Run admin processes against a release with same codebase and configadmin-repl-access- Provide REPL access for debugging and data inspection
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
GitHub Repository
Related Skills
content-collections
MetaThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
creating-opencode-plugins
MetaThis skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.
sglang
MetaSGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.
evaluating-llms-harness
TestingThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
