Communitygithub.com

flox-environments

Erstelle reproduzierbare, plattformübergreifende (macOS/Linux) Entwicklungsumgebungen mit Flox, einem deklarativen Nix-basierten Umgebungsmanager. Verwende es zum Einrichten von Projekt-Toolchains für jede Sprache, Installieren von Systemabhängigkeiten (Compiler, Datenbanken, native Bibliotheken wie openssl/BLAS), Festlegen exakter Paketversionen für ein Team, Ausführen lokaler Dienste (PostgreSQL, Redis, Kafka) und für das Onboarding von Entwicklern mit einem Befehl.

Was ist flox-environments?

Dieses Skill ermöglicht es Entwicklern und KI-Agenten, reproduzierbare Entwicklungsumgebungen mit Flox zu definieren und zu verwalten. Flox basiert auf Nix und bietet Zugriff auf über 150.000 Pakete, die in einer einzigen TOML-Manifestdatei (.flox/env/manifest.toml) deklariert werden. Es eignet sich besonders für Projekte, die Systempakete (Compiler, Datenbanken, CLI-Tools) benötigen, plattformübergreifend (macOS und Linux) arbeiten müssen oder mehrere Tools in einer Umgebung kombinieren sollen. Der Skill beschreibt die Kernkonzepte (Manifeststruktur, Hooks, Profile), wichtige Befehle (flox init, install, activate) und zeigt sprachspezifische Rezepte für Python, Node.js, Rust, Go und C/C++. Er behandelt auch Anti-Patterns, das Teilen von Umgebungen über Git oder FloxHub und gibt eine vollständige Anleitung für KI-gestützte Workflows, bei denen Agenten ohne sudo Pakete installieren können. Debugging-Hinweise und eine Liste verwandter Skills (flox-services, flox-builds, flox-containers) runden die Dokumentation ab.

Funktioniert mit✓Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/flox-environments

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Flox-Umgebungen

Mit Flox erstellst du reproduzierbare Entwicklungsumgebungen, die in einem einzigen TOML-Manifest definiert sind. Jeder Entwickler im Team erhält identische Pakete, Werkzeuge und Konfiguration – sowohl auf macOS als auch auf Linux – ohne Container oder VMs. Flox basiert auf Nix und bietet Zugriff auf über 150.000 Pakete.

Wann du dieses Skill aktivieren solltest

Nutze dieses Skill, wenn der Benutzer ein Problem mit der Verwaltung von Entwicklungsumgebungen hat – auch wenn er Flox nicht erwähnt hat. Flox ist das richtige Werkzeug, wenn:

  • Das Projekt Systempakete benötigt (Compiler, Datenbanken, CLI-Tools) neben sprachspezifischen Abhängigkeiten.
  • Reproduzierbarkeit wichtig ist – die Einrichtung muss auf dem Rechner eines Teamkollegen, in CI oder auf einem neuen Laptop identisch funktionieren.
  • Der Benutzer mehrere Werkzeuge koexistieren lassen muss – z. B. Python 3.11 + PostgreSQL 16 + Redis + Node.js in einer Umgebung.
  • Plattformübergreifende Unterstützung benötigt wird (macOS und Linux aus derselben Konfiguration).
  • KI-Agenten Werkzeuge installieren müssen – Flox erlaubt es Agenten, Pakete in einer projektspezifischen Umgebung ohne sudo, Systemverschmutzung oder Sandbox-Einschränkungen hinzuzufügen.

Wenn der Benutzer nur eine einzelne Sprachlaufzeit ohne Systemabhängigkeiten benötigt, reichen Standardwerkzeuge (nvm, pyenv, rustup) möglicherweise aus. Wenn eine vollständige OS-Isolation erforderlich ist, sind Container geeigneter. Flox liegt im Sweet Spot: deklarative, reproduzierbare Umgebungen ohne Container-Overhead.

Voraussetzung: Flox muss zuerst installiert sein – siehe flox.dev/docs für macOS, Linux und Docker.

