crate-structure

Documents the Xberg Cargo workspace layout, crate roles, and member onboarding steps.

9.2k|581|Updated Jan 31, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill crate-structure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crate-structure
Source: https://github.com/kreuzberg-dev/kreuzberg/tree/main/.ai-rulez/skills/crate-structure
Command: npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill crate-structure

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Navigating a large Rust monorepo with 19 workspace members, 3 excluded crates, and 11 distribution packages is error-prone; this Skill explains where code belongs and prevents the common mistakes that break Docker builds and fresh clones when adding a new crate.

Core Features & Use Cases

  • Workspace Map: Details every crate under crates/ (core library, CLI, FFI, JNI, Node, Python, PHP, WASM, PDF engines, OCR backends) plus the two members living under packages/.
  • Distribution Package Guide: Explains how each language binding (PyPI, RubyGems, npm, Maven, NuGet, Hex, pub.dev, SwiftPM) connects to the Rust core via FFI, JNI, NAPI-RS, or PyO3.
  • New Member Checklist: Covers the .dockerignore and .gitignore allowlists, Dockerfile COPY lines, and task verify:docker-crates validation required when adding or removing a workspace member.
  • Use Case: When adding a new crate to the workspace, follow the checklist to update both ignore files and every Dockerfile, then run the verification task to catch omissions in both directions.

Quick Start

Ask the assistant to explain where a new crate belongs in the Xberg workspace and which ignore files and Dockerfiles must be updated to register it.

Frequently Asked Questions about crate-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new crate to a Rust workspace monorepo?

Add the crate to [workspace] members in the root Cargo.toml, then update .dockerignore with an allowlist entry, un-ignore its vendor directory in .gitignore, and add a COPY line to every Dockerfile. Run task verify:docker-crates to validate the Docker-side changes.

Why does my Docker build fail with 'failed to compute cache key' after adding a crate?

The .dockerignore uses an ignore-everything-then-allowlist pattern, so a new crate is invisible to Docker until you add a !crates/<name>/ entry. Without it, every image build fails because the COPY source path is not found.

How do Rust FFI bindings connect to Go, C#, Java, and Swift packages?

A central C FFI crate exposes opaque handles consumed by Go via cgo, C# via P/Invoke, Zig via the C ABI, and Swift via swift-bridge. Java uses Panama FFM rather than JNI, while Kotlin Android goes through a separate JNI crate.

Why is my crate's vendor directory not committed to git?

The .gitignore has a bare vendor/ rule with per-crate un-ignore entries, so a new crate's vendored sources are silently skipped by git add. Add a !crates/<name>/src/vendor/ exception or fresh clones will fail to build.

What is the difference between workspace members and excluded crates?

Excluded crates such as e2e/rust and the Elixir and Ruby native extensions are not workspace members, so cargo check --workspace never sees them. Only listed members participate in workspace-wide builds and the default-members set.