Patterns
Verb-Based Patterns
CLI patterns for executing actions on objects (selling, managing, analyzing, launching)
Verb-Based CLI Patterns
Verb-based patterns are for executing specific actions NOW. Use these for transaction-based operations, workflow orchestration, and event-driven processing.
Pattern Structure
Domain: {subject}.{verb}.{mode}.{tld}/{object}
Semantic Triple: $.{Subject}.{verb}.{Object}
CLI Command: do {subject}.{verb} {Object} [data] [options]
Core Concept
Verb-based patterns execute immediate actions on objects. Unlike noun-based patterns that create persistent services, verb patterns perform one-time operations.
Key Rule: MUST have explicit subject (not just verb)
- ❌ BAD:
sell cars(WHO sells?) - ✅ GOOD:
commerce sell cars(Commerce sells)
graph LR
Start[Command Invoked] --> Parse[Parse Triple]
Parse --> Subject[Identify Subject]
Subject --> Verb[Extract Verb]
Verb --> Object[Get Object Data]
Object --> Execute[Execute Action]
Execute --> Process[Process Business Logic]
Process --> Result[Return Result]
Result --> Success{Success?}
Success -->|Yes| Events[Emit Success Events]
Success -->|No| Error[Handle Error]
Error --> Retry{Retry?}
Retry -->|Yes| Execute
Retry -->|No| Fail[Return Failure]
CLI Commands
Basic Action Execution
# Execute action with data
do {subject}.{verb} {Object} '{json-data}'
# With options
do {subject}.{verb} {Object} '{json-data}' --option value
# Dry run (validate without executing)
do {subject}.{verb} {Object} '{json-data}' --dry-runCommerce Actions
# Sell a car
do commerce.sell Car '{
"vin": "1HGBH41JXMN109186",
"price": 50000,
"buyer": {
"name": "John Doe",
"email": "[email protected]"
},
"payment": {
"method": "card",
"token": "tok_visa_4242"
}
}'
# Sell software license
do commerce.sell Software '{
"productId": "pro-plan-annual",
"quantity": 10,
"buyer": {
"company": "Acme Corp",
"email": "[email protected]"
},
"price": 9999,
"licenseType": "enterprise"
}'
# Process refund
do commerce.refund Order '{
"orderId": "order-789",
"amount": 50000,
"reason": "Customer request"
}'Business Operations
# Launch a startup
do business.launch Startup '{
"name": "TechVenture Inc",
"industry": "SaaS",
"founders": [
{"name": "Alice", "equity": 50},
{"name": "Bob", "equity": 50}
],
"initialCapital": 100000,
"jurisdiction": "Delaware"
}'
# Manage inventory
do operations.manage Inventory '{
"warehouseId": "warehouse-us-east",
"action": "restock",
"items": [
{"sku": "LAPTOP-001", "quantity": 50}
]
}'
# Execute project
do operations.execute Project '{
"projectId": "project-123",
"phase": "implementation",
"assignees": ["user-456", "user-789"],
"deadline": "2025-12-31"
}'Intelligence & Analytics
# Analyze data
do intelligence.analyze Data '{
"dataset": "sales-2025-q4",
"metrics": ["revenue", "conversion", "churn"],
"dimensions": ["region", "product", "channel"],
"output": "dashboard"
}'
# Process insights
do intelligence.process Insights '{
"source": "customer-feedback",
"method": "sentiment-analysis",
"model": "claude-sonnet-4.5"
}'
# Generate report
do intelligence.generate Report '{
"type": "executive-summary",
"period": "2025-Q4",
"sections": ["revenue", "growth", "forecast"],
"format": "pdf"
}'Finance Operations
# Process payment
do finance.process Payment '{
"invoiceId": "inv-123",
"amount": 9999,
"method": "card",
"token": "tok_visa_4242"
}'
# Create invoice
do finance.create Invoice '{
"customerId": "customer-456",
"items": [
{"description": "Pro Plan", "amount": 99, "quantity": 1}
],
"dueDate": "2025-11-25"
}'
# Reconcile accounts
do finance.reconcile Accounts '{
"period": "2025-10",
"accounts": ["checking", "savings", "credit-card"]
}'Marketing Actions
# Send campaign
do marketing.send Campaign '{
"name": "Product Launch 2025",
"audience": "segment-active-users",
"channels": ["email", "sms"],
"content": {
"subject": "Introducing Our New Feature",
"template": "product-launch-v2"
},
"schedule": "2025-11-01T09:00:00Z"
}'
# Track conversion
do marketing.track Conversion '{
"event": "signup",
"userId": "user-789",
"source": "google-ads",
"campaign": "summer-2025",
"value": 99
}'Content Operations
# Publish content
do content.publish Article '{
"id": "article-123",
"title": "10 Tips for Business Automation",
"channels": ["blog", "medium", "linkedin"],
"scheduleAt": "2025-10-26T10:00:00Z"
}'
# Moderate content
do content.moderate Comment '{
"id": "comment-456",
"action": "approve",
"moderatorId": "mod-789"
}'
# Archive content
do content.archive Documents '{
"filter": {"status": "inactive", "age": "> 2 years"},
"destination": "s3://archive-bucket/docs/"
}'Workflow Chaining
Chain multiple actions together:
# Sequential execution
do commerce.sell Car '{...}' | \
do finance.process Payment '{...}' | \
do logistics.schedule Delivery '{...}'
# With error handling
do commerce.sell Car '{...}' \
--on-success 'finance.process Payment' \
--on-failure 'notifications.send Alert'
# Parallel execution
do orchestrate parallel \
"commerce.sell Product" \
"inventory.update Stock" \
"analytics.track Sale"Batch Operations
Execute actions on multiple objects:
# Process batch of orders
do commerce.process Orders --batch '{
"orders": ["order-1", "order-2", "order-3"],
"action": "fulfill"
}'
# Bulk send emails
do communications.send Emails --batch-file emails.json
# Parallel batch processing
do marketing.send Campaign --batch emails.csv --parallel 10Conditional Execution
# Execute with conditions
do commerce.sell Product '{...}' \
--if '{"inventory.quantity": {">": 0}}' \
--else 'notifications.send OutOfStock'
# With approval workflow
do finance.approve Payment '{...}' \
--requires-approval \
--approver "user-manager-123"Transaction Management
# Start transaction
TRANSACTION_ID=$(do tx.begin --isolation serializable)
# Execute within transaction
do commerce.sell Car '{...}' --tx $TRANSACTION_ID
do finance.process Payment '{...}' --tx $TRANSACTION_ID
do logistics.schedule Delivery '{...}' --tx $TRANSACTION_ID
# Commit or rollback
do tx.commit $TRANSACTION_ID
# OR
do tx.rollback $TRANSACTION_IDEvent-Driven Actions
# Execute action and emit event
do commerce.sell Car '{...}' --emit-event Order.created
# Subscribe to events and execute actions
do on Order.created commerce.fulfill Order
do on Payment.completed logistics.schedule Delivery
do on Delivery.shipped communications.send TrackingEmailScheduling
# Schedule action for later
do commerce.sell Product '{...}' --schedule "2025-11-01T09:00:00Z"
# Recurring action
do reports.generate Report '{...}' --recurring "0 9 * * MON" # Every Monday 9am
# Cancel scheduled action
do scheduled.cancel action-schedule-123Examples by Domain
E-commerce
# Complete checkout flow
do commerce.checkout Cart '{
"cartId": "cart-123",
"customer": {
"email": "[email protected]",
"name": "Jane Smith"
},
"payment": {
"method": "card",
"token": "tok_visa_4242"
},
"shipping": {
"address": "123 Main St, City, ST 12345",
"method": "standard"
}
}'
# Apply discount
do commerce.apply Discount '{
"code": "SAVE20",
"orderId": "order-456"
}'
# Cancel order
do commerce.cancel Order '{
"orderId": "order-789",
"reason": "customer-request",
"refund": true
}'Real Estate
# List property
do realestate.list Property '{
"address": "456 Oak Ave, City, ST",
"price": 450000,
"bedrooms": 3,
"bathrooms": 2,
"sqft": 1800,
"agent": "agent-123"
}'
# Schedule showing
do realestate.schedule Showing '{
"propertyId": "prop-456",
"buyer": "buyer-789",
"datetime": "2025-10-28T14:00:00Z"
}'
# Submit offer
do realestate.submit Offer '{
"propertyId": "prop-456",
"buyerId": "buyer-789",
"amount": 440000,
"financing": "conventional",
"contingencies": ["inspection", "financing"]
}'Healthcare
# Schedule appointment
do healthcare.schedule Appointment '{
"patientId": "patient-123",
"providerId": "doctor-456",
"type": "consultation",
"datetime": "2025-10-30T10:00:00Z",
"duration": 30
}'
# Prescribe medication
do healthcare.prescribe Medication '{
"patientId": "patient-123",
"medication": "Lisinopril 10mg",
"dosage": "once daily",
"duration": "30 days",
"refills": 3
}'
# Process insurance claim
do healthcare.process Claim '{
"patientId": "patient-123",
"serviceDate": "2025-10-25",
"provider": "doctor-456",
"amount": 250,
"insuranceId": "ins-789"
}'Education
# Enroll student
do education.enroll Student '{
"studentId": "student-123",
"courseId": "course-456",
"semester": "Fall 2025"
}'
# Submit assignment
do education.submit Assignment '{
"studentId": "student-123",
"assignmentId": "assign-789",
"submission": {
"type": "file",
"url": "s3://submissions/essay.pdf"
}
}'
# Grade assignment
do education.grade Assignment '{
"assignmentId": "assign-789",
"studentId": "student-123",
"score": 95,
"feedback": "Excellent work!"
}'Logistics
# Schedule delivery
do logistics.schedule Delivery '{
"orderId": "order-123",
"destination": {
"address": "789 Elm St, City, ST 12345",
"contact": "John Doe",
"phone": "+1-555-0123"
},
"window": {
"start": "2025-10-28T09:00:00Z",
"end": "2025-10-28T17:00:00Z"
},
"carrier": "ups"
}'
# Track shipment
do logistics.track Shipment '{
"trackingNumber": "1Z999AA10123456784"
}'
# Update delivery status
do logistics.update Delivery '{
"deliveryId": "delivery-456",
"status": "delivered",
"proof": {
"signature": "signature-url",
"photo": "photo-url",
"timestamp": "2025-10-28T14:30:00Z"
}
}'SDK Equivalents
Every CLI command maps directly to SDK calls:
# CLI
do commerce.sell Car '{"vin": "123", "price": 50000}'// SDK
await $.Commerce.sells.Car({
vin: '123',
price: 50000,
})# CLI
do intelligence.analyze Data '{"dataset": "sales-2025"}'// SDK
await $.Intelligence.analyzes.Data({
dataset: 'sales-2025',
})Use Cases
✅ Use Verb-Based Patterns When:
- Executing a specific action NOW
- Transaction-based operations
- Workflow orchestration
- Event-driven processing
- One-time operations
- Action chaining
- Batch processing
❌ Don't Use When:
- Building a system with persistent state → Use noun-based patterns
- Read-only transformations → Use view-based patterns
- Deploying autonomous agents → Use agent-based patterns
Output Formats
# JSON output
do commerce.sell Car '{...}' --json
# Pretty JSON
do commerce.sell Car '{...}' --json --pretty
# Streaming output
do intelligence.analyze Data '{...}' --stream
# Quiet mode (success/failure only)
do commerce.sell Car '{...}' --quiet
# Verbose mode
do commerce.sell Car '{...}' --verboseError Handling
# Retry on failure
do commerce.sell Car '{...}' --retry 3 --retry-delay 1000
# Timeout
do intelligence.analyze Data '{...}' --timeout 30000
# Fallback action
do commerce.sell Car '{...}' --fallback 'notifications.send FailureAlert'
# Error output
do commerce.sell Car '{...}' 2> errors.logAdvanced Features
Idempotency
# Idempotent execution (safe to retry)
do commerce.sell Car '{...}' --idempotency-key "sale-car-vin-123-20251025"
# Check if already executed
do commerce.check Execution --idempotency-key "sale-car-vin-123-20251025"Tracing
# With trace ID
do commerce.sell Car '{...}' --trace-id "trace-abc-123"
# Generate trace
TRACE_ID=$(do trace.generate)
do commerce.sell Car '{...}' --trace-id $TRACE_ID
do finance.process Payment '{...}' --trace-id $TRACE_ID
# View trace
do trace.view $TRACE_IDRate Limiting
# With rate limit
do marketing.send Email '{...}' --rate-limit 100/hour
# Burst operations
do commerce.process Orders --batch 1000 --rate-limit 50/secondRelated Patterns
- Noun-Based Patterns - Build persistent service systems
- View-Based Patterns - Transform data representations
- Agent-Based Patterns - Deploy autonomous action executors