Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Read and parse XML from construction systems - P6 schedules, BSDD exports, IFC-XML, COBie-XML. Convert to pandas DataFrames.
.claude/skills/datadrivenconstruction-xml-reader/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 86% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 118% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 47% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 24% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 36% | 0% |
XML is used in construction for P6 schedules (XER), IFC-XML, COBie-XML, and buildingSMART Data Dictionary exports. This skill parses XML and converts to structured DataFrames.
pythonimport xml.etree.ElementTree as ET import pandas as pd from typing import Dict, Any, List, Optional, Union from dataclasses import dataclass from pathlib import Path import re @dataclass class XMLElement: """Parsed XML element.""" tag: str attributes: Dict[str, str] text: Optional[str] children: List['XMLElement'] class ConstructionXMLReader: """Parse XML from construction systems.""" def __init__(self): self.namespaces: Dict[str, str] = {} def parse_file(self, file_path: str) -> ET.Element: """Parse XML file and return root element.""" tree = ET.parse(file_path) root = tree.getroot() # Extract namespaces self._extract_namespaces(root) return root def parse_string(self, xml_string: str) -> ET.Element: """Parse XML from string.""" root = ET.fromstring(xml_string) self._extract_namespaces(root) return root def _extract_namespaces(self, root: ET.Element): """Extract namespace mappings.""" # Find namespace declarations for attr, value in root.attrib.items(): if attr.startswith('{'): ns = attr[1:attr.index('}')] self.namespaces[root.tag.split('}')[0][1:]] = ns def find_elements(self, root: ET.Element, tag: str, namespace: str = None) -> List[ET.Element]: """Find all elements with given tag.""" if namespace: tag = f"{{{namespace}}}{tag}" return root.findall(f".//{tag}") def element_to_dict(self, element: ET.Element, include_children: bool = True) -> Dict[str, Any]: """Convert element to dictionary.""" result = { '_tag': element.tag.split('}')[-1] if '}' in element.tag else element.tag, '_text': element.text.strip() if element.text else None, **element.attrib } if include_children: for child in element: child_tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if child_tag in result: # Multiple children with same tag - make list if not isinstance(result[child_tag], list): result[child_tag] = [result[child_tag]] result[child_tag].append(self.element_to_dict(child)) else: result[child_tag] = self.element_to_dict(child) return result def elements_to_dataframe(self, elements: List[ET.Element]) -> pd.DataFrame: """Convert list of elements to DataFrame.""" records = [] for elem in elements: record = {'_tag': elem.tag.split('}')[-1]} record.update(elem.attrib) # Get direct text content if elem.text and elem.text.strip(): record['_text'] = elem.text.strip() # Get child values for child in elem: child_tag = child.tag.split('}')[-1] if child.text and child.text.strip(): record[child_tag] = child.text.strip() # Also get child attributes for attr, val in child.attrib.items(): record[f"{child_tag}_{attr}"] = val records.append(record) return pd.DataFrame(records) def flatten_xml(self, root: ET.Element, target_tag: str = None) -> pd.DataFrame: """Flatten XML to DataFrame.""" if target_tag: elements = self.find_elements(root, target_tag) else: elements = list(root) return self.elements_to_dataframe(elements) class P6XMLReader(ConstructionXMLReader): """Reader for Primavera P6 XML exports.""" def parse_activities(self, root: ET.Element) -> pd.DataFrame: """Parse activities from P6 XML.""" activities = self.find_elements(root, 'Activity') return self.elements_to_dataframe(activities) def parse_resources(self, root: ET.Element) -> pd.DataFrame: """Parse resources from P6 XML.""" resources = self.find_elements(root, 'Resource') return self.elements_to_dataframe(resources) def parse_wbs(self, root: ET.Element) -> pd.DataFrame: """Parse WBS from P6 XML.""" wbs = self.find_elements(root, 'WBS') return self.elements_to_dataframe(wbs) def parse_full_schedule(self, file_path: str) -> Dict[str, pd.DataFrame]: """Parse complete P6 schedule.""" root = self.parse_file(file_path) return { 'activities': self.parse_activities(root), 'resources': self.parse_resources(root), 'wbs': self.parse_wbs(root) } class IFCXMLReader(ConstructionXMLReader): """Reader for IFC-XML files.""" def parse_entities(self, root: ET.Element) -> pd.DataFrame: """Parse IFC entities.""" # Find all Ifc* elements all_entities = [] for elem in root.iter(): if elem.tag.startswith('Ifc'): all_entities.append(elem) return self.elements_to_dataframe(all_entities) def get_entity_types(self, root: ET.Element) -> Dict[str, int]: """Count entity types.""" counts = {} for elem in root.iter(): tag = elem.tag if tag.startswith('Ifc'): counts[tag] = counts.get(tag, 0) + 1 return counts class COBieXMLReader(ConstructionXMLReader): """Reader for COBie XML files.""" COBIE_SHEETS = ['Facility', 'Floor', 'Space', 'Zone', 'Type', 'Component', 'System', 'Assembly', 'Connection', 'Spare', 'Resource', 'Job', 'Document', 'Attribute'] def parse_cobie(self, file_path: str) -> Dict[str, pd.DataFrame]: """Parse all COBie sheets.""" root = self.parse_file(file_path) result = {} for sheet in self.COBIE_SHEETS: elements = self.find_elements(root, sheet) if elements: result[sheet] = self.elements_to_dataframe(elements) return result class BSDDXMLReader(ConstructionXMLReader): """Reader for buildingSMART Data Dictionary exports.""" def parse_classifications(self, root: ET.Element) -> pd.DataFrame: """Parse classification items.""" items = self.find_elements(root, 'Classification') return self.elements_to_dataframe(items) def parse_properties(self, root: ET.Element) -> pd.DataFrame: """Parse property definitions.""" props = self.find_elements(root, 'Property') return self.elements_to_dataframe(props)
pythonreader = ConstructionXMLReader() # Parse XML file root = reader.parse_file("schedule.xml") # Find specific elements activities = reader.find_elements(root, "Activity") print(f"Found {len(activities)} activities") # Convert to DataFrame df = reader.elements_to_dataframe(activities)
pythonp6_reader = P6XMLReader() schedule = p6_reader.parse_full_schedule("p6_export.xml") activities = schedule['activities'] print(f"Activities: {len(activities)}")
pythoncobie_reader = COBieXMLReader() cobie_data = cobie_reader.parse_cobie("facility_cobie.xml") components = cobie_data.get('Component', pd.DataFrame())
pythonifc_reader = IFCXMLReader() root = ifc_reader.parse_file("model.ifcxml") # Count entity types types = ifc_reader.get_entity_types(root) for entity_type, count in sorted(types.items(), key=lambda x: -x[1])[:10]: print(f"{entity_type}: {count}")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | pass→pass | 14,995 | 11,495 | -23% | 1 | 1 | 0% | 2,851 | 4,459 | +56% | 0 | 0 | — |
case-22 | pass→pass | 11,784 | 12,957 | +10% | 1 | 1 | 0% | 2,150 | 4,671 | +117% | 0 | 0 | — |
case-01 | fail→fail | 9,568 | 25,861 | +170% | 1 | 1 | 0% | 1,785 | 3,791 | +112% | 0 | 0 | — |
case-02 | fail→fail | 14,320 | 8,672 | -39% | 1 | 1 | 0% | 2,911 | 3,916 | +35% | 0 | 0 | — |
case-03 | fail→fail | 15,730 | 10,744 | -32% | 1 | 1 | 0% | 3,065 | 4,178 | +36% | 0 | 0 | — |
case-04 | fail→fail | 12,645 | 11,047 | -13% | 1 | 1 | 0% | 2,276 | 4,144 | +82% | 0 | 0 | — |
case-23 | pass→pass | 12,550 | 10,042 | -20% | 1 | 1 | 0% | 2,268 | 3,969 | +75% | 0 | 0 | — |
case-05 | fail→fail | 14,835 | 7,715 | -48% | 1 | 1 | 0% | 3,108 | 3,686 | +19% | 0 | 0 | — |
case-06 | fail→fail | 14,330 | 10,147 | -29% | 1 | 1 | 0% | 2,773 | 4,173 | +50% | 0 | 0 | — |
case-07 | fail→fail | 13,953 | 12,998 | -7% | 1 | 1 | 0% | 2,510 | 4,696 | +87% | 0 | 0 | — |
case-08 | fail→pass | 12,872 | 10,160 | -21% | 1 | 1 | 0% | 2,240 | 4,165 | +86% | 0 | 0 | — |
case-09 | pass→fail | 11,470 | 8,894 | -22% | 1 | 1 | 0% | 2,301 | 4,011 | +74% | 0 | 0 | — |
case-10 | fail→pass | 8,001 | 5,515 | -31% | 1 | 1 | 0% | 1,474 | 3,218 | +118% | 0 | 0 | — |
case-11 | fail→pass | 14,546 | 7,367 | -49% | 1 | 1 | 0% | 2,395 | 3,530 | +47% | 0 | 0 | — |
case-12 | fail→pass | 14,426 | 5,341 | -63% | 1 | 1 | 0% | 2,515 | 3,124 | +24% | 0 | 0 | — |
case-13 | fail→fail | 19,952 | 12,817 | -36% | 1 | 1 | 0% | 3,563 | 4,589 | +29% | 0 | 0 | — |
case-14 | fail→pass | 14,060 | 6,348 | -55% | 1 | 1 | 0% | 2,450 | 3,325 | +36% | 0 | 0 | — |
case-15 | fail→pass | 10,272 | 1,670 | -84% | 1 | 1 | 0% | 1,744 | 2,504 | +44% | 0 | 0 | — |
case-16 | fail→fail | 15,736 | 11,018 | -30% | 1 | 1 | 0% | 2,723 | 4,225 | +55% | 0 | 0 | — |
case-17 | fail→fail | 14,401 | 2,276 | -84% | 1 | 1 | 0% | 2,400 | 2,525 | +5% | 0 | 0 | — |
case-18 | pass→pass | 11,264 | 6,664 | -41% | 1 | 1 | 0% | 1,864 | 3,449 | +85% | 0 | 0 | — |
case-19 | pass→pass | 16,030 | 5,114 | -68% | 1 | 1 | 0% | 2,720 | 3,154 | +16% | 0 | 0 | — |
case-20 | pass→pass | 12,605 | 10,205 | -19% | 1 | 1 | 0% | 2,491 | 4,207 | +69% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +22 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.