AGENT SKILL

12-Factor 应用合规分析

12-factor-apps

对任意代码库执行 12-Factor App(十二要素应用)合规性分析。用于依据原始的 Twelve-Factor 方法论评估应用架构或云原生就绪度。

License 许可
MIT
最近更新
2026-08-03
Stars
★ 1
Forks
0

01 前言 Front Matter

name
12-factor-apps
description
Perform 12-Factor App compliance analysis on any codebase. Use when evaluating app architecture or cloud-native readiness against the original Twelve-Factor methodology.

03 SKILL.md 正文

12-Factor App Compliance (Concise Checklist)

Reference: https://12factor.net

How to Use

  1. Identify app root. 2) For each factor, scan quickly (grep/find) and decide Strong/Partial/Weak. 3) Write 2–3 concrete remediation steps for any Weak items.

Factors & Fast Checks

I. Codebase – One repo, many deploys

  • Check: single VCS root; no env-specific branches.
  • Anti: multiple repos per app, duplicated code, prod/dev forks.

II. Dependencies – Explicit, isolated

  • Check: lockfiles (package-lock.json, poetry.lock, requirements.txt), no implicit globals.
  • Anti: system packages assumed, pip install . without lock, vendored libs committed.

III. Config – In env vars

  • Check: secrets/URLs in env, not in code; .env.example or README.
  • Anti: committed secrets, per-env config files baked into image, branching on NODE_ENV in code for secrets.

IV. Backing Services – Treat as attached resources

  • Check: URLs/DSNs injected; easy to swap (e.g., Postgres -> RDS) without code change.
  • Anti: hardcoded hostnames, local-only assumptions, service-specific branches.

V. Build/Release/Run – Strict separation

  • Check: CI/CD produces immutable artifacts; config injected at release; run is stateless.
  • Anti: editing images on servers, mutable releases, config baked into build.

VI. Processes – Stateless, share-nothing

  • Check: no writing to local disk for shared state; uses backing services for session/cache.
  • Anti: session on local FS, sticky sessions required, stateful workers.

VII. Port Binding – Self-contained service

  • Check: service exposes HTTP/ports directly; no reliance on injected runtime container.
  • Anti: requires being run under specific app server without config, no explicit port binding.

VIII. Concurrency – Scale via process model

  • Check: process types defined (web/worker); horizontal scaling documented.
  • Anti: single long-running process doing everything; no clear worker types.

IX. Disposability – Fast start/stop, graceful shutdown

  • Check: start <~60s; handles SIGTERM/SIGINT; idempotent jobs.
  • Anti: slow boot, ignores signals, long-running jobs without checkpoints.

X. Dev/Prod Parity – Keep gaps small

  • Check: similar backing services (DB type/versions); infra as code; same build tooling.
  • Anti: SQLite locally vs Postgres prod, manual prod setup, long-lived feature branches.

XI. Logs – Treat as event streams

  • Check: stdout/stderr logging; structured when possible; external aggregation.
  • Anti: writes to local files, log rotation on host, missing log levels.

XII. Admin Processes – Run as one-off tasks

  • Check: migrations/maintenance run in same env/image via one-off process.
  • Anti: manual shell on servers, divergent tooling for admin tasks.

Scoring Template

  • Strong: clear evidence of practice; no high-risk anti-patterns.
  • Partial: practice present with gaps; list 2 fixes.
  • Weak: practice absent or violated; list top 3 fixes + owners.

Report Skeleton

  • Summary: overall parity, top 3 risks, recommended next actions.
  • Per factor: Strong/Partial/Weak, evidence, specific remediations, owners/dates.

Quick Commands (examples)

  • Find secrets in repo: rg "(AKIA|secret|password|connectionString)"
  • Find env usage: rg 'process.env|os.environ'
  • Check lockfiles: find . -maxdepth 2 -name "*lock*" -o -name "poetry.lock" -o -name "requirements.txt"
  • Check signal handling (Go/Node/Python): look for signal.Notify, process.on('SIGTERM'), signal.signal.

04 同仓库更多 Skills

ray-manaloto
ray-manaloto/macos-development-environment

next-workflow-step

Use this skill when the user wants to transition to the next workflow step, wrap up a session cleanly, prepare a handoff, or says things like "next step", "continue the workflow", "wrap up", "hand off", "move to the next phase", "what's next in embrace", or "prepare for /clear". Also triggers when the current octo:embrace phase appears complete and no explicit next action is set.

★ 1
ray-manaloto
ray-manaloto/macos-development-environment

source-discovery

This skill should be used when the user asks to "find sources", "discover URLs", "catalog a source", "classify a URL", "search for libraries", "check what exists", or mentions source discovery, URL cataloging, source classification, or research source management.

★ 1
ray-manaloto
ray-manaloto/macos-development-environment

review-synthesis

This skill should be used when the user asks to "summarize review findings", "prioritize fixes", "rank review issues", "combine reviewer feedback", "create action items from review", or mentions review synthesis, finding prioritization, severity ranking, or review result summarization.

★ 1
ray-manaloto
ray-manaloto/macos-development-environment

research-scoring

This skill should be used when the user asks to "score research", "check research quality", "evaluate coverage", "measure improvement", "assess research completeness", or mentions research scoring, quality metrics, coverage gaps, improvement baseline, or research pipeline status.

★ 1
ray-manaloto
ray-manaloto/macos-development-environment

notebooklm-integration

This skill should be used when the user asks to "ingest into NotebookLM", "query NotebookLM", "add sources to notebook", "cross-source synthesis", "check stale sources", or mentions NotebookLM, notebook integration, source ingestion, or knowledge consolidation.

★ 1
ray-manaloto
ray-manaloto/macos-development-environment

evidence-synthesis

This skill should be used when the user asks to "synthesize findings", "combine research", "cross-reference sources", "summarize evidence", "write a deep review", or mentions evidence synthesis, finding consolidation, cross-source analysis, or research summarization.

★ 1