Bazel-Builds in großen Monorepos können langsam und komplex sein. Dieser Skill bietet bewährte Muster für Remote-Caching, parallele Ausführung und benutzerdefinierte Regeln, um Build-Zeiten drastisch zu reduzieren.
Die Skill-ZIP herunterladen
In Claude hochladen
Gehe zu Einstellungen → Fähigkeiten → Skills → Skill hochladen
Einschalten und loslegen
Teste es
Verwendung von "bazel-build-optimization". Help me set up Bazel for a Python project with external dependencies
Erwartetes Ergebnis:
Here is a basic WORKSPACE.bazel configuration for Python:
```python
workspace(name = "myproject")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "...",
strip_prefix = "rules_python-0.27.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.0.tar.gz",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
```
Then create a BUILD.bazel file with py_library and py_test rules.
Verwendung von "bazel-build-optimization". How do I configure remote execution?
Erwartetes Ergebnis:
Add this to your .bazelrc for remote execution:
```bash
build:remote-exec --remote_executor=grpcs://remote.example.com
build:remote-exec --remote_instance_name=projects/myproject/instances/default
build:remote-exec --jobs=500
```
Security tips:
- Use TLS for remote endpoints
- Authenticate with OAuth or certificates
- Start with read-only remote cache before enabling execution
Sicherheitsaudit
SicherStatic analysis detected 36 potential issues (external_commands, network, filesystem patterns), but all are false positives. The skill contains documentation and templates for Bazel build optimization with example commands and configuration snippets - no actual executable code with security implications. URLs are legitimate documentation links, filesystem references are standard Bazel cache paths, and cryptographic mentions are SHA256 checksums for download verification.
Qualitätsbewertung
Was du bauen kannst
Remote-Caching für CI/CD-Pipelines einrichten
Konfigurieren Sie Bazel mit Remote-Caching, um Build-Artefakte über CI-Runner hinweg zu teilen und Build-Zeiten von Stunden auf Minuten zu reduzieren.
Großes TypeScript-Monorepo optimieren
Wenden Sie Best Practices für die Organisation von BUILD-Dateien, Aktivierung paralleler Ausführung und Konfiguration von Disk-Caching an.
Benutzerdefinierte Build-Regeln für Docker erstellen
Schreiben Sie eine benutzerdefinierte Bazel-Regel, um Docker-Images als Teil des Build-Graphen mit korrekter Dependency-Verfolgung zu erstellen.
Probiere diese Prompts
Help me set up Bazel for a new monorepo. I need to configure WORKSPACE.bazel with rules for JavaScript and Python. What are the essential configurations?
I want to set up remote caching for our Bazel builds. We use Google Cloud. Show me the .bazelrc configuration needed and any security considerations.
Create a custom Bazel rule that builds a Docker image. The rule should accept a Dockerfile, base image, and layer files as inputs.
Our Bazel build takes 30 minutes. Help me profile it using bazel build --profile and identify the slowest actions. What optimizations should I try first?
Bewährte Verfahren
- Verwenden Sie feinkörnige Targets statt großer Glob-Muster für bessere inkrementelle Builds
- Aktivieren Sie Remote-Caching frühzeitig - es bietet die größten Performance-Gewinne
- Pinnen Sie Dependency-Versionen in WORKSPACE, um reproduzierbare Builds zu gewährleisten
Vermeiden
- Verwendung von glob(['**/*.py']) für srcs - verursacht unnötige Rebuilds
- WORKSPACE-Setup überspringen - führt zu inkonsistenter Dependency-Auflösung
- Build-Warnungen ignorieren - kleine Probleme werden zu technischer Schuld
Häufig gestellte Fragen
Installiert dieser Skill Bazel?
Kann ich dies für andere Build-Systeme als Bazel verwenden?
Wie viel Build-Zeit kann ich sparen?
Ist Remote-Caching sicher?
Kann dies bei der Migration zu Bazel helfen?
Welche Sprachen werden unterstützt?
Entwicklerdetails
Autor
sickn33Lizenz
MIT
Repository
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/bazel-build-optimizationRef
main
Dateistruktur
📄 SKILL.md