spaces-data
Design Gymnasium action and observation spaces, validate samples, flatten/unflatten data, serialize JSONable batches, and debug dtype/shape mismatches.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- spaces-data
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Design Gymnasium action and observation spaces, validate samples, flatten/unflatten data, serialize JSONable batches, and debug dtype/shape mismatches.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/flattening-and-json.md7.8 KB
- 参考文档references/space-design.md8.9 KB
- 参考文档references/troubleshooting.md7.7 KB
03 SKILL.md 正文
Gymnasium Spaces and Data Contracts
Use this sub-skill when a task involves choosing Gymnasium action or observation spaces, validating samples with contains, seeding or sampling spaces, flattening nested data for model inputs, unflattening model vectors back to structured observations/actions, or serializing space samples.
Start Here
- For constructor choices and data contracts, use
references/space-design.mdbefore modifying an environment'saction_spaceorobservation_space. - For
flatdim,flatten_space,flatten,unflatten,to_jsonable, andfrom_jsonable, usereferences/flattening-and-json.md. - For
Box.containssurprises, integer starts, nested flatten shape mismatches, dynamic spaces, and wrapper space updates, usereferences/troubleshooting.md. - To smoke-test the local Gymnasium install and demonstrate the core contract, run
python sub-skills/spaces-data/scripts/space_contract_smoke.py --helpand thenpython sub-skills/spaces-data/scripts/space_contract_smoke.pyfrom the root Gymnasium skill directory.
Scope Boundaries
- Use
../environment-api/SKILL.mdfor customEnvlifecycle,reset/step, registration,check_env, and seeding an environment throughreset(seed=...). - Use
../wrappers-recording/SKILL.mdwhen a wrapper changesobservation_space,action_space, observations, actions, rewards, rendering, or recording behavior. - Use
../vectorization/SKILL.mdfor batched/vector spaces,gym.vectorutilities,single_observation_space,single_action_space, and vector wrapper space transforms.
Minimum Correct Patterns
import numpy as np
from gymnasium import spaces
observation_space = spaces.Dict({
"position": spaces.Box(low=-1.0, high=1.0, shape=(2,), dtype=np.float32),
"inventory": spaces.Tuple((spaces.Discrete(5), spaces.MultiBinary(3))),
})
observation = observation_space.sample()
assert observation_space.contains(observation)
from gymnasium.spaces import utils as space_utils
flat = space_utils.flatten(observation_space, observation)
restored = space_utils.unflatten(observation_space, flat)
assert observation_space.contains(restored)
Keep runtime guidance self-contained. Do not depend on Gymnasium source, tests, examples, or documentation paths at runtime.
04 同仓库更多 Skills
ci-cd-and-automation
Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.
chrome-devtools
Uses Chrome DevTools via MCP for efficient debugging, troubleshooting and browser automation. Use when debugging web pages, automating browser interactions, analyzing performance, or inspecting network requests. This skill does not apply to `--slim` mode (MCP configuration).
chrome-cdp
Drive a real Chrome via the Chrome DevTools Protocol (CDP). Ensures a debuggable Chrome is running (launching it if needed) so the agent can navigate, read page content, inspect the DOM, run JavaScript, and take screenshots — without the user typing any launch command. Includes a first-class "review a live running app" flow: point Chrome at the app under development and inspect/screenshot the REAL page (what a static-artifact tool cannot do). Backed by Glimpse and the chrome-devtools MCP server. Use when asked to "use chrome", "open chrome", "drive my browser", "read the page in chrome", "review the running app", "screenshot the app", or "/chrome-cdp".
check-identity-pack
Run an AFP 100-point or AUSTRAC safe-harbour identity check over a set of documents, and report exactly what's missing. Use when the user asks to check identity documents, verify someone's ID for onboarding, or assess whether a document pack satisfies Australian identity requirements.
changelog
Auto-generates a changelog from git commits, sprint data, and design documents. Produces both internal and player-facing versions.
cellxgene-census
Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.