Kernkonzepte

Flox-Umgebungen werden in .flox/env/manifest.toml definiert und mit flox activate aktiviert. Das Manifest deklariert Pakete, Umgebungsvariablen, Setup-Hooks und Shell-Konfiguration – alles, was benötigt wird, um die Umgebung überall zu reproduzieren.

Wichtige Pfade:

  • .flox/env/manifest.toml – Umgebungsdefinition (in die Versionsverwaltung einchecken)
  • $FLOX_ENV – Laufzeitpfad zu installierten Paketen (wie /usr – enthält bin/, lib/, include/)
  • $FLOX_ENV_CACHE – Persistenter lokaler Speicher für Caches, venvs, Daten (überlebt Neuerstellungen)
  • $FLOX_ENV_PROJECT – Projektwurzelverzeichnis (wo .flox/ liegt)

Wichtige Befehle

flox init                       # Neue Umgebung erstellen
flox search <package> [--all]   # Nach Paketen suchen
flox show <package>             # Verfügbare Versionen anzeigen
flox install <package>          # Paket hinzufügen
flox list                       # Installierte Pakete auflisten
flox activate                   # Umgebung betreten
flox activate -- <cmd>          # Befehl in der Umgebung ausführen (ohne Subshell)
flox edit                       # Manifest interaktiv bearbeiten

Manifest-Struktur

# .flox/env/manifest.toml

[install]
# Zu installierende Pakete – das Herz der Umgebung
ripgrep.pkg-path = "ripgrep"
jq.pkg-path = "jq"

[vars]
# Statische Umgebungsvariablen
DATABASE_URL = "postgres://localhost:5432/myapp"

[hook]
# Nicht-interaktive Setup-Skripte (werden bei jeder Aktivierung ausgeführt)
on-activate = """
  echo "Umgebung bereit"
"""

[profile]
# Shell-Funktionen und Aliase (verfügbar in interaktiver Shell)
common = """
  alias dev="npm run dev"
"""

[options]
# Unterstützte Plattformen
systems = ["x86_64-linux", "aarch64-linux", "x86_64-darwin", "aarch64-darwin"]

Paketinstallationsmuster

Basisinstallation

[install]
nodejs.pkg-path = "nodejs"
python.pkg-path = "python311"
rustup.pkg-path = "rustup"

Versionsfestlegung

[install]
nodejs.pkg-path = "nodejs"
nodejs.version = "^20.0"          # Semver-Bereich: aktuellste 20.x

postgres.pkg-path = "postgresql"
postgres.version = "16.2"         # Exakte Version

Plattformspezifische Pakete

[install]
# Nur Linux-Werkzeuge
valgrind.pkg-path = "valgrind"
valgrind.systems = ["x86_64-linux", "aarch64-linux"]

# macOS-Frameworks
Security.pkg-path = "darwin.apple_sdk.frameworks.Security"
Security.systems = ["x86_64-darwin", "aarch64-darwin"]

# GNU-Werkzeuge auf macOS (wo BSD-Standards abweichen)
coreutils.pkg-path = "coreutils"
coreutils.systems = ["x86_64-darwin", "aarch64-darwin"]

Auflösen von Paketkonflikten

Wenn zwei Pakete dieselbe Binärdatei installieren, verwende priority (niedrigere Zahl gewinnt):

[install]
gcc.pkg-path = "gcc12"
gcc.priority = 3

clang.pkg-path = "clang_18"
clang.priority = 5               # gcc gewinnt Dateikonflikte

Verwende pkg-group, um Pakete zu gruppieren, die gemeinsam aufgelöst werden sollen:

[install]
python.pkg-path = "python311"
python.pkg-group = "python-stack"

pip.pkg-path = "python311Packages.pip"
pip.pkg-group = "python-stack"    # Wird zusammen mit python aufgelöst

Sprachspezifische Rezepte

Python mit uv

