AgentSkillsCN

cmap-validation

CMAP验证套件v7.10.0——拥有18个验证器、500多条规则,专为Power Platform部署而设计。可验证解决方案包、Copilot指令、知识库文件、工作流、连接器、YAML文件以及Power Fx。至关重要的是:不仅能捕捉“类型29未声明”的工作流错误,还能精准识别空“实体”部分的失败问题。全新v7.10版本新增元数据标签验证器(ML代码),可有效检测缺失的OptionSet显示名称。触发指令:“/validate”、“验证解决方案”、“CMAP验证”、“导入失败”、“工作流验证”。

SKILL.md
--- frontmatter
name: cmap-validation
description: >
  CMAP Validation Suite v7.10.0 - 18 validators, 500+ rules for Power Platform deployments.
  Validates solution packages, Copilot instructions, KB files, workflows, connectors, YAML, Power Fx.
  CRITICAL: Catches "type 29 not declared" workflow errors AND empty Entities section failures.
  NEW v7.10: Metadata Labels validator (ML codes) - catches missing OptionSet displaynames.
  Triggers: "/validate", "validate solution", "CMAP validation", "import failed", "workflow validation".

CMAP Validation Suite

Invoke: /validate or say "validate solution", "CMAP validation", "pre-deployment check"

Pre-deployment validation for CMAP agentic suite across Microsoft 365, Power Platform, and Azure. Now with full Microsoft Copilot Studio VS Code extension and Power Platform Solution Checker parity. CRITICAL: Includes workflow RootComponent validation to prevent "type 29 not declared" import errors. NEW v7.10: Metadata Labels validation catches missing OptionSet displaynames before import fails.

Validation Coverage (500+ Rules, 18 Validators)

CategoryRulesReference
Package Structure25+platform-validation-rules.md
Solution Structure55+platform-validation-rules.md
Naming Conventions85+platform-validation-rules.md
GUID/Dependencies35+platform-validation-rules.md
Security35+platform-validation-rules.md
CMAP Governance60+cmap-governance-rules.md
File Quality10+error-codes.md (FQ codes)
Naming Consistency10+error-codes.md (NC codes)
Orphan Detection10+error-codes.md (OF codes)
YAML Schema20+error-codes.md (YS codes)
Power Fx Formulas15+error-codes.md (PF codes)
Web Resources25+error-codes.md (WR codes)
Topic Limits5+error-codes.md (TL codes)
Connectors15+error-codes.md (CN codes)
Agent Chaining5+error-codes.md (AC codes)
Workflow RootComponents10+error-codes.md (WF codes)
Solution Structure10+error-codes.md (SS codes)
Metadata Labels25+v6-learned-patterns.md (ML codes)

Quick Start

bash
# Full suite validation (18 validators, 500+ rules)
python scripts/validate_cmap_suite.py /path/to/deployment/ --include-governance

# NEW - Metadata Labels validation (catches missing OptionSet displaynames)
python scripts/validate_metadata_labels.py solution.zip
python scripts/validate_metadata_labels.py customizations.xml
python scripts/validate_metadata_labels.py /path/to/solution/folder/

# NEW - Auto-fix missing metadata labels
python scripts/fix_metadata_labels.py solution.zip
python scripts/fix_metadata_labels.py customizations.xml

# Individual validators - CMAP Governance
python scripts/validate_copilot_instructions.py instructions.txt
python scripts/validate_kb_compliance.py /path/to/kb/
python scripts/validate_seed_data.py seed_data.json schema.json
python scripts/validate_docx_quality.py document.docx
python scripts/audit_file_versions.py /path/to/deployment/
python scripts/validate_file_quality.py /path/to/project/
python scripts/validate_naming_consistency.py /path/to/deployment/
python scripts/validate_orphaned_files.py /path/to/deployment/

