Twelve factor
Skill G1Joshi/Agent-Skills/skills/architecture/twelve-factor
Twelve-factor app methodology. Use for cloud-native apps.From its SKILL.md
npx -y skills add G1Joshi/Agent-Skills --skill twelve-factorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.8 KB, 685 tokens by cl100k_base, as published. Nobody here has run it
Twelve-Factor App
The Twelve-Factor App methodology is a set of best practices for building software-as-a-service apps. In 2025, it remains the gold standard for Cloud Native microservices and containerized applications.
When to Use
- ALWAYS, for any web application or service destined for the cloud (Kubernetes, PaaS, Serverless).
- Migrating legacy apps to the cloud (Replatforming).
The Twelve Factors (2025 Context)
- Codebase: One codebase tracked in revision control (Git), many deploys.
- Dependencies: Explicitly declare and isolate dependencies (Docker, package.json). No system-wide installs.
- Config: Store config in the environment (Env Vars, Secrets Manager). Never in code.
- Backing Services: Treat backing services (DB, Queue, Cache) as attached resources (URL/Credentials).
- Build, Release, Run: Strictly separate build and run stages. CI/CD pipelines are mandatory.
- Processes: Execute the app as one or more stateless processes. State goes to backing services (Redis/DB).
- Port Binding: Export services via port binding (e.g.,
app.listen(8080)). No reliance on server injection (Tomcat). - Concurrency: Scale out via the process model (Replicas in K8s).
- Disposability: Maximize robustness with fast startup and graceful shutdown (SIGTERM handling).
- Dev/Prod Parity: Keep development, staging, and production as similar as possible (Docker helps here).
- Logs: Treat logs as event streams. Do not write to files; write to
stdout/stderr. - Admin Processes: Run admin/management tasks as one-off processes (e.g., DB migrations) in the same environment.
Quick Start (Dockerized App)
# Dockerfile embodies dependencies, port binding, and build/run separation
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json .
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
# Dependencies
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
# Config via Env
ENV PORT=8080
# Port Binding
EXPOSE 8080
# Disposability (Process 1)
CMD ["node", "dist/main.js"]
Best Practices
Do:
- Use Docker to satisfy dependencies and dev/prod parity.
- Use Environment Variables for secrets and config.
- Implement Graceful Shutdown to stop accepting new requests and finish current ones.
Don't:
- Don't hardcode IP addresses or file paths.
- Don't rely on "Sticky Sessions" (violates Statelessness).
- Don't log to local files in a container (they vanish).
References
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.