Create federated data product contracts for mesh architectures with SLAs, governance, and interoperability guarantees (project)
You are helping an enterprise architect create a data mesh contract for a data product in a federated mesh architecture.
This command generates a data-mesh-contract document that defines the formal agreement between a data product provider (domain team) and consumers, following the Open Data Contract Standard (ODCS) v3.0.2.
$ARGUMENTS
Note: Before generating, scan
projects/for existing project directories. For each project, list allARC-*.mdartifacts, checkexternal/for reference documents, and check000-global/for cross-project policies. If no external docs exist but they would improve output, ask the user.
IMPORTANT: Before generating a data mesh contract, verify that foundational artifacts exist:
Architecture Principles (REQUIRED):
Check if projects/000-global/ARC-000-PRIN-*.md exists
If it does NOT exist:
❌ Architecture principles not found.
Data mesh contracts require architecture principles to be established first.
Principles should include mesh governance standards (federated ownership, data as a product, self-serve infrastructure).
Please run: $arckit-principles Create enterprise architecture principles
Then return here to generate the data mesh contract.
If it exists, proceed to Step 1
Data Model (HIGHLY RECOMMENDED):
Check if the project has a ARC-*-DATA-*.md file
If it does NOT exist:
⚠️ Warning: No data model found for this project.
Data mesh contracts are typically derived from existing data models (entities become data products).
Consider running: $arckit-data-model Create data model for [project name]
You can proceed without a data model, but you'll need to define schema from scratch.
Continue anyway? (yes/no)
If user says "no", stop here and tell them to run $arckit-data-model first
If user says "yes" or if ARC--DATA-.md exists, proceed to Step 1
Stakeholder Analysis (RECOMMENDED):
Check if the project has ARC-*-STKE-*.md
If it does NOT exist:
⚠️ Warning: No stakeholder analysis found.
Stakeholder analysis helps identify:
- Domain owners (who owns this data product)
- Consumers (who will use this data product)
- Data stewards and governance stakeholders
Consider running: $arckit-stakeholders Analyze stakeholders for [project name]
You can proceed without stakeholder analysis, but ownership roles will be generic placeholders.
Continue anyway? (yes/no)
If user says "no", stop here
If user says "yes" or if ARC--STKE-.md exists, proceed to Step 1
Gathering rules (apply to all user questions in this command):
Extract the data product name from the user's message. Examples:
The data product name should be:
customer-payments, seller-analyticsIf the user didn't provide a clear data product name, ask:
What is the name of the data product for this contract?
Examples:
- customer-payments
- seller-analytics
- order-events
- fraud-detection-features
Data product name (kebab-case):
projects/*/ directories and find the highest NNN-* number (or start at 001 if none exist)002)projects/{NNN}-{slug}/README.md with the project name, ID, and date — the Write tool will create all parent directories automaticallyprojects/{NNN}-{slug}/external/README.md with a note to place external reference documents herePROJECT_ID = the 3-digit number, PROJECT_PATH = the new directory pathImportant: If the script creates a NEW project, inform the user:
Created new project: Project {project_id} - {project_name}
Location: {project_path}
Note: This is a new project. You may want to run these commands first:
- $arckit-stakeholders - Identify domain owners and consumers
- $arckit-data-model - Define entities that become data products
- $arckit-requirements - Capture DR-xxx data requirements
If the project ALREADY EXISTS, just acknowledge it:
Using existing project: Project {project_id} - {project_name}
Location: {project_path}
Data mesh contracts should be organized in a subdirectory. The directory will be created automatically when saving the file with the Write tool.
The contract file will use the multi-instance naming pattern:
{project_path}/data-contracts/ARC-{PROJECT_ID}-DMC-{NNN}-v1.0.md
Where {NNN} is the next sequential number for contracts in this project. Check existing files in data-contracts/ and use the next number (001, 002, ...).
Read the data mesh contract template:
Read the template (with user override support):
.arckit/templates/data-mesh-contract-template.md exists in the project root.arckit/templates/data-mesh-contract-template.md (default)Tip: Users can customize templates with
$arckit-customize data-mesh-contract
external/ files) — extract existing data product definitions, SLA terms, schema specifications, data quality rulesprojects/000-global/external/ — extract enterprise data governance standards, data sharing agreements, cross-project data catalogue conventionsprojects/{project-dir}/external/ and re-run, or skip.".arckit/references/citation-instructions.md. Place inline citation markers (e.g., [PP-C1]) next to findings informed by source documents and populate the "External References" section in the template.IF ARC-*-DATA-*.md exists in the project:
{project_path}/ARC-*-DATA-*.mdIF ARC-*-REQ-*.md exists:
{project_path}/ARC-*-REQ-*.mdIF ARC-*-STKE-*.md exists:
{project_path}/ARC-*-STKE-*.mdIF projects/000-global/ARC-000-PRIN-*.md exists:
Using the template and context gathered, generate a comprehensive data mesh contract.
Key Sections to Populate:
Document Information:
ARC-{project_id}-DMC-{NNN}-v1.0 (multi-instance type, uses sequential numbering){project_name} (Project {project_id})1.0Fundamentals (Section 1):
{data-product-name}1.0.0Schema (Section 2):
Data Quality (Section 3):
Service-Level Agreement (Section 4):
Access Methods (Section 5):
Security and Privacy (Section 6):
Governance and Change Management (Section 7):
Consumer Obligations (Section 8):
Pricing (Section 9):
Infrastructure (Section 10):
Observability (Section 11):
Testing (Section 12):
Limitations (Section 13):
Roadmap (Section 14):
Related Contracts (Section 15):
Appendices (Section 16):
ARC-{PROJECT_ID}-DMC-{NNN}-v{VERSION} (e.g., ARC-001-DMC-001-v1.0){NNN}: Check existing files in data-contracts/ and use the next number (001, 002, ...)CRITICAL - Auto-Populate Document Control Fields:
Before completing the document, populate ALL document control fields in the header:
Construct Document ID:
ARC-{PROJECT_ID}-DMC-{NNN}-v{VERSION} (e.g., ARC-001-DMC-001-v1.0)Populate Required Fields:
Auto-populated fields (populate these automatically):
[PROJECT_ID] → Extract from project path (e.g., "001" from "projects/001-project-name")[VERSION] → "1.0" (or increment if previous version exists)[DATE] / [YYYY-MM-DD] → Current date in YYYY-MM-DD format[DOCUMENT_TYPE_NAME] → "Data Mesh Contract"ARC-[PROJECT_ID]-DMC-v[VERSION] → Construct using format above[COMMAND] → "arckit.data-mesh-contract"User-provided fields (extract from project metadata or user input):
[PROJECT_NAME] → Full project name from project metadata or user input[OWNER_NAME_AND_ROLE] → Document owner (prompt user if not in metadata)[CLASSIFICATION] → Default to "OFFICIAL" for UK Gov, "PUBLIC" otherwise (or prompt user)Calculated fields:
[YYYY-MM-DD] for Review Date → Current date + 30 daysPending fields (leave as [PENDING] until manually updated):
[REVIEWER_NAME] → [PENDING][APPROVER_NAME] → [PENDING][DISTRIBUTION_LIST] → Default to "Project Team, Architecture Team" or [PENDING]Populate Revision History:
| 1.0 | {DATE} | ArcKit AI | Initial creation from `$arckit-data-mesh-contract` command | [PENDING] | [PENDING] |
Populate Generation Metadata Footer:
The footer should be populated with:
**Generated by**: ArcKit `$arckit-data-mesh-contract` command
**Generated on**: {DATE} {TIME} GMT
**ArcKit Version**: {ARCKIT_VERSION}
**Project**: {PROJECT_NAME} (Project {PROJECT_ID})
**AI Model**: [Use actual model name, e.g., "claude-sonnet-4-5-20250929"]
**Generation Context**: [Brief note about source documents used]
Before writing the file, read .arckit/references/quality-checklist.md and verify all Common Checks plus the DMC per-type checks pass. Fix any failures before proceeding.
IMPORTANT: Use the Write tool to create the file. Do NOT output the full document content to the user (it will be 2000-4000 lines and exceed token limits).
Write tool:
file_path: {project_path}/data-contracts/ARC-{PROJECT_ID}-DMC-{NNN}-v1.0.md
content: {full contract content}
Note: Use the constructed document ID format for the filename.
After writing the file, show the user a concise summary (do NOT show the full document):
✅ Data Mesh Contract Generated
**Contract**: ARC-{PROJECT_ID}-DMC-{NNN}-v1.0.md
**Location**: {project_path}/data-contracts/
**Document ID**: ARC-{project_id}-DMC-{NNN}-v1.0
**ODCS Version**: v3.0.2
**Contract Version**: 1.0.0
**Status**: DRAFT
---
## Contract Summary
**Data Product**: {data_product_name}
**Domain**: {domain_name}
**Purpose**: {brief_purpose}
### Schema
- **Objects**: {N} objects defined
- **Properties**: {M} total properties
- **PII Fields**: {P} fields contain PII
### SLA Commitments
- **Availability**: {99.9%} uptime
- **Response Time (p95)**: {<200ms}
- **Freshness**: {<5 minutes}
- **Data Retention**: {7 years}
### Quality Rules
- {N} automated quality rules defined
- Quality dimensions: Accuracy, Validity, Completeness, Consistency, Timeliness, Uniqueness
### Access Methods
- REST API: {endpoint}
- SQL Query: {database.schema.table}
- Data Lake: {s3://bucket/prefix}
### Security
- Classification: {OFFICIAL-SENSITIVE} (contains PII)
- Encryption: AES-256 at rest, TLS 1.3 in transit
- Access Control: RBAC (Consumer-Read, Analyst-FullRead, Admin)
- GDPR Compliant: ✅
### Governance
- Change Process: Minor (7 days notice), Major (90 days notice)
- Review Cycle: Quarterly
- Deprecation Policy: 90-day notice + migration support
---
## Next Steps
1. **Review Contract**: Open the file and customize placeholders ({...})
2. **Domain Team Review**: Product Owner should review all sections
3. **DPO Review** (if PII): Ensure GDPR compliance is accurate
4. **Security Review**: Validate encryption and access controls
5. **Publish to Catalogue**: Register contract in data catalogue for discovery
6. **Consumer Onboarding**: Set up sandbox environment for consumers to test
## Related Commands
- `$arckit-traceability` - Link this contract to requirements and consumers
- `$arckit-analyze` - Score contract completeness and governance quality
- `$arckit-dpia` - Generate Data Protection Impact Assessment (if PII present)
---
**Full contract**: `{project_path}/data-contracts/ARC-{PROJECT_ID}-DMC-{NNN}-v1.0.md` ({line_count} lines)
Based on what artifacts exist, recommend next steps:
If no ARC--REQ-.md:
💡 Tip: Run $arckit-requirements to capture DR-xxx data requirements.
These will inform SLA targets and quality rules in future contract updates.
If no ARC--STKE-.md:
💡 Tip: Run $arckit-stakeholders to identify domain owners and consumers.
This will help assign real names to ownership roles instead of placeholders.
If PII exists but no ARC--DPIA-.md:
⚠️ This contract contains PII ({N} fields marked as PII).
UK GDPR Article 35 may require a Data Protection Impact Assessment (DPIA).
Consider running: $arckit-dpia Generate DPIA for {project_name}
If this is a UK Government project:
💡 UK Government Alignment:
- Technology Code of Practice: Point 8 (Share, reuse and collaborate) ✅
- National Data Strategy: Pillar 1 (Unlocking value) ✅
- Data Quality Framework: 5 dimensions covered ✅
Consider running:
- $arckit-tcop - Technology Code of Practice assessment
- $arckit-service-assessment - GDS Service Standard (if digital service)
Token Limit Handling: ALWAYS use the Write tool for the full document. NEVER output the complete contract to the user (it's 2000-4000 lines). Only show the summary.
ODCS Compliance: This contract follows Open Data Contract Standard (ODCS) v3.0.2. The Appendix A contains a YAML export that can be consumed programmatically.
UK Government Context: If this is a UK Government project, ensure:
Traceability: The contract links to:
Versioning: Use semantic versioning (MAJOR.MINOR.PATCH):
Federated Ownership: The domain team owns this contract end-to-end. They are responsible for:
One Contract Per Product: Don't bundle unrelated datasets. Each domain data product should have its own contract.
Automation is Critical: The contract is meaningless without observability and automated policy enforcement. Ensure:
< or > (e.g., < 3 seconds, > 99.9% uptime) to prevent markdown renderers from interpreting them as HTML tags or emojiExample 1: Simple contract creation
User: $arckit-data-mesh-contract Create contract for customer payments
Assistant:
- Checks prerequisites ✅
- Creates project 001-customer-payments
- Finds ARC-*-DATA-*.md with CUSTOMER and TRANSACTION entities
- Generates contract mapping entities → objects
- Shows summary (not full document)
Example 2: Contract without data model
User: $arckit-data-mesh-contract seller-analytics contract
Assistant:
- Checks prerequisites ✅
- Warns: No data model found
- User confirms to proceed
- Generates contract with generic schema placeholders
- Recommends running $arckit-data-model first
Example 3: Contract with full context
User: $arckit-data-mesh-contract fraud-detection-features
Assistant:
- Checks prerequisites ✅
- Finds ARC-*-DATA-*.md, ARC-*-REQ-*.md, ARC-*-STKE-*.md
- Maps entities → objects
- Maps DR-xxx → quality rules
- Maps NFR-P-xxx → SLA response time targets
- Maps stakeholders → ownership roles
- Generates comprehensive contract with minimal placeholders
- Shows summary
If architecture principles don't exist:
$arckit-principles firstIf user provides unclear data product name:
If project creation fails:
If template file is missing:
If file write fails: