agentleFS
weirdgmeweirdgme/Claude-code-infrastructure-showcase/.claude/skills/build-engineering/SKILL.md

build-engineering

Skill4 starsChanged 12 months agoMITView on GitHub

Build engineering covering build systems (Make, Gradle, Maven, Bazel), compilation optimization, dependency management, artifact repositories, build pipelines, reproducible builds, build caching, monorepo strategies, supply chain security, and performance optimization. Use when creating build processes, optimizing build times, managing dependencies, or implementing CI build pipelines. (project)

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 19 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    When starting a build engineering task:

    line 51
  2. Distinctive:

    Use local and remote build caches

    line 291
  3. Distinctive:

    Use build tool parallelization features

    line 298
  4. Distinctive:

    Use exact versions in lock files

    line 304
  5. Distinctive:

    Consider vendoring for critical dependencies

    line 306
  6. Distinctive:

    Use deterministic build tools

    line 312
  7. Distinctive:

    Avoid timestamps in artifacts

    line 313
  8. Distinctive:

    Document build environment requirements

    line 314
  9. Very specific:

    Use lock files (package-lock.json, Gemfile.lock, go.sum)

    line 317
  10. Distinctive:

    Test dependency updates before merging

    line 320
  11. Distinctive:

    Use hermetic builds when possible

    line 337
  12. Distinctive:

    Never commit secrets to version control

    line 343
  13. Distinctive:

    Use secret management tools

    line 344
  14. Distinctive:

    Use build tool's parallel features

    line 370
  15. Distinctive:

    Consider distributed builds for large projects

    line 371
  16. Distinctive:

    Document artifact promotion workflow

    line 383
  17. Distinctive:

    Use lock files for dependencies

    line 388
  18. Distinctive:

    Remove non-deterministic elements (timestamps)

    line 391
  19. Distinctive:

    Use hermetic build tools if possible

    line 392
  20. Distinctive:

    Verify builds are reproducible

    line 393

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎯 SKILL ACTIVATED: build-engineering ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Build Engineering

Comprehensive guide for build engineering covering build systems, compilation optimization, dependency management, artifact repositories, reproducible builds, and modern build practices for creating fast, reliable, and secure build pipelines.

When to Use This Skill

Automatically activates when working on:

  • Build system configuration (Gradle, Maven, Bazel, Make)
  • Build performance optimization and caching strategies
  • Dependency management and version resolution
  • Artifact repository setup (Artifactory, Nexus)
  • Reproducible builds and hermetic building
  • Monorepo build strategies
  • CI/CD pipeline build optimization
  • Build supply chain security
  • Distributed and parallel builds

Overview

Purpose: Enable teams to create efficient, reliable, and secure build processes that scale from small projects to large monorepos while maintaining build reproducibility and optimizing developer productivity.

Scope:

  • Build systems (Make, Gradle, Maven, Bazel, npm/yarn/pnpm)
  • Compilation optimization and distributed builds
  • Dependency management and version pinning
  • Artifact repositories and binary management
  • CI/CD build pipelines and automation
  • Reproducible and hermetic builds
  • Build caching strategies
  • Monorepo build tools and strategies
  • Supply chain security (SBOM, signed artifacts)
  • Build performance optimization

This skill is for:

  • Build engineers optimizing build performance
  • DevOps engineers creating CI/CD pipelines
  • Platform engineers managing build infrastructure
  • Developers improving build times
  • Security engineers implementing supply chain security

Quick Start Checklist

When starting a build engineering task:

  • Choose appropriate build tool for your language/ecosystem
  • Implement dependency locking for reproducibility
  • Set up artifact caching (local and remote)
  • Configure incremental compilation
  • Implement parallel build execution
  • Set up artifact repository (Artifactory, Nexus, registry)
  • Define clear build stages (compile, test, package)
  • Implement build caching strategy
  • Add dependency vulnerability scanning
  • Monitor and optimize build performance

Core Concepts

1. Build System Types

Make-based:

Traditional, file-based dependencies
Example: Make, CMake
Best for: C/C++, system-level builds

JVM-based:

Dependency resolution, artifact management
Example: Maven, Gradle
Best for: Java, Kotlin, Scala

Task-based:

Flexible task execution
Example: npm, Gulp, Rake
Best for: JavaScript, Ruby, general automation

Hermetic:

Fully reproducible, sandboxed builds
Example: Bazel, Buck, Pants
Best for: Large monorepos, multi-language projects

2. Build Pipeline Stages

┌─────────────────────────────────────────────────┐
│              Source Code                         │
└──────────────────┬──────────────────────────────┘
                   │
         ┌─────────▼─────────┐
         │  Dependency Fetch  │
         │  (with caching)    │
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐
         │   Compilation      │
         │  (incremental)     │
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐
         │      Testing       │
         │   (unit, int)      │
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐
         │     Packaging      │
         │  (artifacts)       │
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐
         │  Artifact Upload   │
         │   (registry)       │
         └───────────────────┘

3. Dependency Resolution

Semantic Versioning:

MAJOR.MINOR.PATCH
1.2.3

Major: Breaking changes
Minor: New features, backward compatible
Patch: Bug fixes

Version Constraints:

Exact:       1.2.3
Range:       >=1.2.0 <2.0.0
Caret:       ^1.2.3  (>=1.2.3 <2.0.0)
Tilde:       ~1.2.3  (>=1.2.3 <1.3.0)

4. Build Caching

Local Cache:

┌──────────────┐
│  Developer   │
│   Machine    │
│              │
│ Local Cache  │
│ (~/.cache)   │
└──────────────┘

Distributed Cache:

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│   Dev 1      │     │   Dev 2      │     │  CI Server   │
└──────┬───────┘     └──────┬───────┘     └──────┬───────┘
       │                    │                    │
       └────────────┬───────┴────────────────────┘
                    │
            ┌───────▼────────┐
            │  Remote Cache  │
            │  (S3, Redis)   │
            └────────────────┘

5. Artifact Versioning

Versioning Strategies:

Semantic:       1.2.3
Build number:   1.2.3-build.456
Git commit:     1.2.3-a1b2c3d
Timestamp:      1.2.3-20240101123045
Snapshot:       1.2.3-SNAPSHOT

Common Patterns

Pattern 1: Multi-Stage Build

# Multi-stage Docker build
FROM node:18 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build

FROM node:18-alpine AS runtime
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/index.js"]

Pattern 2: Dependency Locking

// package.json
{
  "dependencies": {
    "express": "^4.18.0"
  }
}

// package-lock.json (exact versions)
{
  "dependencies": {
    "express": {
      "version": "4.18.2",
      "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
      "integrity": "sha512-..."
    }
  }
}

Pattern 3: Build Matrix

# GitHub Actions build matrix
jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [16, 18, 20]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test

Pattern 4: Incremental Builds

// Gradle incremental compilation
tasks.withType(JavaCompile) {
    options.incremental = true
}

// Only rebuild changed modules
gradle build --parallel --build-cache --configure-on-demand

Resource Files

For detailed guidance on specific topics, see:

Build Systems

  • build-systems.md - Make, Gradle, Maven, Bazel, npm/yarn comparison, tool selection guide
  • compilation-optimization.md - Compiler flags, incremental compilation, distributed builds, ccache
  • monorepo-builds.md - Monorepo strategies, affected detection, Nx, Turborepo, Bazel

Dependency Management

  • dependency-management.md - Version pinning, lock files, conflict resolution, vulnerability scanning
  • artifact-repositories.md - Artifactory, Nexus, container registries, retention policies, promotion

Build Pipeline

  • build-pipelines.md - CI build stages, parallel builds, matrix builds, pipeline optimization
  • reproducible-builds.md - Deterministic builds, hermetic builds, SLSA framework

Optimization

  • build-caching.md - Layer caching, distributed caching, cache invalidation strategies
  • performance-optimization.md - Build profiling, parallelization, metrics, bottleneck analysis

Security

  • build-security.md - Supply chain security, signed artifacts, SBOM generation, dependency attestation

Best Practices