[install]
python.pkg-path = "python311"
uv.pkg-path = "uv"

[vars]
UV_CACHE_DIR = "$FLOX_ENV_CACHE/uv-cache"
PIP_CACHE_DIR = "$FLOX_ENV_CACHE/pip-cache"

[hook]
on-activate = """
  venv="$FLOX_ENV_CACHE/venv"
  if [ ! -d "$venv" ]; then
    uv venv "$venv" --python python3
  fi
  if [ -f "$venv/bin/activate" ]; then
    source "$venv/bin/activate"
  fi

  if [ -f requirements.txt ] && [ ! -f "$FLOX_ENV_CACHE/.deps_installed" ]; then
    uv pip install --python "$venv/bin/python" -r requirements.txt --quiet
    touch "$FLOX_ENV_CACHE/.deps_installed"
  fi
"""

Node.js

[install]
nodejs.pkg-path = "nodejs"
nodejs.version = "^20.0"

[hook]
on-activate = """
  if [ -f package.json ] && [ ! -d node_modules ]; then
    npm install --silent
  fi
"""

Rust

[install]
rustup.pkg-path = "rustup"
pkg-config.pkg-path = "pkg-config"
openssl.pkg-path = "openssl"

[vars]
RUSTUP_HOME = "$FLOX_ENV_CACHE/rustup"
CARGO_HOME = "$FLOX_ENV_CACHE/cargo"

[profile]
common = """
  export PATH="$CARGO_HOME/bin:$PATH"
"""

Go

[install]
go.pkg-path = "go"
gopls.pkg-path = "gopls"
delve.pkg-path = "delve"

[vars]
GOPATH = "$FLOX_ENV_CACHE/go"
GOBIN = "$FLOX_ENV_CACHE/go/bin"

[profile]
common = """
  export PATH="$GOBIN:$PATH"
"""

C/C++

[install]
gcc.pkg-path = "gcc13"
gcc.pkg-group = "compilers"

# WICHTIG: gcc allein legt keine libstdc++-Header offen – gcc-unwrapped wird benötigt
gcc-unwrapped.pkg-path = "gcc-unwrapped"
gcc-unwrapped.pkg-group = "libraries"

cmake.pkg-path = "cmake"
cmake.pkg-group = "build"

gnumake.pkg-path = "gnumake"
gnumake.pkg-group = "build"

gdb.pkg-path = "gdb"
gdb.systems = ["x86_64-linux", "aarch64-linux"]

Hooks und Profile

Hooks – Nicht-interaktive Einrichtung

Hooks werden bei jeder Aktivierung ausgeführt. Halte sie schnell und idempotent. Faustregel: Wenn etwas automatisch passieren soll, setze es in [hook]; wenn der Benutzer es eingeben können soll, setze es in [profile].

[hook]
on-activate = """
  setup_database() {
    if [ ! -d "$FLOX_ENV_CACHE/pgdata" ]; then
      initdb -D "$FLOX_ENV_CACHE/pgdata" --no-locale --encoding=UTF8
    fi
  }
  setup_database
"""

Profile – Interaktive Shell-Konfiguration

Profil-Code ist in der Shell-Sitzung des Benutzers verfügbar.

[profile]
common = """
  dev() { npm run dev; }
  test() { npm run test -- "$@"; }
"""

Anti-Patterns

Absolute Pfade

# SCHLECHT – bricht auf anderen Rechnern
[vars]
PROJECT_DIR = "/home/alice/projects/myapp"

# GUT – Flox-Umgebungsvariablen verwenden
[vars]
PROJECT_DIR = "$FLOX_ENV_PROJECT"

Verwendung von exit in Hooks

# SCHLECHT – beendet die Shell
[hook]
on-activate = """
  if [ ! -f config.json ]; then
    echo "Konfiguration fehlt"
    exit 1
  fi
"""

# GUT – return aus dem Hook verwenden, nicht exit
[hook]
on-activate = """
  if [ ! -f config.json ]; then
    echo "Konfiguration fehlt – zuerst Setup ausführen"
    return 1
  fi
"""

