Engineering
buck2-rule-basics avatar

buck2-rule-basics

An interactive tutorial for learning Buck2 build system fundamentals through hands-on rule writing, covering rules, actions, targets, and configurations.

Introduction

The buck2-rule-basics skill provides an immersive, step-by-step learning environment designed for engineers looking to master the Buck2 build system. Instead of static documentation, it facilitates an interactive workflow where you write and test real Buck2 rules to perform text processing. The skill guides you through the complexities of the Buck2 build model, including the load, configuration, analysis, and execution phases. It is perfectly suited for developers onboarding onto projects that use Buck2 or those who want to understand how to define custom build logic in a high-performance build environment.

  • Step-by-step interactive guidance that tracks progress through 8 distinct modules, ranging from minimal rule stubs to advanced configuration-dependent builds.

  • Integrated access to technical references covering core concepts like artifacts (source and build), provider propagation, transitive dependencies, and complex action definitions.

  • Hands-on exercises involving the actual buck2 command-line interface, ensuring the skills learned are immediately applicable to real-world software engineering tasks.

  • Adaptive teaching style that offers additional context for beginners while allowing experienced users to move quickly through known concepts or experiment with advanced patterns.

  • Always follow the tutorial-specific instructions: start by checking the current project state, create necessary files (e.g., uppercase.bzl, BUCK files), and use the system buck2 binary for all operations.

  • Use the provided references/concepts.md for deep dives into analysis and build graph structures (uquery, cquery, aquery), and references/advanced_patterns.md for production-grade patterns like custom providers and toolchain dependencies.

  • The tutorial emphasizes learning by doing; verify each step with the buck2 build command and observe how actions and artifacts are managed by the engine.

  • Be sure to interact with the skill using the provided assessment questions to ensure comprehension before advancing to more complex topics like select() resolutions or multi-platform builds.

Repository Stats

Stars
4,330
Forks
346
Open Issues
391
Language
Rust
Default Branch
main
Sync Status
Idle
Last Synced
May 3, 2026, 07:04 PM
View on GitHub