Build Performance

  1. Enable caching:
    • Use local and remote build caches
    • Cache dependencies separately from code
    • Implement layer caching in Docker builds
    • Use incremental compilation
  2. Parallelize builds:
    • Build independent modules concurrently
    • Use build tool parallelization features
    • Distribute builds across multiple machines
    • Leverage build matrix for testing
  3. Optimize dependencies:
    • Remove unused dependencies
    • Use exact versions in lock files
    • Implement dependency caching
    • Consider vendoring for critical dependencies

Build Reliability

  1. Reproducible builds:
    • Pin all dependency versions
    • Use deterministic build tools
    • Avoid timestamps in artifacts
    • Document build environment requirements
  2. Dependency management:
    • Use lock files (package-lock.json, Gemfile.lock, go.sum)
    • Scan for vulnerabilities regularly
    • Update dependencies systematically
    • Test dependency updates before merging
  3. Artifact management:
    • Version all artifacts
    • Store in artifact repository
    • Implement retention policies
    • Sign critical artifacts

Build Security

  1. Supply chain security:
    • Generate SBOM (Software Bill of Materials)
    • Sign build artifacts
    • Verify dependency signatures
    • Scan for vulnerabilities
  2. Build isolation:
    • Use hermetic builds when possible
    • Sandbox build processes
    • Limit network access during builds
    • Verify build inputs
  3. Secret management:
    • Never commit secrets to version control
    • Use secret management tools
    • Rotate build secrets regularly
    • Audit secret access

Anti-Patterns to Avoid

❌ Non-reproducible builds - Different results from same source ❌ No dependency locking - Floating versions break builds ❌ Rebuilding everything - Wastes time and resources ❌ No build caching - Repeated work on every build ❌ Ignored dependencies - Outdated, vulnerable packages ❌ No artifact versioning - Can't track what was deployed ❌ Serial builds - Not leveraging parallelization ❌ No build metrics - Can't identify bottlenecks ❌ Mixing build and runtime - Bloated containers ❌ No vulnerability scanning - Security risks in dependencies

Common Tasks

Task: Optimize Slow Build

  1. Profile build to identify bottlenecks
  2. Enable build caching (local and remote)
  3. Implement incremental compilation
  4. Parallelize independent build tasks
  5. Cache dependencies separately
  6. Use build tool's parallel features
  7. Consider distributed builds for large projects
  8. Monitor build metrics over time

Task: Set Up Artifact Repository

  1. Choose repository (Artifactory, Nexus, registry)
  2. Deploy and configure repository
  3. Set up authentication and access control
  4. Define retention policies
  5. Configure build tools to publish artifacts
  6. Implement versioning strategy
  7. Set up vulnerability scanning
  8. Document artifact promotion workflow

Task: Implement Reproducible Builds

  1. Pin all dependency versions
  2. Use lock files for dependencies
  3. Specify build tool versions
  4. Document build environment
  5. Remove non-deterministic elements (timestamps)
  6. Use hermetic build tools if possible
  7. Verify builds are reproducible
  8. Automate verification in CI

Integration Points

This skill integrates with:

  • release-engineering: Deployment pipelines, versioning, artifact promotion
  • devsecops: Vulnerability scanning, SBOM, supply chain security
  • platform-engineering: Build infrastructure, container builds, Kubernetes
  • cloud-engineering: Cloud build services, artifact storage
  • systems-engineering: Compiler optimization, system dependencies

Triggers and Activation

This skill activates when you:

  • Work with build files (Makefile, build.gradle, pom.xml, package.json)
  • Optimize build performance or reduce build times
  • Implement CI/CD pipelines
  • Manage dependencies or artifact repositories
  • Configure build caching or distributed builds
  • Set up monorepo build tooling
  • Implement reproducible builds
  • Address supply chain security

Next Steps

For your specific build engineering task:

  1. Identify build system and language ecosystem
  2. Review relevant patterns and optimization strategies
  3. Implement caching and parallelization
  4. Set up artifact management
  5. Monitor and optimize build performance
  6. Implement security scanning and SBOM generation

Total Resources: 10 detailed guides covering all aspects of build engineering Pattern Library: 100+ production-tested patterns for build optimization and reliability Maintained by: Build Engineering team based on real-world production experience

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.