Geheimnisse im Manifest speichern

# SCHLECHT – Manifest wird in git eingecheckt
[vars]
API_KEY = "<set-at-runtime>"

# GUT – externe Konfiguration referenzieren oder zur Laufzeit übergeben
# Verwendung: API_KEY="<dein-api-key>" flox activate
[vars]
API_KEY = "${API_KEY:-}"

Langsame Hooks ohne Idempotenz-Schutz

# SCHLECHT – installiert bei jeder Aktivierung neu
[hook]
on-activate = """
  pip install -r requirements.txt
"""

# GUT – überspringen, wenn bereits installiert
[hook]
on-activate = """
  if [ ! -f "$FLOX_ENV_CACHE/.deps_installed" ]; then
    uv pip install -r requirements.txt --quiet
    touch "$FLOX_ENV_CACHE/.deps_installed"
  fi
"""

Benutzerbefehle in Hooks platzieren

# SCHLECHT – Hook-Funktionen sind in der interaktiven Shell nicht verfügbar
[hook]
on-activate = """
  deploy() { kubectl apply -f k8s/; }
"""

# GUT – [profile] für vom Benutzer aufrufbare Funktionen verwenden
[profile]
common = """
  deploy() { kubectl apply -f k8s/; }
"""

Full-Stack-Beispiel

Eine vollständige Umgebung für eine Python-API mit PostgreSQL:

[install]
python.pkg-path = "python311"
uv.pkg-path = "uv"
postgresql.pkg-path = "postgresql_16"
redis.pkg-path = "redis"
jq.pkg-path = "jq"
curl.pkg-path = "curl"

[vars]
UV_CACHE_DIR = "$FLOX_ENV_CACHE/uv-cache"
DATABASE_URL = "postgres://localhost:5432/myapp"
REDIS_URL = "redis://localhost:6379"

[hook]
on-activate = """
  if [ ! -d "$FLOX_ENV_CACHE/pgdata" ]; then
    initdb -D "$FLOX_ENV_CACHE/pgdata" --no-locale --encoding=UTF8
  fi

  venv="$FLOX_ENV_CACHE/venv"
  if [ ! -d "$venv" ]; then
    uv venv "$venv" --python python3
  fi
  if [ -f "$venv/bin/activate" ]; then
    source "$venv/bin/activate"
  fi

  if [ -f requirements.txt ] && [ ! -f "$FLOX_ENV_CACHE/.deps_installed" ]; then
    uv pip install --python "$venv/bin/python" -r requirements.txt --quiet
    touch "$FLOX_ENV_CACHE/.deps_installed"
  fi
"""

[profile]
common = """
  serve() { uvicorn app.main:app --reload --host 0.0.0.0 --port 8000; }
  migrate() { alembic upgrade head; }
"""

[services]
postgres.command = "postgres -D $FLOX_ENV_CACHE/pgdata -k $FLOX_ENV_CACHE"
redis.command = "redis-server --port 6379 --daemonize no"

[options]
systems = ["x86_64-linux", "aarch64-linux", "x86_64-darwin", "aarch64-darwin"]

Aktivieren mit Diensten: flox activate --start-services

Umgebungen teilen

Flox-Umgebungen sind git-nativ. Checke das .flox/-Verzeichnis ein und jeder Mitarbeiter erhält dieselbe Umgebung:

git add .flox/
git commit -m "Flox-Umgebung hinzugefügt"
# Teamkollegen führen einfach aus:
git clone <repo> && cd <repo> && flox activate

Für wiederverwendbare Basisumgebungen über Projekte hinweg auf FloxHub pushen:

flox push                         # Umgebung auf FloxHub pushen
flox activate -r owner/env-name   # Remote-Umgebung überall aktivieren

Umgebungen mit [include] kombinieren:

[include]
base.floxhub = "myorg/python-base"

