Agent skill
twelve-factor-app
Install this agent skill to your Project
npx add-skill https://github.com/markpitt/claude-skills/tree/main/skills/twelve-factor-app
SKILL.md
Twelve-Factor App
A methodology for building portable, resilient, and scalable software-as-a-service applications. Originally codified by the Heroku team and applicable to apps written in any programming language using any backing service combination.
When to Load Which Resource
| Task / Topic | Load Resource | Key Factors |
|---|---|---|
| Source control, versioning, or package management | codebase-and-dependencies.md |
I. Codebase, II. Dependencies |
| Environment variables, secrets, or external service connections | config-and-backing-services.md |
III. Config, IV. Backing Services |
| CI/CD pipelines, release management, or deployment separation | build-release-run.md |
V. Build, Release, Run |
| Stateless design, port binding, or horizontal scaling | processes-and-concurrency.md |
VI. Processes, VII. Port Binding, VIII. Concurrency |
| Startup time, graceful shutdown, or environment parity | disposability-and-parity.md |
IX. Disposability, X. Dev/Prod Parity |
| Logging strategy or administrative/management tasks | logs-and-admin.md |
XI. Logs, XII. Admin Processes |
| Full audit, compliance check, or new app setup | implementation-guide.md |
All 12 factors |
Quick Reference: The 12 Factors
| # | Factor | Principle |
|---|---|---|
| I | Codebase | One codebase in version control, many deploys |
| II | Dependencies | Explicitly declare and isolate all dependencies |
| III | Config | Store config in the environment, not in code |
| IV | Backing Services | Treat databases, queues, etc. as attached resources |
| V | Build, Release, Run | Strictly separate build and run stages |
| VI | Processes | Execute as stateless, share-nothing processes |
| VII | Port Binding | Export services via port binding, not server injection |
| VIII | Concurrency | Scale out via the process model |
| IX | Disposability | Fast startup and graceful shutdown |
| X | Dev/Prod Parity | Keep all environments as similar as possible |
| XI | Logs | Treat logs as event streams written to stdout |
| XII | Admin Processes | Run admin tasks as one-off processes |
Orchestration Protocol
Phase 1: Identify the Concern
Determine which factor(s) are relevant to the user's question:
- Structuring code or repos → Factor I (Codebase)
- Library versions or system tools → Factor II (Dependencies)
- Secrets, credentials, or deploy-specific values → Factor III (Config)
- Database, cache, queue, or third-party API → Factor IV (Backing Services)
- Deploy pipeline, release artifacts, rollback → Factor V (Build, Release, Run)
- Session state, filesystem writes, or in-memory caches → Factor VI (Processes)
- Embedding a web server vs. self-hosting → Factor VII (Port Binding)
- Scaling, worker types, or process formation → Factor VIII (Concurrency)
- Restart speed, SIGTERM handling, idempotent jobs → Factor IX (Disposability)
- SQLite in dev / Postgres in prod, or parity gaps → Factor X (Dev/Prod Parity)
- Log files, log aggregation, or structured logging → Factor XI (Logs)
- Migrations, one-off scripts, or REPL access → Factor XII (Admin Processes)
Phase 2: Load and Apply
Load the appropriate resource file(s), then:
- Identify the current state against the factor's principle
- Highlight any violations or gaps
- Propose concrete remediation steps with examples
- Note dependencies between factors (e.g., Factor III enables Factor IV)
Phase 3: Validate
After applying recommendations:
- Confirm environment config is not in code
- Confirm no local state is assumed to persist across restarts
- Confirm deploy pipeline has distinct build → release → run stages
- Confirm logs flow to stdout rather than files
Common Task Workflows
Auditing an Existing App for 12-Factor Compliance
- Load
implementation-guide.mdfor the full compliance checklist - Work through each factor systematically using the checklist
- For deep dives on violations, load the relevant resource file
- Produce a prioritized remediation plan (high-impact violations first)
Designing a New Cloud-Native Service
- Start with
codebase-and-dependencies.mdto establish repo and dependency strategy - Review
config-and-backing-services.mdto design config injection and service binding - Review
build-release-run.mdto plan the CI/CD pipeline - Review
processes-and-concurrency.mdto design stateless process architecture - Use
implementation-guide.mdfor language-specific examples
Reviewing Config / Secrets Management
- Load
config-and-backing-services.md - Verify all environment-specific values use environment variables
- Check that no credentials are hardcoded or in config files checked into source control
- Confirm backing services are treated as attached resources (swappable via config)
Fixing a Scaling Problem
- Load
processes-and-concurrency.md - Verify processes are stateless and share-nothing
- Check for sticky sessions, local filesystem state, or in-process caches
- Review process types (web, worker) and confirm horizontal scale-out is possible
Resource File Summaries
- codebase-and-dependencies.md — Factors I & II: version control strategy, one-repo-per-app rule, dependency declaration manifests, and isolation tooling
- config-and-backing-services.md — Factors III & IV: environment variable patterns, secrets management, treating all external services as attached resources
- build-release-run.md — Factor V: separating build artifacts from configuration, immutable releases, rollback strategies, CI/CD pipeline design
- processes-and-concurrency.md — Factors VI, VII & VIII: stateless process design, port binding, process types, horizontal scaling, the Unix process model
- disposability-and-parity.md — Factors IX & X: fast startup, graceful SIGTERM handling, idempotent jobs, eliminating dev/prod gaps in tools and data
- logs-and-admin.md — Factors XI & XII: stdout-based logging, log routing, structured logging, running migrations and one-off tasks as isolated processes
- implementation-guide.md — Full compliance checklist for all 12 factors with practical examples across Python, Node.js, Ruby, and Java
Best Practices Summary
- Config litmus test: Would open-sourcing the codebase expose any secrets? If yes, Factor III is violated.
- Process litmus test: Can any process be killed and restarted without data loss? If no, Factor VI or IX is violated.
- Parity litmus test: Does the local dev stack use the same type of backing service as production? If no, Factor X is violated.
- Factors are interdependent: Factor III (Config) enables Factor IV (Backing Services swappability). Factor VI (Processes) enables Factor VIII (Concurrency) and IX (Disposability).
External References
- 12factor.net — Official methodology documentation
- Beyond the Twelve-Factor App — Extended factors for modern cloud apps
- The Heroku Way — Practical implementation examples
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
microsoft-graph
Orchestration hub for Microsoft Graph API across Microsoft 365 services. Use for Graph API integrations, querying Microsoft 365 data, and building applications that interact with Azure AD.
azure-swa
Comprehensive expertise for Azure Static Web Apps including architecture, configuration, API integration with Azure Functions, authentication, routing, deployment, and CI/CD. Use when building, configuring, deploying, or troubleshooting Azure Static Web Apps projects with frameworks like React, Angular, Vue, Blazor, or vanilla JavaScript.
github-api
Orchestrates comprehensive GitHub API access across all services. Intelligently routes API operations to specialized resource files covering authentication, repositories, issues/PRs, workflows, security, and more. Use when implementing GitHub integrations, automating operations, or building applications that interact with GitHub.
agent-patterns
Modular orchestration of agent patterns from Anthropic's engineering guide. Intelligently selects and implements prompt chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer, and autonomous agents. Includes pattern combinations and language-specific implementations.
gcse-history-tutor
GCSE History tutor and revision assistant for 15–16 year old students preparing for 2026 exams across AQA, Edexcel, OCR, and Eduqas/WJEC boards. Use when a student asks for help understanding history topics, answering exam questions, revising for GCSEs, practising source analysis, writing essays, or wants guidance on exam technique for GCSE History.
Didn't find tool you were looking for?