bevy-queries

Explain writing and optimizing Bevy ECS queries with Query<D, F>, Single, and filters.

125|10|Updated Nov 22, 2022
One-click install
npx skills add https://github.com/nolantait/bevy-starter --skill bevy-queries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bevy-queries
Source: https://github.com/nolantait/bevy-starter/tree/main/.agents/skills/bevy-queries
Command: npx skills add https://github.com/nolantait/bevy-starter --skill bevy-queries

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing correct and efficient Bevy ECS queries can be error-prone; this skill provides a practical guide to constructing Query<D, F>, Single, and lens-based patterns with safe access and testing.

Core Features & Use Cases

  • Comprehensive coverage of Query<D, F> parameters, With/Without filters, and lens-based query reuse.
  • Practical patterns for iterating, destructuring, and testing queries across systems.
  • Use cases ranging from simple component reads to complex multi-filter queries and disjoint access patterns.

Quick Start

Create a Bevy system that uses Query<&Transform> to read the translation and print its x value.

Frequently Asked Questions about bevy-queries

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

FAQPage Schema
How do I write and optimize Bevy ECS queries using Query<D, F>?

Bevy ECS queries are written using Query<D, F> to specify data and filter parameters. This skill covers practical patterns for iterating components, destructuring results, and applying filters to ensure correct and efficient system design in Bevy.

What are query lenses in Bevy and how do they enable reusable query patterns?

Query lenses in Bevy enable reusable query patterns by deriving focused, disjointed queries from a base Query. This skill explains lens-based query reuse, disjoint access patterns, and safe component retrieval methods for Bevy 0.19.

When should I use Single queries versus standard Query iteration in Bevy?

Use Single queries when accessing one specific entity, whereas standard Query iteration processes multiple entities. This skill covers both retrieval methods, explaining when each approach suits your system design and testing needs.

How do I test Bevy ECS queries to ensure correct component access?

Testing Bevy ECS queries involves using testing helpers to validate component access and filter behavior. This skill provides practical patterns for testing queries across systems, ensuring correct iteration, destructuring, and disjoint access patterns.

Can I use With and Without filters together in a Bevy ECS query?

With and Without filters can be combined in Bevy ECS queries to target entities possessing specific components while excluding others. This skill covers common filters, multi-filter queries, and safe access patterns for complex system design.