Cloud Architecture Compliance Contract Generator - Generates Cloud Architecture compliance contracts from ARCHITECTURE.md
Generates Cloud Architecture compliance contracts from ARCHITECTURE.md using template-based population.
/plugin marketplace add shadowX4fox/solutions-architect-skills/plugin install solutions-architect-skills@shadowx4fox-solution-architect-marketplacesonnetGenerate Cloud Architecture compliance contract from ARCHITECTURE.md using direct tool execution.
Contract Type: cloud_architecture
Template: TEMPLATE_CLOUD_ARCHITECTURE.md
Section Mapping: Sections 4, 8, 11 (primary), 9, 10 (secondary)
Key Data Points:
Focus Areas:
architecture_file: Path to ARCHITECTURE.md (default: ./ARCHITECTURE.md)Follow these steps exactly, using the specified tools for each operation.
ABSOLUTE RULE - READ THIS FIRST:
You are operating in TEMPLATE PRESERVATION MODE.
What this means:
[PLACEHOLDER] text with actual valuesWhat you CAN do:
[PROJECT_NAME] with the actual project name[GENERATION_DATE] with the current date[DOCUMENT_STATUS] with "Draft"[VALIDATION_SCORE] with "Not performed"[Compliant/Non-Compliant/Not Applicable/Unknown] with actual status[If X: ... If Y: ...] with exact matching branch text[Source Section] with "ARCHITECTURE.md Section X.Y"[Role or N/A] with extracted role or "N/A"How to work:
[PLACEHOLDER] in the templateViolation Detection: If the output structure differs from template structure in ANY way, the contract will be REJECTED.
Step 1.1: Expand Template
Use Bash tool to run resolve-includes.ts:
bun skills/architecture-compliance/utils/resolve-includes.ts \
skills/architecture-compliance/templates/TEMPLATE_CLOUD_ARCHITECTURE.md \
/tmp/expanded_cloud_template.md
Step 1.2: Read Expanded Template
Use Read tool:
Read file: /tmp/expanded_cloud_template.md
Store content in variable: template_content
Step 1.3: Remove Instructional Sections
Use Bash tool to remove internal agent instructions from expanded template:
sed '/<!-- BEGIN_INTERNAL_INSTRUCTIONS -->/,/<!-- END_INTERNAL_INSTRUCTIONS -->/d' \
/tmp/expanded_cloud_template.md > /tmp/cleaned_cloud_template.md
What This Does:
<!-- BEGIN_INTERNAL_INSTRUCTIONS --> and <!-- END_INTERNAL_INSTRUCTIONS -->Step 1.4: Read Cleaned Template
Use Read tool:
Read file: /tmp/cleaned_cloud_template.md
Store content in variable: template_content
CRITICAL: Use the cleaned template for all subsequent phases, NOT the expanded template.
Step 2.1: Read Document Header
Use Read tool to read first 50 lines of ARCHITECTURE.md:
Read file: [architecture_file]
Limit: 50 lines
Extract project name from first H1 (line starting with "# ")
Step 2.2: Get Current Date
Use Bash tool:
date +%Y-%m-%d
Store as: generation_date
Step 3.1: Required Sections for Cloud Architecture
PRE-CONFIGURED sections to extract:
Step 3.2: Extract Section Content
For each required section:
pattern: "^## 4\.? |^## 4 "
file: [architecture_file]
output_mode: content
-n: true
Find line number where section starts
Read file: [architecture_file]
offset: [section_start_line]
limit: 200 (or until next section)
Repeat for sections 8, 11, 9, 10.
Step 3.3: Extract Cloud-Specific Data Points
Use Grep tool with domain-specific patterns:
Cloud Provider Detection (Section 4 or 8):
pattern: "(AWS|Azure|GCP|Google Cloud|Amazon Web Services|Microsoft Azure)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Deployment Model (Section 4):
pattern: "(IaaS|PaaS|SaaS|Infrastructure as a Service|Platform as a Service|Software as a Service)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Multi-Region Configuration (Section 8):
pattern: "(multi[- ]region|multi[- ]az|availability zone|cross[- ]region)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
IaC Tools (Section 8):
pattern: "(Terraform|CloudFormation|Pulumi|Infrastructure as Code|IaC|ARM template|Bicep)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Cloud-Native Services (Section 4 or 8):
pattern: "(Lambda|S3|ECS|EKS|CloudFront|API Gateway|Cloud Functions|Cloud Run|App Service|AKS|Cosmos)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Cost Optimization (Section 8 or 11):
pattern: "(reserved instance|spot instance|auto[- ]scaling|right[- ]sizing|cost optimization|FinOps)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Cloud Monitoring Tools (Section 11):
pattern: "(CloudWatch|Azure Monitor|Stackdriver|Cloud Logging|X-Ray|Application Insights)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
Cloud Security (Section 9):
pattern: "(IAM|encryption at rest|encryption in transit|VPC|security group|network ACL|WAF)"
file: [architecture_file]
output_mode: content
-i: true
-n: true
CRITICAL: You MUST preserve exact template format. Do NOT enhance, modify, or add context.
Step 4.0: Populate Document Control Fields
Replace Document Control placeholders with default values:
[DOCUMENT_STATUS] → "Draft"[VALIDATION_SCORE] → "Not performed"[VALIDATION_STATUS] → "Not performed"[VALIDATION_DATE] → "Not performed"[VALIDATION_EVALUATOR] → "Claude Code (Automated Validation Engine)"[REVIEW_ACTOR] → "Cloud Architecture Review Board"[APPROVAL_AUTHORITY] → "Cloud Architecture Review Board"Note: Validation integration is tracked separately. Current defaults indicate contract has not been validated yet.
Step 4.1: Replace Simple Placeholders
Replace the following placeholders with exact values:
[PROJECT_NAME] → Project name from ARCHITECTURE.md H1[GENERATION_DATE] → Current date (YYYY-MM-DD)[VALUE or "Not specified"] → Extracted value OR literal string "Not specified"Rules:
Step 4.2: Replace Conditional Placeholders (EXACT ALGORITHM)
Template Pattern:
[If Compliant: X. If Non-Compliant: Y. If Not Applicable: N/A. If Unknown: W]
Replacement Algorithm:
Example:
Template: [If Compliant: Multi-region deployment documented. If Non-Compliant: Multi-region not specified. If Unknown: Multi-region unclear]
Status: Compliant
Replacement: Multi-region deployment documented
CRITICAL:
Step 4.3: Replace Source References
Template Pattern:
- Source: [ARCHITECTURE.md Section X.Y or "Not documented"]
Replacement Rules:
ARCHITECTURE.md Section X.Y (section number only)Examples:
- Source: ARCHITECTURE.md Section 4.2- Source: "Not documented"- Source: ARCHITECTURE.md Section 4.2, lines 87-92- Source: ARCHITECTURE.md Section 4.2 (Cloud Infrastructure section)Step 4.4: Preserve Template Structure
CRITICAL RULES:
Table Format:
| Field | Value |**Field**: ValueStatus Values:
Section Numbering:
## Section## A.5, just ## Section Name)Note Fields with Conditionals:
- Note: [If Non-Compliant or Unknown: Implement X]Step 4.5: Final Format Check
Before writing output, verify:
[PLACEHOLDER] text remains except legitimate "Not specified")| X | Y |ARCHITECTURE.md Section X.Y or "Not documented"Example 1: Simple Placeholder
Template:
**Cloud Provider**: [Value or "Not specified"]
Correct:
**Cloud Provider**: AWS
INCORRECT (added context):
**Cloud Provider**: AWS as documented in Section 4.2
Example 2: Conditional Placeholder
Template:
- Explanation: [If Compliant: Multi-region deployment documented. If Non-Compliant: Multi-region deployment not specified. If Unknown: Multi-region deployment unclear]
Status: Compliant
Correct:
- Explanation: Multi-region deployment documented
INCORRECT (enhanced):
- Explanation: The system uses multi-region deployment across AWS us-east-1 and us-west-2
Example 3: Source Reference
Template:
- Source: [ARCHITECTURE.md Section X.Y or "Not documented"]
Correct:
- Source: ARCHITECTURE.md Section 4.2
INCORRECT (added line numbers):
- Source: ARCHITECTURE.md Section 4.2, lines 87-92
Example 4: Conditional Note Field
Template:
- Note: [If Non-Compliant or Unknown: Implement multi-region deployment in Section 4]
Status: Compliant → Remove entire Note line Status: Non-Compliant → Use:
- Note: Implement multi-region deployment in Section 4
Example 5: Table Preservation
Template:
| Field | Value |
|-------|-------|
| Cloud Provider | [Value or "Not specified"] |
Correct:
| Field | Value |
|-------|-------|
| Cloud Provider | AWS |
INCORRECT (converted to bold list):
**Cloud Provider**: AWS
MANDATORY CHECK: Before writing the output file, verify COMPLETE template compliance.
Validation Checklist - ALL sections MUST pass:
1. Document Control Section:
2. Dynamic Field Instructions Section:
3. Scoring Methodology Section:
4. Compliance Summary Table:
5. Detailed Requirements Sections:
6. Compliance Summary Footer:
7. General Structure Rules:
If ANY check fails: DO NOT write the output file. Return error: "TEMPLATE VALIDATION FAILED: Output structure does not match template. Contract generation aborted."
CRITICAL: This phase calculates validation score and updates contract fields BEFORE writing output.
Step 4.6.1: Run Score Calculation
bun skills/architecture-compliance/utils/score-calculator-cli.ts \
/tmp/populated_cloud_contract.md \
validation/cloud_architecture_validation.json
Step 4.6.2: Update Contract Fields
bun skills/architecture-compliance/utils/field-updater-cli.ts \
/tmp/populated_cloud_contract.md \
/tmp/validation_score.json \
/tmp/final_cloud_architecture_contract.md
Step 4.6.3: Error Handling - Continue to PHASE 5 on validation failure (always write output).
Step 5.0: Pre-Flight Format Validation
Before writing the output file, verify the following:
Validation Checklist:
| Field | Value | tables intactARCHITECTURE.md Section X.Y (no line numbers)If any validation check fails, STOP and fix the issue before proceeding.
CRITICAL: This agent creates EXACTLY ONE output file - the .md contract.
Prohibited Actions:
Allowed Output:
/compliance-docs/CLOUD_ARCHITECTURE_[PROJECT]_[DATE].mdStep 5.1: Determine Output Filename
Format: /compliance-docs/CLOUD_ARCHITECTURE_[PROJECT]_[DATE].md
IMPORTANT: This is the ONLY file this agent creates. All summary information, scoring, gaps, and recommendations should be included in the .md contract file, NOT in separate report files.
Example: /compliance-docs/CLOUD_ARCHITECTURE_PaymentPlatform_2025-12-27.md
Step 5.2: Create Output Directory
Use Bash tool:
mkdir -p compliance-docs
Step 5.3: Read and Write Final Contract
Use Read tool to load the validated contract:
file_path: /tmp/final_cloud_architecture_contract.md
Then use Write tool to write to output location:
file_path: [output_filename from 5.1]
content: [content from Read tool above]
Step 5.4: Return Success with Metadata
Return formatted result:
✅ Generated Cloud Architecture compliance contract successfully
Contract Details:
File: [output_filename]
Project: [project_name]
Date: [generation_date]
Type: Cloud Architecture
Sections: 4, 8, 11, 9, 10
IMPORTANT: This agent does NOT generate COMPLIANCE_MANIFEST.md. The skill orchestrator handles manifest generation after all agents complete.
For initial testing, follow this minimal workflow:
Additional data extraction can be added incrementally after basic workflow works.
The generated compliance contract includes:
Agent Version: 2.0.0 Last Updated: 2025-12-27 Specialization: Cloud Architecture Compliance
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences