gen-infra

gen-infra is a command for Claude Code from alphaaiservice/cortex. It costs 50 tokens per session (18,235 once invoked), scanned C, original, MIT.

A command that creates Infrastructure as Code: text files describing how to run and deploy an application's services. It supports Docker Compose, Kubernetes, K3s, Terraform, and Helm.

In plain words
What is it for?
It helps package detected application services for local containers, Kubernetes clusters, lightweight K3s clusters, cloud infrastructure, or Helm-based deployments.
Why use it?
It removes the need to write deployment configuration from scratch and can tailor it to development, staging, or production environments.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static.

Part of the cortex plugin — 43 commands, 1 MCP server shipped together

Good fit It helps package detected application services for local containers, Kubernetes clusters, lightweight K3s clusters, cloud infrastructure, or Helm-based deployments.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/alphaaiservice/cortex
agentmods
npx agentmods add commands/alphaaiservice/cortex/gen-infra

Made for: Claude Code.

Or install cortex, the plugin that ships this one along with the rest of its 43 commands, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gen-infra

README.md
[![agentmods](https://agentmods.dev/badge/commands/alphaaiservice/cortex/gen-infra/github.svg)](https://agentmods.dev/commands/alphaaiservice/cortex/gen-infra)
Your own site
<a href="https://agentmods.dev/commands/alphaaiservice/cortex/gen-infra"><img src="https://agentmods.dev/badge/commands/alphaaiservice/cortex/gen-infra/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gen-infra

Your own site · 80×15
<a href="https://agentmods.dev/commands/alphaaiservice/cortex/gen-infra"><img src="https://agentmods.dev/badge/commands/alphaaiservice/cortex/gen-infra.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 18,235 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.18235
Opus 5.5 $0.00020 $0.07294
Sonnet 5.5 $0.00010 $0.03647
Haiku 4.5 $0.00005 $0.01824

Measured 1mo ago against content hash 004884cf34b5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

gen-infra scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

&& rm -rf /var/lib/apt/lists/*

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| Nginx | `nginx:1.25-alpine` | 80/443 | `curl localhost` |
commands/gen-infra.md · 2,193 lines

How it starts

The opening of the file, as written. The whole thing — 2,193 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Infrastructure as Code Generator

Target: $ARGUMENTS

Parse $ARGUMENTS to extract:

  • Infrastructure type: docker | k8s | k3s | terraform | helm (default: docker)
  • Environment: --env=development | --env=staging | --env=production (default: development)

If $ARGUMENTS is empty, default to docker --env=development.


Step 1: Detect Application Services

Scan the project to identify all services. Run these in parallel using Agent tool (mode = "bypassPermissions"):

Scan 1: Backend Detection

echo "=== Python/FastAPI Backend ==="
ls -la app/ src/ backend/ 2>/dev/null
cat requirements*.txt pyproject.toml setup.py 2>/dev/null | head -100

echo ""
echo "=== Node.js/NestJS Backend ==="
ls -la src/main.ts nest-cli.json 2>/dev/null
cat package.json 2>/dev/null | grep -E "nestjs|@nestjs" | head -20

echo ""
echo "=== Java/Spring Boot Backend ==="
ls -la build.gradle.kts pom.xml src/main/java 2>/dev/null
cat build.gradle.kts 2>/dev/null | head -50

echo ""
echo "=== Dockerfile ==="
ls -la Dockerfile docker/Dockerfile 2>/dev/null

echo ""
echo "=== Node/Next.js Frontend ==="
ls -la frontend/ web/ client/ next.config* package.json 2>/dev/null
cat package.json 2>/dev/null | head -50

Scan 2: Database & Services Detection

echo "=== Database Configs ==="
grep -rn "mysql\|MySQL\|asyncmy\|sqlalchemy" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -10
grep -rn "mongo\|MongoDB\|beanie\|motor\|pymongo" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -10
grep -rn "redis\|Redis" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -10

echo ""
echo "=== Additional Services ==="
grep -rn "meilisearch\|MeiliSearch" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5
grep -rn "celery\|Celery" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5
grep -rn "minio\|MinIO\|S3\|boto3" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5
grep -rn "qdrant\|Qdrant" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5
grep -rn "langfuse\|Langfuse" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5
grep -rn "flower" . --include="*.py" --include="*.toml" --include="*.txt" -l 2>/dev/null | head -5

Read the full file on GitHub · 2,193 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 2,193 lines · 50 tokens per session scan C 004884cf34b5

Subscribe to this mod's changes

gen-infra is a command published in the GitHub repository alphaaiservice/cortex (1 stars, last pushed 2mo ago), licensed MIT. It adds 50 tokens to every session and 18,235 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.