# Aec Building

> AEC building modeling skill — parametric architectural geometry for Agent harness. USE when the task involves creating building geometry (floors, columns, walls, curtain walls, stairs), running code compliance checks (GB 50016, JGJ/T 67), exporting to STEP/IFC/GLB, or orchestrating multi-step building design workflows via MCP tools. Supports modern office, traditional heritage, and custom-shape b…

- **Type:** Skill
- **Install:** `agentstack add skill-sanpingli-skills-aec-building`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [sanpingli](https://agentstack.voostack.com/s/sanpingli)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [sanpingli](https://github.com/sanpingli)
- **Source:** https://github.com/sanpingli/skills/tree/main/packs/aec-generation/aec-building

## Install

```sh
agentstack add skill-sanpingli-skills-aec-building
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# aec-building SKILL

## What this skill does

Generates parametric BREP building geometry through a 5-layer stack:

```
orchestrator (planner → executor → reporter)
    ↓ calls
mcp/server (19 粗粒度 MCP tools + JSON-RPC transport)
    ↓ calls
aec/ (Building + elements + grid + staircase)
    ↓ calls
core/ (shapes + booleans + references)
    ↓ exports via
export/ (STEP + IFC)
```

## Architecture invariants

1. **Reference-driven** — all geometry positioned via GridRef/LevelRef, never absolute coordinates
2. **Coarse-grained tools** — one MCP tool call = one complete operation (e.g. "place all columns")
3. **Compliance = deterministic code** — GB 50016 / JGJ/T 67 rules are pure functions, not LLM memory
4. **Failure = signal** — error messages always include actionable suggestions + fix_action
5. **Building.summary()** returns  Open > IFC` 可得到可编辑模型

### 渲染流水线

```
Building (Appearance) → building_to_colored_glb() → model.glb
                                                        ↓
                        viewer_3d.py → Three.js PBR (阴影 + 色调映射 + 顶点色)
```

---

## Recovery Patterns (路径 A/B 通用)

### 楼梯空间不足
- **触发**: `create_staircase` → `STAIR_GEOMETRY_INVALID`
- **修复**: 读 `suggestions` → `modify_element` 扩大核心筒墙 → 重试 `create_staircase`
- **联动**: `modify_element` 修改墙端点时，相交墙自动延长（`cascaded_updates` 列表）

### 疏散楼梯数量不足
- **触发**: `check_compliance` → `§5.5.17` violation with `fix_action`
- **修复**: 读 `fix_action.tool` → 调用 `create_staircase` 在建筑另一端

### 防火间距不足
- **触发**: `check_compliance` → `§6.2.2` violation
- **修复**: `modify_element` 调整 L 形折角处窗位

### 参数化联动机制
`modify_element` 修改墙的 `start` 或 `end` 时，会自动查找端点相交的其他墙并同步更新。
返回的 `cascaded_updates` 列出所有被联动修改的墙及其新坐标。Agent 无需手动逐个修改相交墙。

---

## Tool Call Granularity Rules

### 批量操作（一次 tool call）
- `place_columns`: 全部柱子一次放完，用 skip_x/skip_y 排除 (路径 A)
- `place_columns_at`: 全部柱子坐标一次传入 (路径 B)
- `create_floors`: 多层楼板一次创建
- `auto_place_doors`: 全部门一次放完
- `place_beams`: 每层所有梁一次放完（逐层调用, 路径 A）
- `place_beams_at`: 一类梁一次传入 (路径 B, 如"所有环向梁"一批)
- `place_windows`: 同类窗户一次传入

### 逐个操作
- `create_staircase`: 每部楼梯单独调用（不同位置 + 独立验证）
- `create_curtain_wall`: 每个立面单独调用

### 绝不逐个
- 不要一根柱子一个 tool call
- 不要一面墙一个 tool call（除非类型不同需分批）

---

## Context Management

- 每次 tool call 后只记住：element_id（后续引用）、warnings（可能需处理）、error（需恢复）
- 调用 `get_summary` 获取 <2KB 状态快照
- 每 5-8 步调用一次 `visual_check`
- 用 `take_snapshot` 在关键节点保存状态，出错用 `rollback` 回退

---

## Adding new element types

1. Add dataclass to `aec/elements.py`
2. Add `*_to_brep()` factory in `aec/element_factory.py`
3. Add `Building.add_*()` method in `aec/building.py`
4. Add MCP tool in `mcp/server.py` + `mcp/transport.py` TOOL_DEFINITIONS + executor method map
5. Add tests

## Adding new compliance rules

1. Add check function in `compliance/rules/gb50016.py` or `jgj_t67.py`
2. Wire into `check_gb50016()` dispatcher with scope key
3. Every violation should include `fix_action` with tool + params when an automated fix is possible
4. Add test in `tests/test_compliance.py`

## Build & test

```bash
pip install -e ".[dev]"
pytest tests/ -v                    # all tests
pytest tests/ -k "not BREP"         # skip CadQuery-dependent tests
python examples/l_office_building.py           # 路径 A: 现代办公 MCP workflow
python examples/small_office_with_atrium.py    # 路径 A: full workflow with atrium
python examples/yingxian_pagoda.py             # 路径 B: 传统建筑 (八角木塔)
python examples/imperial_palace.py             # 路径 B: 传统建筑 (宫殿群)
```

## Reference documents

- [PRD & Architecture](docs/PRD_Architecture.md)
- [Agent Harness Case Study (20 tool calls)](docs/Agent_Harness_BREP_Generation_Case_Study.md)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [sanpingli](https://github.com/sanpingli)
- **Source:** [sanpingli/skills](https://github.com/sanpingli/skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-sanpingli-skills-aec-building
- Seller: https://agentstack.voostack.com/s/sanpingli
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