[install]
# Projektspezifische Ergänzungen zur Basis
fastapi.pkg-path = "python311Packages.fastapi"

KI-unterstützte Entwicklung und Vibe Coding

Flox ist ideal für KI-unterstützte Entwicklung und Vibe-Coding-Workflows. Wenn ein KI-Agent ein Werkzeug benötigt, das in der aktuellen Umgebung nicht verfügbar ist – einen Compiler, eine Datenbank, einen Linter, ein CLI-Dienstprogramm – kann er es zum Flox-Manifest des Projekts hinzufügen, ohne sudo-Zugriff, Systempakete zu verschmutzen oder Sandbox-Einschränkungen zu umgehen.

Warum dies für Agenten wichtig ist:

  • Kein sudo erforderlich – flox install funktioniert vollständig im Benutzerbereich, sodass Agenten Pakete ohne erhöhte Berechtigungen hinzufügen können
  • Projektbezogen – Pakete werden nur in die Projektumgebung installiert, nicht global, sodass verschiedene Projekte unterschiedliche Versionen ohne Konflikte haben können
  • Sandbox-freundlich – Agenten, die in sandboxierten oder eingeschränkten Umgebungen laufen, können dennoch die benötigten Werkzeuge über Flox installieren
  • Rückgängig machbar – jede Änderung wird in manifest.toml festgehalten, sodass unerwünschte Pakete sauber ohne Systemrückstände entfernt werden können
  • Reproduzierbar – wenn ein Agent eine Umgebung einrichtet, wird diese genaue Konfiguration in git eingecheckt und funktioniert für alle

Agent-Workflow-Muster:

# Agent stellt fest, dass ein Werkzeug benötigt wird (z. B. jq für JSON-Verarbeitung)
flox search jq                    # Überprüfen, ob das Paket existiert
flox install jq                   # In die Projektumgebung installieren

# Oder für mehr Kontrolle das Manifest direkt bearbeiten
tmp_manifest="$(mktemp)"
flox list -c > "$tmp_manifest"
# Paket im [install]-Abschnitt hinzufügen, dann anwenden
flox edit -f "$tmp_manifest"

# Einen Befehl mit dem verfügbaren Werkzeug ausführen
flox activate -- jq '.results[]' data.json

Dies macht Flox zu einer natürlichen Wahl für jeden Workflow, bei dem Claude Code oder andere KI-Agenten Projektwerkzeuge spontan einrichten müssen.

Fehlerbehebung

flox list -c                      # Rohes Manifest anzeigen
flox activate -- which python     # Prüfen, welche Binärdatei aufgelöst wird
flox activate -- env | grep FLOX  # Flox-Umgebungsvariablen anzeigen
flox search <package> --all       # Breitere Paketsuche (groß-/kleinschreibungssensitiv)

Häufige Probleme:

  • Paket nicht gefunden: Suche ist groß-/kleinschreibungssensitiv – versuche flox search --all
  • Dateikonflikte zwischen Paketen: Füge priority zu dem Paket hinzu, das gewinnen soll
  • Hook-Fehler: Verwende return statt exit; schütze mit ${FLOX_ENV_CACHE:-}
  • Veraltete Abhängigkeiten: Lösche die Markierungsdatei $FLOX_ENV_CACHE/.deps_installed

Verwandte Skills

Die folgenden Skills sind als Teil des Flox Claude Code Plugins für eine tiefere Integration verfügbar:

  • flox-services – Diensteverwaltung, Datenbankeinrichtung, Hintergrundprozesse
  • flox-builds – Reproduzierbare Builds und Paketierung mit Flox
  • flox-containers – Docker/OCI-Container aus Flox-Umgebungen erstellen
  • flox-sharing – Umgebungskomposition, Remote-Umgebungen, Team-Muster
  • flox-cuda – CUDA- und GPU-Entwicklungsumgebungen

Weitere Informationen und Installation unter flox.dev/docs

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

Verwandte Skills