원클릭으로
test-structural-invariants
For data structure validation: test lengths, relationships, constraints that must hold, verify setup is correct.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
For data structure validation: test lengths, relationships, constraints that must hold, verify setup is correct.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | test-structural-invariants |
| description | For data structure validation: test lengths, relationships, constraints that must hold, verify setup is correct. |
Assert properties that must be true about your data structures.
# After building structure, verify invariants
def test_structure():
# Size invariants
assert len(items) == EXPECTED_SIZE
# Relationship invariants
assert all(condition(item) for item in items)
# Coverage invariants
assert set(keys) == expected_keys
# Bidirectional relationship
for a, bs in graph.items():
for b in bs:
assert a in graph[b] # Symmetric
# sudoku.py - Sudoku structure invariants
def test():
"""A set of tests that must pass."""
# Size invariants
assert len(squares) == 81 # 9x9 grid
assert len(unitlist) == 27 # 9 rows + 9 cols + 9 boxes
# Relationship invariants
assert all(len(units[s]) == 3 for s in squares) # Each square in 3 units
assert all(len(peers[s]) == 20 for s in squares) # Each square has 20 peers
# Specific structure verification
assert units['C2'] == [
['A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'I2'], # Column
['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'], # Row
['A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2', 'C3'] # Box
]
assert peers['C2'] == set([...20 peers...])
print('All tests pass.')
# beal.py - mathematical structure tests
def tests():
assert make_Apowers(6, 10) == {
1: [1],
2: [8, 16, 32, 128],
3: [27, 81, 243, 2187],
...
}
assert make_Czroots(make_Apowers(5, 8)) == {1: 1, 8: 2, 16: 2, ...}
assert 3 ** 3 + 6 ** 3 in Czroots
assert 99 ** 97 in Czroots
assert 101 ** 100 not in Czroots
# spell.py - corpus statistics invariants
def unit_tests():
assert len(WORDS) == 32198
assert sum(WORDS.values()) == 1115585
assert WORDS.most_common(10) == [
('the', 79809), ('of', 40024), ('and', 38312), ...
]
all() for universal checks: Clean assertion syntaxConducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.