Spaces data

From lza6/Armor-piercing-system-prompts · View interactive version

Spaces data is an AI agent skill from the GitHub repository lza6/Armor-piercing-system-prompts. Design Gymnasium action and observation spaces, validate samples, flatten/unflatten data, serialize JSONable batches, and debug dtype/shape mismatches.

How to use this skill

Skill file

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

Scope Boundaries

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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.