| name | mechanical-drafting-gbt |
| description | Create, revise, audit, validate, and present mechanical CAD using Chinese GB/T drafting conventions. Use for AutoCAD/AutoCAD MCP; parametric 2D/3D parts, complex assemblies, mechanisms, engines, gears, machined parts, consumer products, enclosures, and powered appliances; DXF/DWG/PDF/STEP and model-based definition workflows; assembly/detail drawings and cross-view verification; product concept gates, purchased-component envelopes, mains/moving-part safety architecture, ergonomics, cable management, stability, dimensions, fits, GD&T/GPS, inspection planning, BOMs, revisions, CAD DRC/DFM, engineering-analysis evidence, and release compliance. |
GB/T Mechanical Drafting
Chinese maintenance mirror: SKILL.zh-CN.md.
Create readable manufacturing drawings, not decorative CAD illustrations. Treat geometry, line hierarchy, view layout, dimensions, and notes as one system.
Portability Contract
- Keep the core workflow agent- and vendor-neutral. Apply it in Codex, Claude Code, or another compatible skill runner without changing the engineering acceptance criteria.
- Treat
SKILL.md and references/ as the authoritative instructions. Ignore optional runtime-specific metadata, such as agents/openai.yaml, when the current runner does not use it.
- Discover the available CAD application, MCP/automation bridge, shell, parsers, and renderers before execution. Map capability-level steps to exposed safe tools instead of assuming a particular tool namespace or exact operation name.
- Treat operation names and JSON payloads in the references as interface examples unless the active bridge explicitly exposes them. Never invent a tool call or claim a check ran when only an example schema exists.
- Keep deliverables and validation evidence in standard CAD/exchange/report artifacts so another agent or application can reopen and independently verify them.
Tool Inventory Preflight
Before installing, downloading, upgrading, patching, removing, or relocating any tool, dependency, browser runtime, plug-in, CAD backend, renderer, or validator:
- Read
D:\Codex\TOOLS-INVENTORY.md.
- Check its recorded path, version, and verification command. Reuse the existing environment when verification passes; a different task or window is not a reason to reinstall it.
- Install or repair only when the entry is absent, its path is missing, or verification fails.
- After any change, update the inventory with the date, exact path, version, purpose, verification result, and known limitations.
- Never store credentials, tokens, license keys, or other secrets in the inventory.
Required Workflow
- Classify the task and load only the required references: always read
references/gbt-drafting.md for engineering drawings; read references/autocad-mcp-workflow.md for AutoCAD/MCP execution, references/complex-assembly-drafting.md for engines or other multi-system assembly drawings, references/consumer-product-concept.md for new/substantially redesigned consumer products, enclosures, appliances, ports/cables/controls, moving parts, or mains-powered products, references/cad-workflows.md for 2D/3D conversion or presentation, references/cad-3d-modeling.md for 3D parts/assemblies, references/gps-inspection.md for GD&T/GPS, tolerance-stack, or inspection work, references/product-definition-release.md for configurations, BOMs, revisions, MBD/PMI, dependencies, or release packages, references/engineering-analysis.md for any physical-performance calculation or simulation claim, and references/drc-review.md for every DRC, DFM, fit, interference, or release review.
- For a new or substantially redesigned consumer product, pass the applicable concept, purchased-component, mains/moving-part safety, early-preview, and product-design gates before detailed dimensions or production CAD. If selection or safety architecture is unresolved, stop at an explicitly provisional concept package.
- Inspect the source CAD, drawing, screenshot, and user requirements. Record concrete defects and separate supplied values from derived or assumed values.
- Preserve unrelated user geometry. Create a clean replacement in a separate area when extensive repair is needed; remove old geometry only when the user authorizes it.
- Confirm the sheet size, scale, units, projection method, CAD plot style, and required deliverable before laying out views. For a GB/T mechanical drawing, default to first-angle projection only when the user, approved project template, and source drawing do not specify another method; record the assumption and keep view placement, projection symbol, and title-block data consistent.
- Establish semantic layers and properties before geometry. Select line widths from the applicable standard series and the sheet/scale; keep a clear thick-to-thin ratio. A practical fallback is:
OUTLINE: thick continuous.
THIN: thin continuous.
CENTER: thin chain.
HIDDEN: thin dashed.
HATCH: thin continuous.
DIM: thin continuous.
TEXT: thin continuous.
P0 Mutation Gates (must pass before every drawing or model edit)
- Document identity gate: Before
create, open, activate, save, export, or any mutation, capture and compare doc_id, requested absolute path, active document ID/path, configuration, units, and revision. Every mutation carries doc_id and expected_revision; a mismatch is E_DOCUMENT_ID_MISMATCH, not a warning. Never silently switch the user's active document.
- Transaction gate: Group each logical subsystem in
transaction.begin/commit. A failed entity, COM exception, timeout, stale revision, missing layer, or postcondition mismatch rolls back the complete transaction. Verify the entity count and revision returned to their pre-batch values; a partial rollback is FAIL.
- Postcondition gate: After every mutable call, perform a native readback and compare requested versus actual type, coordinates, dimensions, layer, semantic role, associations, closure, bounds, and volume/area. Any unexplained
diff is a hard stop; delete the suspect entity, attempt one bounded recovery, then switch backend or report BLOCKED.
- Layer and authority gate: Resolve all required layers, linetypes, dimension styles, fonts, and source authorities before creating geometry. A missing layer or unverified purchased-part interface must fail before entity creation; never fall back to layer
0 or guessed production dimensions.
- User-session gate: Attach to an existing AutoCAD process in read/preserve window mode by default. Do not activate, minimize, restore, or alter profile variables unless the caller explicitly requests that operation and the ownership check permits it.
Evidence Synchronization Gates
- Registry/B-rep atomic sync (P0): Treat the semantic feature registry, native AutoCAD entity registry, and B-rep/model state as one transaction. A feature is committed only when all three contain the same stable feature ID, component ownership, parameters, bounds, and revision. If one store updates and another does not, roll back every side effect (entities, layers, registry rows, generated previews, and journal pointers) and return
E_REGISTRY_BREP_OUT_OF_SYNC.
- Rollback side effects (P0): Rollback evidence must include entity/feature counts, registry row counts, layer changes, output files, and document revision before/after. Delete temporary files with an atomic cleanup record; never report rollback success merely because a command raised an exception.
- AABB containment semantics (P1): Use axis-aligned bounding boxes only as broad-phase evidence. Every containment result must identify
container_component_id, contained_component_id, design_role, coordinate frame, tolerance, and whether it is exact_brep or aabb_screening. AABB overlap or containment cannot certify contact, wall thickness, or interference clearance.
- Render truth (P1): A preview is valid only when it records
visual_style, material_render_verified, camera/projection, visible components, nonblank ratio, clipping, and content hash. material_render_verified=false is not a shaded/material review pass; a line-only PNG must be labeled wireframe evidence.
- Scale truth (P1):
FIT/NTS and a fixed numeric scale (1:1, 1:2, etc.) are mutually exclusive. If FIT is used, the title block must say FIT or NTS; if a fixed ratio is declared, calculate and verify the actual paper/media-box scale. Any mixed declaration is PLOT_SCALE_CONSISTENCY=FAIL.
- Transport pressure (P0): Route AutoCAD MCP calls through one FIFO lane with a bounded queue and sliding-window budget. Never launch parallel mutation or screenshot calls; on a retryable admission error, stop the round and preserve its evidence.
- Response truth (P1): Screenshot feedback returns a managed path, dimensions, byte count, and SHA-256 by default. Inline base64 requires explicit opt-in and a size ceiling; large audit/entity responses must be narrowed or read from saved artifacts.
- Prepared review geometry (P1): Section and exploded views require prepared, revision-bound geometry states before rendering: section plane and cut set, or component transforms and exploded offsets. A screenshot created by ad-hoc camera movement without a prepared state is not section/exploded evidence.
CAD Execution Rules
Execution Stability Gate
-
Keep every external test, renderer, CAD bridge, and subprocess call bounded. Use a hard per-operation timeout plus a hard campaign timeout; never await an unbounded process or nested execution cell.
-
A timeout is a recorded TIMEOUT/BLOCKED result, not permission to retry indefinitely. Preserve the JSON evidence and terminate only processes owned by the test wrapper.
-
Do not restart the Codex/Claude host application to recover a CAD or test failure. Do not start, close, or alter a user-owned AutoCAD session implicitly; use read-only preflight first and require explicit user opt-in for live startup.
-
Keep GUI viewers suppressed during automation. Write PNG/PDF artifacts to the managed output root and return their paths; do not open an external viewer or steal foreground focus.
-
Use native CAD line, arc, circle, polyline, hatch, text, and dimension entities.
-
Prefer associative dimension objects. Do not fake dimensions using loose text and arrows.
-
Keep geometry and annotation in their intended spaces. Verify viewport scale, annotation scale, and plot lineweights when paper space is used.
-
Keep centerlines beyond outlines by a small, even amount. Use proper center linetype; never use a continuous colored axis through the part.
-
For Chinese GB/T text, use a verified technical lettering style with complete Chinese/symbol coverage and faithful plotted output. Font filenames such as gbenor/gbcbig or TrueType substitutes are environment choices, not compliance evidence by themselves.
-
Put diameter symbols and fit designations in the dimension object or associated requirement, not as unrelated notes inside the part.
-
Keep dimension text horizontal where the active dimensioning method requires it and use a consistent text height.
-
Keep cutting-plane identifiers and section labels paired when the convention requires them. Call a simple end view an end view, not SECTION A-A.
-
Use a standard title block proportioned for the selected sheet. Avoid oversized decorative text.
-
Do not infer manufacturing-critical values from appearance alone. Never invent a fit, tolerance, surface texture, material, heat treatment, or process requirement.
-
Treat view agreement as a geometric proof obligation. A clean-looking view is not valid when its features cannot describe the same part as the other views and sections.
-
Progressive References
references/gbt-drafting.md: standards baseline, drawing rules, physical and mathematical checks, staged verification, and release audit.
references/autocad-mcp-workflow.md: AutoCAD readiness, dispatcher recovery, structured errors, safe setup, transactions, annotation handles, geometry audit, plotting, DXF comparison, and mechanical primitives.
references/complex-assembly-drafting.md: complex assembly classification, parameterized skeletons, component/connectivity planning, staged construction, topology checks, view consistency, line cleanup, and release gates.
references/consumer-product-concept.md: consumer-product brief, three-concept comparison, purchased-part evidence, mains/moving-part safety gates, early skeleton preview, product-design review, and failure review.
references/cad-workflows.md: evidence hierarchy, native 2D editing, 3D-backed drawing, 2D-to-3D consistency reconstruction, PDF/image intake, 3D review packets, tool routing, and risk-scaled validation.
references/cad-3d-modeling.md: parametric solid/surface modeling, assemblies, motion, representation choice, exchange formats, iteration, and 3D presentation.
references/gps-inspection.md: GD&T/GPS semantics, datum systems, tolerance stacks, model/drawing agreement, inspection planning, and measurement uncertainty.
references/product-definition-release.md: configuration/revision authority, stable identity, BOM/balloons, dependencies, semantic change review, interoperability, and reproducible release packages.
references/engineering-analysis.md: dimensional and conservation checks, load cases, hand calculations, structural/thermal/fluid analysis evidence, convergence, and claim boundaries.
references/drc-review.md: deterministic validator contract, universal geometry and drawing gates, assembly checks, process-specific DFM, severity, evidence, and release reporting.
Five-Round Hard-Gate Mapping
When running the campaign in docs/CAD-5-ROUND-CAMPAIGN-20260719.md, apply these additional release blockers:
- R1 mechanical part: fail on any radius/chamfer readback outside the stated tolerance, hole-axis error above
0.05 mm, invalid B-rep, or supplier-controlled port dimensions presented as manufacturing dimensions.
- R2 transmission assembly: fail on center-distance or coaxiality error above
0.05 mm, duplicated source geometry for configurations, unclassified gear/shaft interference, or concept tooth geometry described as a production gear.
- R3 enclosure/bracket: fail when minimum wall thickness is below the specified limit, a rib does not structurally intersect its parent, flange/hole pattern is not concentric, or an A3/PDF media-box scale disagrees with the title block. Unrun draft-angle analysis must remain
NOT_EVALUATED and block release-candidate status.
- R4 consumer enclosure: fail when parting gap is outside
0.25~0.35 mm, inner wall is below 2.0 mm, controls are not coaxial/accessible, USB or other purchased openings lack controlled authority, or any required shaded review view is clipped/blank. appearance_review and ergonomics_review are independent verdicts and cannot inherit geometry PASS.
- R5 motion assembly: fail when component instances are copied instead of transformed, joint limits accept an out-of-range command, sampled clearance falls below
2 mm, exploded transforms are not reversible, or motion overlays lack explicit semantics. A broad-phase sweep must never be reported as exact interference proof.
Revision Strategy
For an isolated defect with stable source geometry and identifiers, edit the responsible feature/entity in place, preserve a rollback point, and run targeted dependent checks. Create a clean replacement in a separate area only when defects are widespread, topology/view authority is unreliable, or repair would cross several subsystems/views. Compare geometry, annotations, and plotted output before replacing the obsolete version, and erase it only with explicit permission. After a gate escape, failed prototype, repeated tool failure, or misleading deliverable, use the evidence/root-cause/containment/permanent-fix/prevention structure in consumer-product-concept.md. In the final response, summarize corrected defects, assumptions, unresolved TBD items, files produced, deferred release checks, and any compliance limitation.