# Individual validators - MS Extension Parity
python scripts/validate_yaml_schema.py /path/to/deployment/
python scripts/validate_powerfx.py /path/to/deployment/
python scripts/validate_web_resources.py /path/to/deployment/
python scripts/validate_topic_limits.py /path/to/deployment/
python scripts/validate_connectors.py /path/to/deployment/
python scripts/validate_agent_chaining.py /path/to/deployment/

# CRITICAL - Workflow RootComponent validation (prevents import failures)
python scripts/validate_workflow_rootcomponents.py solution.zip

# CRITICAL - Solution Structure validation (catches empty Entities, sync issues)
python scripts/validate_solution_structure.py solution.zip

⚠️ CRITICAL: ML001 Missing OptionSet DisplayNames

This is the cause of "Option set display name not specified" import failures.

The Problem (v7.0.17 Failure)

code
Failed to create entity with logical name ca_frameworks...
Option set display name for id: a177e3ab-cdff-f011-8406-6045bd09ffcc,
objectcolumn: DisplayName and labelTypeCode: OptionSet not specified

Required Structure (from working v6)

Every <optionset> MUST have:

xml
<optionset Name="ca_framework_statecode">
  <OptionSetType>state</OptionSetType>
  <IntroducedVersion>1.0</IntroducedVersion>
  <IsCustomizable>1</IsCustomizable>
  <displaynames>                                    <!-- REQUIRED -->
    <displayname description="Status" languagecode="1033" />  <!-- REQUIRED -->
  </displaynames>
  <states>
    <state value="0" defaultstatus="1" invariantname="Active">
      <labels>                                      <!-- REQUIRED -->
        <label description="Active" languagecode="1033" />     <!-- REQUIRED -->
      </labels>
    </state>
  </states>
</optionset>

Quick Fix

bash
# Validate
python scripts/validate_metadata_labels.py solution.zip

# Auto-fix
python scripts/fix_metadata_labels.py solution.zip
# Creates: solution_fixed.zip

Why This Happens

  1. New choice fields added without proper labels in the maker portal
  2. Solution export corruption
  3. Manual XML editing that removes required elements
  4. AI code generation that omits localization requirements

Prevention

Run validate_metadata_labels.py before every import attempt.

Validation Workflow

1. Package Structure Validation

Run FIRST - catches blocking issues before detailed validation.

Critical Checks:

  • Archive format: .zip or .cab only
  • Max size: 95 MB (hard limit)
  • Files at root level (NO wrapper folder)
  • Required root files: [Content_Types].xml, customizations.xml, solution.xml
  • Folder case sensitivity: CanvasApps/ not canvasapps/

2. Metadata Labels Validation (NEW)

Run SECOND - catches OptionSet/displayname issues.

Critical Checks:

  • Every <optionset> has <displaynames> with at least one <displayname>
  • Every <displayname> has non-empty description and languagecode="1033"
  • Every <option>, <state>, <status> has <labels> with English label
  • Attribute displaynames present (warning only)

3. Entity.xml Validation

Root cause of most import failures.

CORRECT:

xml
<Name LocalizedName="Client" OriginalName="Client">eap_Client</n>

INVALID (causes failure):

xml
<n>eap_capability_impl</n>

4. Copilot Studio Validation

See cmap-governance-rules.md for full details.

Core Instructions Requirements:

  • Plain text only (no markdown)
  • 7,500-7,999 characters
  • Must include RAG language (KB search instructions)
  • Must include self-referential learning (session history references)
  • No periods in topic names

5. CMAP Governance Validation

See cmap-governance-rules.md for full details.

Error Code Reference

Error Code Prefixes:

PrefixCategory
CICopilot Instructions
SR6-Rule Compliance
SDSeed Data
VCVersion Control
DQDocument Quality
FQFile Quality
NCNaming Consistency
OFOrphaned Files
YSYAML Schema
PFPower Fx
WRWeb Resources
TLTopic Limits
CNConnectors
ACAgent Chaining
WFWorkflow RootComponents
SSSolution Structure
MLMetadata Labels (NEW)
PKPackage Structure
DVDataverse
SPSharePoint
AZAzure

