twelve-factor
Skill15 starsChanged 44 days agoMITView on GitHub
Expert Twelve-Factor App methodology assistance covering declarative setup, environment configuration, backing service bindings, stateless processes, and concurrency models. Use when architecting cloud-native applications, containerizing web services, or standardizing 12-factor compliance.
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- conjurer-rich/skillstheir own version, first seen Oct 25, 2026
- dakdevs/skillstheir own version, first seen May 2, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- conjurer-rich/skills★ 1same name
- dakdevs/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 136
Treat Logs as Event Streams: Write JSON logs directly to stdout / stderr.
- Distinctive: line 138
Keep Development and Production Parity: Use Docker Compose locally to run the exact database and cache engines used in production.
- Distinctive: line 139
Keep Processes Stateless: Store persistent data in external backing services (PostgreSQL, S3, Redis).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Twelve-Factor App
The Twelve-Factor App methodology provides architectural guidelines for building portable, resilient software-as-a-service applications optimized for modern cloud platforms and container runtimes.
When to Use
- Cloud-Native Application Architecture: Designing stateless, scalable web applications intended for Kubernetes, PaaS, or container clusters.
- Legacy Replatforming: Modernizing monolithic legacy software into containerized, cloud-ready deployment units.
- Zero-Downtime Rolling Deploys: Ensuring services can boot fast, survive sudden terminations, and run alongside differing versions.
- Standardizing Microservice Conventions: Establishing uniform configuration, logging, and dependency isolation standards across teams.
Quick Start
# 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"]Core Concepts
Declarative Dependencies & Port Binding
Dependencies are strictly pinned; applications self-host their web servers and bind directly to assigned ports:
// Explicit pinned dependencies in package.json
{
"dependencies": {
"express": "4.19.2",
"pg": "8.12.0"
}
}// Self-contained port binding (no external application container like Tomcat required)
const port = process.env.PORT || 8080;
app.listen(port, () => console.log(`Server bound to port ${port}`));Config Stored in the Environment
Strict separation of code and config; credentials, hostnames, and secrets are injected via environment variables:
// Validate environment config with Zod at startup
import { z } from "zod";
const EnvSchema = z.object({
PORT: z.coerce.number().default(8080),
DATABASE_URL: z.string().url(),
REDIS_URL: z.string().url(),
NODE_ENV: z.enum(["development", "test", "production"]).default("production"),
});
export const config = EnvSchema.parse(process.env);Disposability & Graceful Shutdown
Processes must start fast and shut down gracefully upon receiving termination signals:
// Graceful termination handling
process.on("SIGTERM", async () => {
console.log("SIGTERM received. Draining connections...");
server.close(async () => {
await dbPool.end();
console.log("All connections closed. Exiting process.");
process.exit(0);
});
});Common Patterns
Graceful Shutdown (Disposability)
Problem: Unhandled SIGTERM signals cause aborted in-flight HTTP requests and database connection leaks during rolling updates.
Solution: Intercept OS termination signals to drain traffic and close resources cleanly:
import express from "express";
const app = express();
const server = app.listen(process.env.PORT || 8080);
const shutdown = async (signal: string) => {
console.log(`Received ${signal}, starting graceful shutdown...`);
server.close(async () => {
// Close DB pool, flush queues, drain connections
await dbPool.end();
console.log("Cleanup complete. Exiting.");
process.exit(0);
});
// Force shutdown after timeout
setTimeout(() => {
console.error("Forcefully terminating process due to timeout.");
process.exit(1);
}, 10000).unref();
};
process.on("SIGTERM", () => shutdown("SIGTERM"));
process.on("SIGINT", () => shutdown("SIGINT"));Best Practices
Do:
- Treat Logs as Event Streams: Write JSON logs directly to
stdout/stderr; let vector collectors (FluentBit, Promtail) ship them. - Execute One-Off Admin Tasks in the Same Environment: Run database migrations via one-off container jobs matching release image hashes.
- Keep Development and Production Parity: Use Docker Compose locally to run the exact database and cache engines used in production.
- Keep Processes Stateless: Store persistent data in external backing services (PostgreSQL, S3, Redis).
Don't:
- Hardcode configuration or secrets in source code: Keep all credentials out of Git repositories.
- Rely on sticky sessions: Session state must live in distributed caches (Redis) to allow effortless horizontal scaling.
- Log to local files inside containers: Container filesystems are ephemeral and destroyed upon pod restart.
Troubleshooting
| Error | Cause | Solution |
Container killed with 137 (OOM) | Memory leak or unbounded container memory limit. | Set appropriate memory limits and profile process heap usage. |
EADDRINUSE | Port binding conflict or previous process did not exit. | Check running containers/processes; ensure dynamic PORT assignment. |
Missing environment variable | Config not injected during container startup. | Validate required env vars at startup using schema validation (e.g. Zod/Joi). |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