Metadata Labels Error Codes (ML)

CodeSeverityDescription
ML001ERROROptionSet missing <displaynames> element
ML002ERROROptionSet <displaynames> empty
ML003ERROR<displayname> missing 'description' attribute
ML004ERROR<displayname> has empty 'description'
ML005ERROR<displayname> missing 'languagecode'
ML010ERROROption missing <labels> element
ML011ERROROption <labels> empty
ML012WARNING<label> missing 'description'
ML013ERRORState missing <labels> element
ML014ERRORStatus missing <labels> element
ML020WARNINGAttribute missing <displaynames>
ML021WARNINGAttribute <displaynames> empty
ML030WARNINGEntity missing <LocalizedNames>
ML040ERRORMissing English (1033) label
ML041WARNINGDuplicate languagecode
ML050WARNINGInvalid OptionSetType value
ML051ERROROptionSet missing 'Name' attribute
ML052ERROROption missing 'value' attribute

Common Fixes

IssueQuick Fix
Missing OptionSet displaynames (ML001)Run scripts/fix_metadata_labels.py solution.zip
Missing option labels (ML010-014)Run scripts/fix_metadata_labels.py solution.zip
Entity.xml invalidRun scripts/fix_entity_xml.py solution.zip
Folder case wrongRename to exact case: CanvasApps/, Workflows/
Instructions too longTarget 7,700-7,800 chars
Missing RAG languageAdd "Search your knowledge base before responding"
Stale file referencesRun scripts/audit_file_versions.py
Corrupted charactersRun scripts/fix_docx_encoding.py
Empty/stub filesComplete implementation or remove unused files
Entity name mismatchAlign folder name, schema name, and OriginalName
Missing LocalizedName/OriginalName (DV071/DV072)Run scripts/fix_name_attributes.py <solution_dir>
Folder format (empty customizations.xml)Run scripts/fix_empty_entities.py <solution_dir>
Hybrid format (Entities/ + customizations.xml)VALID - No action needed
Orphaned entity folderAdd to solution.xml RootComponents or remove
Orphaned KB fileConnect to agent knowledge source or remove
Workflow not declared (type 29)Add <RootComponent type="29" id="{guid}" schemaName="name" /> to solution.xml
Empty Entities section (SS001)Run scripts/fix_empty_entities.py solution.zip
Invalid OwnershipTypeMask (SS008)Replace OrganizationOwned with OrgOwned

V6 Learned Patterns

See v6-learned-patterns.md for:

  • Complete OptionSet structure templates
  • State/Status/Picklist patterns
  • Attribute displayname requirements
  • Entity-level metadata patterns
  • OptionSet naming conventions
  • Language code requirements

Version History

  • v1.0 - Initial Power Platform solution validator
  • v2.0 - Expanded to full CMAP suite
  • v2.1 - Added naming conventions, 200+ rules
  • v3.0 - Package structure, Entity.xml, GUID validation, 280+ rules
  • v3.1 - CMAP Governance: 6-Rule KB, Copilot instructions, seed data validation, version control, document quality, 340+ rules
  • v7.09 - Renamed to CMAP Validation, added /validate invoke, master orchestrator script
  • v7.09.1 - Added file quality (FQ), naming consistency (NC), orphan detection (OF), 370+ rules
  • v7.09.2 - MS Extension Parity: YAML schema, Power Fx, web resources, topic limits, connectors, agent chaining, 455+ rules, 15 validators
  • v7.09.3 - CRITICAL: Workflow RootComponent validation (WF), 465+ rules, 16 validators
  • v7.09.4 - CRITICAL: Solution Structure validation (SS), 475+ rules, 17 validators
  • v7.10.0 - Metadata Labels validation (ML) - learned from v6 working solution, catches missing OptionSet displaynames, 500+ rules, 18 validators