agents-united 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +673 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +4789 -0
- package/dist/cli.js.map +1 -0
- package/package.json +77 -0
- package/registry/agents/orchestrator-business.md +188 -0
- package/registry/agents/orchestrator-design.md +168 -0
- package/registry/agents/orchestrator-engineering.md +183 -0
- package/registry/agents/orchestrator-marketing.md +228 -0
- package/registry/agents/orchestrator-research.md +196 -0
- package/registry/agents/orchestrator-security.md +190 -0
- package/registry/agents/orchestrator-system-architecture.md +171 -0
- package/registry/agents/orchestrator-universal.md +168 -0
- package/registry/agents/subagent-accessibility-lead.md +47 -0
- package/registry/agents/subagent-ai-model-architect.md +97 -0
- package/registry/agents/subagent-android-architect.md +47 -0
- package/registry/agents/subagent-appsec-penetration-tester.md +189 -0
- package/registry/agents/subagent-backend-architect.md +360 -0
- package/registry/agents/subagent-business-panel-experts.md +126 -0
- package/registry/agents/subagent-cloud-infrastructure-architect.md +126 -0
- package/registry/agents/subagent-cloud-security-architect.md +221 -0
- package/registry/agents/subagent-code-reviewer.md +193 -0
- package/registry/agents/subagent-compliance-grc-specialist.md +147 -0
- package/registry/agents/subagent-cross-platform-specialist.md +47 -0
- package/registry/agents/subagent-data-engineer.md +46 -0
- package/registry/agents/subagent-database-administrator.md +141 -0
- package/registry/agents/subagent-deep-research.md +94 -0
- package/registry/agents/subagent-design-ops-lead.md +121 -0
- package/registry/agents/subagent-design-researcher.md +133 -0
- package/registry/agents/subagent-design-systems-architect.md +134 -0
- package/registry/agents/subagent-designer-toolkit-expert.md +363 -0
- package/registry/agents/subagent-devops-engineer.md +423 -0
- package/registry/agents/subagent-distributed-systems-architect.md +47 -0
- package/registry/agents/subagent-e2e-tester.md +60 -0
- package/registry/agents/subagent-financial-analyst.md +119 -0
- package/registry/agents/subagent-finops-cost-engineer.md +98 -0
- package/registry/agents/subagent-frontend-architect.md +368 -0
- package/registry/agents/subagent-interaction-designer.md +302 -0
- package/registry/agents/subagent-ios-architect.md +46 -0
- package/registry/agents/subagent-legal-contract-analyst.md +108 -0
- package/registry/agents/subagent-lifecycle-email-specialist.md +46 -0
- package/registry/agents/subagent-literature-patent-analyst.md +78 -0
- package/registry/agents/subagent-market-intelligence-analyst.md +110 -0
- package/registry/agents/subagent-marketing-campaign-specialist.md +80 -0
- package/registry/agents/subagent-marketing-content-strategist.md +184 -0
- package/registry/agents/subagent-marketing-conversion-specialist.md +79 -0
- package/registry/agents/subagent-marketing-creative-designer.md +93 -0
- package/registry/agents/subagent-marketing-growth-strategist.md +137 -0
- package/registry/agents/subagent-ml-platform-engineer.md +95 -0
- package/registry/agents/subagent-operations-strategist.md +85 -0
- package/registry/agents/subagent-paid-acquisition-specialist.md +47 -0
- package/registry/agents/subagent-plg-strategist.md +46 -0
- package/registry/agents/subagent-prototype-tester.md +140 -0
- package/registry/agents/subagent-qa-automation-lead.md +63 -0
- package/registry/agents/subagent-repo-index.md +180 -0
- package/registry/agents/subagent-security-engineer.md +134 -0
- package/registry/agents/subagent-seo-specialist.md +46 -0
- package/registry/agents/subagent-socratic-mentor.md +105 -0
- package/registry/agents/subagent-statistical-analyst.md +132 -0
- package/registry/agents/subagent-sysops-sre-lead.md +84 -0
- package/registry/agents/subagent-system-architect.md +122 -0
- package/registry/agents/subagent-ui-designer.md +149 -0
- package/registry/agents/subagent-ux-strategist.md +88 -0
- package/registry/bundles.json +1386 -0
- package/registry/rules/AGENTS.md +41 -0
- package/registry/rules/CLAUDE.md +12 -0
- package/registry/rules/CURSOR.md +12 -0
- package/registry/rules/GEMINI.md +41 -0
- package/registry/rules/clean-code-and-architecture.md +25 -0
- package/registry/rules/domain-modeling-and-adr.md +27 -0
- package/registry/rules/git-guardrails.md +19 -0
- package/registry/rules/multi-agent-coordination.md +33 -0
- package/registry/rules/quality-aesthetics-accessibility.md +29 -0
- package/registry/rules/skill-attribution.md +27 -0
- package/registry/rules/test-driven-development.md +41 -0
- package/registry/skills/ab-test-setup/SKILL.md +150 -0
- package/registry/skills/accessibility-audit/SKILL.md +150 -0
- package/registry/skills/ad-attribution-modeling/SKILL.md +206 -0
- package/registry/skills/ad-creative-design/SKILL.md +27 -0
- package/registry/skills/ai-prototype-refactoring/SKILL.md +29 -0
- package/registry/skills/architecture-design/SKILL.md +141 -0
- package/registry/skills/azure-infrastructure-bicep/SKILL.md +28 -0
- package/registry/skills/backend-api-design/SKILL.md +151 -0
- package/registry/skills/chaos-engineering/SKILL.md +41 -0
- package/registry/skills/churn-prevention-playbook/SKILL.md +181 -0
- package/registry/skills/ci-cd-pipeline-automation/SKILL.md +40 -0
- package/registry/skills/clickable-prototype-spec/SKILL.md +150 -0
- package/registry/skills/code-refactoring/SKILL.md +135 -0
- package/registry/skills/component-library-management/SKILL.md +150 -0
- package/registry/skills/component-playground-setup/SKILL.md +150 -0
- package/registry/skills/content-calendar-strategy/SKILL.md +150 -0
- package/registry/skills/conversion-funnel-optimization/SKILL.md +150 -0
- package/registry/skills/copywriting-frameworks/SKILL.md +150 -0
- package/registry/skills/database-design/SKILL.md +135 -0
- package/registry/skills/dependency-management/SKILL.md +142 -0
- package/registry/skills/design-handoff-spec/SKILL.md +150 -0
- package/registry/skills/design-ops-workflow/SKILL.md +150 -0
- package/registry/skills/design-system-governance/SKILL.md +150 -0
- package/registry/skills/design-system-tokens/SKILL.md +150 -0
- package/registry/skills/design-tokens-management/SKILL.md +150 -0
- package/registry/skills/design-version-control/SKILL.md +150 -0
- package/registry/skills/diagnosing-bugs/SKILL.md +45 -0
- package/registry/skills/docker-deployment/SKILL.md +144 -0
- package/registry/skills/domain-modeling/SKILL.md +52 -0
- package/registry/skills/email-drip-sequences/SKILL.md +181 -0
- package/registry/skills/email-marketing-automation/SKILL.md +150 -0
- package/registry/skills/finishing-a-development-branch/SKILL.md +132 -0
- package/registry/skills/frontend-component-design/SKILL.md +153 -0
- package/registry/skills/git-guardrails/SKILL.md +41 -0
- package/registry/skills/google-ads-optimization/SKILL.md +27 -0
- package/registry/skills/graphql-schema-design/SKILL.md +146 -0
- package/registry/skills/grill-me/SKILL.md +57 -0
- package/registry/skills/grill-with-docs/SKILL.md +84 -0
- package/registry/skills/growth-experiment-design/SKILL.md +150 -0
- package/registry/skills/handoff/SKILL.md +44 -0
- package/registry/skills/hf-model-evaluation/SKILL.md +84 -0
- package/registry/skills/interaction-pattern-library/SKILL.md +150 -0
- package/registry/skills/interactive-prototype-builder/SKILL.md +157 -0
- package/registry/skills/local-llm-inference/SKILL.md +77 -0
- package/registry/skills/maestro-mobile-testing/SKILL.md +40 -0
- package/registry/skills/marketing-creative-design/SKILL.md +186 -0
- package/registry/skills/mcp-setup/SKILL.md +370 -0
- package/registry/skills/meta-ad-creative-testing/SKILL.md +26 -0
- package/registry/skills/micro-interaction-design/SKILL.md +150 -0
- package/registry/skills/microservices-architecture/SKILL.md +141 -0
- package/registry/skills/mobile-android-design/SKILL.md +40 -0
- package/registry/skills/mobile-first-design/SKILL.md +150 -0
- package/registry/skills/mobile-ios-design/SKILL.md +40 -0
- package/registry/skills/mobile-platform-offline-validate/SKILL.md +41 -0
- package/registry/skills/modal-serverless-python/SKILL.md +81 -0
- package/registry/skills/onboarding-cro/SKILL.md +185 -0
- package/registry/skills/paid-acquisition-ppc/SKILL.md +171 -0
- package/registry/skills/performance-optimization/SKILL.md +141 -0
- package/registry/skills/playwright-best-practices/SKILL.md +39 -0
- package/registry/skills/product-launch-playbook/SKILL.md +150 -0
- package/registry/skills/programmatic-seo/SKILL.md +213 -0
- package/registry/skills/rag-vector-pipeline/SKILL.md +84 -0
- package/registry/skills/react-best-practices/SKILL.md +40 -0
- package/registry/skills/receiving-code-review/SKILL.md +130 -0
- package/registry/skills/replicate-model-inference/SKILL.md +76 -0
- package/registry/skills/requesting-code-review/SKILL.md +137 -0
- package/registry/skills/responsive-design-audit/SKILL.md +150 -0
- package/registry/skills/runpod-gpu-orchestration/SKILL.md +85 -0
- package/registry/skills/schema-markup-strategy/SKILL.md +194 -0
- package/registry/skills/security-audit/SKILL.md +139 -0
- package/registry/skills/seo-audit/SKILL.md +150 -0
- package/registry/skills/signup-flow-cro/SKILL.md +150 -0
- package/registry/skills/social-media-campaign/SKILL.md +150 -0
- package/registry/skills/state-driven-ui-animation/SKILL.md +150 -0
- package/registry/skills/subagent-driven-development/SKILL.md +135 -0
- package/registry/skills/supabase-backend-architecture/SKILL.md +28 -0
- package/registry/skills/systematic-debugging/SKILL.md +138 -0
- package/registry/skills/technical-documentation/SKILL.md +136 -0
- package/registry/skills/technical-seo-audit/SKILL.md +27 -0
- package/registry/skills/telemetry-monitoring/SKILL.md +40 -0
- package/registry/skills/test-driven-development/SKILL.md +135 -0
- package/registry/skills/to-spec/SKILL.md +48 -0
- package/registry/skills/to-tickets/SKILL.md +47 -0
- package/registry/skills/turso-distributed-sqlite/SKILL.md +27 -0
- package/registry/skills/ui-component-spec/SKILL.md +150 -0
- package/registry/skills/usability-testing-protocol/SKILL.md +150 -0
- package/registry/skills/user-flow-mapping/SKILL.md +150 -0
- package/registry/skills/user-journey-mapping/SKILL.md +150 -0
- package/registry/skills/vector-database-design/SKILL.md +84 -0
- package/registry/skills/vercel-deploy-best-practices/SKILL.md +28 -0
- package/registry/skills/viral-referral-loops/SKILL.md +209 -0
- package/registry/workflows/workflow-agency-ad-creative-sprint.md +50 -0
- package/registry/workflows/workflow-agency-brand-design-system.md +50 -0
- package/registry/workflows/workflow-agency-client-pitch-proposal.md +50 -0
- package/registry/workflows/workflow-agency-cro-funnel-teardown.md +50 -0
- package/registry/workflows/workflow-agency-full-campaign.md +58 -0
- package/registry/workflows/workflow-agency-seo-content-engine.md +50 -0
- package/registry/workflows/workflow-analyze.md +60 -0
- package/registry/workflows/workflow-api-contract-design.md +48 -0
- package/registry/workflows/workflow-app-store-release.md +48 -0
- package/registry/workflows/workflow-brainstorm.md +60 -0
- package/registry/workflows/workflow-build.md +60 -0
- package/registry/workflows/workflow-business-panel.md +60 -0
- package/registry/workflows/workflow-cleanup.md +60 -0
- package/registry/workflows/workflow-deploy-staging.md +49 -0
- package/registry/workflows/workflow-design-code.md +60 -0
- package/registry/workflows/workflow-design-ops--handoff.md +60 -0
- package/registry/workflows/workflow-design-ops--plan-sprint.md +60 -0
- package/registry/workflows/workflow-design-ops--setup-workflow.md +60 -0
- package/registry/workflows/workflow-design-orchestrate.md +60 -0
- package/registry/workflows/workflow-design-systems--audit-system.md +60 -0
- package/registry/workflows/workflow-design-systems--create-component.md +60 -0
- package/registry/workflows/workflow-design-systems--tokenize.md +60 -0
- package/registry/workflows/workflow-diagnose.md +45 -0
- package/registry/workflows/workflow-e2e-testing.md +49 -0
- package/registry/workflows/workflow-email-drip-sequence.md +65 -0
- package/registry/workflows/workflow-estimate.md +60 -0
- package/registry/workflows/workflow-explain.md +60 -0
- package/registry/workflows/workflow-frontend-audit.md +49 -0
- package/registry/workflows/workflow-git.md +60 -0
- package/registry/workflows/workflow-grill.md +51 -0
- package/registry/workflows/workflow-implement.md +61 -0
- package/registry/workflows/workflow-incident-triage.md +49 -0
- package/registry/workflows/workflow-interaction-design--design-interaction.md +60 -0
- package/registry/workflows/workflow-interaction-design--error-flow.md +60 -0
- package/registry/workflows/workflow-interaction-design--map-states.md +60 -0
- package/registry/workflows/workflow-marketing-audit.md +60 -0
- package/registry/workflows/workflow-marketing-campaign-builder.md +60 -0
- package/registry/workflows/workflow-marketing-content-pipeline.md +60 -0
- package/registry/workflows/workflow-marketing-growth-experiment.md +60 -0
- package/registry/workflows/workflow-marketing-launch.md +60 -0
- package/registry/workflows/workflow-marketing-panel.md +60 -0
- package/registry/workflows/workflow-ml-eval.md +51 -0
- package/registry/workflows/workflow-mobile-build.md +49 -0
- package/registry/workflows/workflow-onboarding-funnel-cro.md +65 -0
- package/registry/workflows/workflow-paid-acquisition-campaign.md +65 -0
- package/registry/workflows/workflow-paid-campaign-launch.md +47 -0
- package/registry/workflows/workflow-plan.md +60 -0
- package/registry/workflows/workflow-prototyping-testing--evaluate.md +60 -0
- package/registry/workflows/workflow-prototyping-testing--experiment.md +60 -0
- package/registry/workflows/workflow-prototyping-testing--prototype-plan.md +60 -0
- package/registry/workflows/workflow-prototyping-testing--test-plan.md +60 -0
- package/registry/workflows/workflow-rag-pipeline-deploy.md +53 -0
- package/registry/workflows/workflow-recommend.md +60 -0
- package/registry/workflows/workflow-research.md +60 -0
- package/registry/workflows/workflow-review.md +60 -0
- package/registry/workflows/workflow-seo-audit-pipeline.md +47 -0
- package/registry/workflows/workflow-seo-content-pipeline.md +65 -0
- package/registry/workflows/workflow-serverless-gpu-deploy.md +52 -0
- package/registry/workflows/workflow-spec-panel.md +60 -0
- package/registry/workflows/workflow-spec.md +44 -0
- package/registry/workflows/workflow-test.md +60 -0
- package/registry/workflows/workflow-troubleshoot.md +60 -0
- package/registry/workflows/workflow-ui-design--color-palette.md +60 -0
- package/registry/workflows/workflow-ui-design--design-screen.md +60 -0
- package/registry/workflows/workflow-ui-design--responsive-audit.md +60 -0
- package/registry/workflows/workflow-ui-design--type-system.md +60 -0
- package/registry/workflows/workflow-ux-strategy--benchmark.md +60 -0
- package/registry/workflows/workflow-ux-strategy--frame-problem.md +60 -0
- package/registry/workflows/workflow-ux-strategy--strategize.md +60 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ad-attribution-modeling
|
|
3
|
+
description: Production-grade Ad Attribution Modeling playbook for multi-touch
|
|
4
|
+
attribution (MTA), ROAS/CAC calculation, marketing mix modeling (MMM), and
|
|
5
|
+
Server-to-Server Conversions API integration.
|
|
6
|
+
metadata:
|
|
7
|
+
author: agents-united
|
|
8
|
+
version: 2.0.0
|
|
9
|
+
icon: 🎯
|
|
10
|
+
disable-slash-command: true
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Multi-Touch Ad Attribution Modeling & ROAS/CAC Analytics Engine
|
|
14
|
+
|
|
15
|
+
## Overview & Purpose
|
|
16
|
+
The Ad Attribution Modeling skill provides a mathematical and technical framework for calculating marketing ROI across multi-touch buyer journeys.
|
|
17
|
+
|
|
18
|
+
Following this skill implements Multi-Touch Attribution models (First-Touch, Last-Touch, Linear, U-Shaped, W-Shaped, Data-Driven/Algorithmic), Server-to-Server Conversions API pipelines (Meta CAPI, Google Enhanced Conversions) to bypass browser ad-blockers, and Blended vs. Paid CAC reconciliation across cohort payback windows.
|
|
19
|
+
|
|
20
|
+
## Execution Triggers & Prerequisites
|
|
21
|
+
### Execution Triggers
|
|
22
|
+
- Resolving attribution discrepancies between Google Ads, Meta Ads, and Stripe/CRM revenue.
|
|
23
|
+
- Deploying Server-Side Conversions API (CAPI) to combat iOS ATT tracking signal loss.
|
|
24
|
+
- Evaluating channel efficiency across complex multi-channel buyer touchpoints.
|
|
25
|
+
- Calculating cohort-level customer acquisition payback periods and LTV:CAC ratios.
|
|
26
|
+
|
|
27
|
+
### Prerequisites
|
|
28
|
+
- Event telemetry pipeline (Segment, RudderStack, PostHog, or custom event stream).
|
|
29
|
+
- Server-side ad platform credentials (Meta Pixel Access Token, Google Conversion API tokens).
|
|
30
|
+
- Transaction ledger or billing database access (Stripe API, PostgreSQL orders table).
|
|
31
|
+
- Clean git working directory.
|
|
32
|
+
|
|
33
|
+
## Input & Output Requirements
|
|
34
|
+
### Inputs
|
|
35
|
+
| Parameter | Type | Required | Description |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| `touchpoint_events` | Array<Object> | Yes | Stream of user interaction events with UTM parameters |
|
|
38
|
+
| `conversion_events` | Array<Object> | Yes | Completed purchase/signup events with revenue value |
|
|
39
|
+
| `channel_ad_spend` | Object | Yes | Cost breakdown by channel for the observation period |
|
|
40
|
+
| `attribution_model` | String | Optional | Model: `first_touch`, `last_touch`, `linear`, `u_shaped`, `w_shaped` |
|
|
41
|
+
| `lookback_window_days`| Number | Optional | Attribution lookback window in days (default: 30) |
|
|
42
|
+
|
|
43
|
+
### Outputs
|
|
44
|
+
| Artifact | Path / Format | Description |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Attribution Spec Document | `docs/ad-attribution-modeling/attribution-spec.md` | Model formulas, lookback definitions, CAPI specs |
|
|
47
|
+
| Attribution Engine Module | `src/analytics/attribution-engine.ts` | Multi-touch weighting and calculations |
|
|
48
|
+
| Server CAPI Dispatcher | `src/analytics/server-capi-dispatcher.ts` | Server-to-server conversion event sender |
|
|
49
|
+
| Channel ROAS Report | `reports/ad-attribution-modeling/roas-summary.json` | Attribution weights, ROAS, and CAC by channel |
|
|
50
|
+
|
|
51
|
+
## Step-by-Step Execution Runbook
|
|
52
|
+
|
|
53
|
+
### Phase 1: Touchpoint Event Telemetry & Server-Side Ingestion Setup
|
|
54
|
+
1. Ingest raw customer session touchpoint streams (First Visit, Organic Search, Paid Click, Newsletter Open, Trial Signup, Purchase).
|
|
55
|
+
2. Standardize touchpoint schemas: extract `userId`, `anonymousId`, `timestamp`, `channel`, `campaign`, `adId`, `landingPage`.
|
|
56
|
+
3. Filter out bot traffic, internal testing IP addresses, and invalid referrers.
|
|
57
|
+
4. Persist touchpoint history in structured analytical storage keyed by resolved customer identity.
|
|
58
|
+
|
|
59
|
+
### Phase 2: Attribution Model Algorithm Selection & Weight Formulation
|
|
60
|
+
1. Formulate mathematical weight distribution algorithms:
|
|
61
|
+
- **First-Touch**: 100% weight to initial discovery channel.
|
|
62
|
+
- **Last-Touch**: 100% weight to final pre-conversion interaction.
|
|
63
|
+
- **Linear**: Equal distribution across all $N$ touchpoints ($1/N$).
|
|
64
|
+
- **U-Shaped**: 40% First-Touch, 40% Lead Creation Touch, 20% split across intermediate touches.
|
|
65
|
+
- **W-Shaped**: 30% First-Touch, 30% Lead Creation, 30% Opportunity Creation, 10% intermediate touches.
|
|
66
|
+
2. Apply lookback window filtering (discard touchpoints older than 30 or 90 days before conversion).
|
|
67
|
+
|
|
68
|
+
### Phase 3: Multi-Touch Conversion Path Calculation & Blended Metric Synthesis
|
|
69
|
+
1. Execute multi-touch weighting calculations across all cohort conversion paths.
|
|
70
|
+
2. Aggregate attributed revenue per channel: $\text{Attributed Revenue} = \sum (\text{Order Value} \times \text{Touchpoint Weight})$.
|
|
71
|
+
3. Compute channel-specific ROAS: $\text{ROAS} = \text{Attributed Revenue} / \text{Channel Ad Spend}$.
|
|
72
|
+
4. Compute Blended CAC vs Paid CAC:
|
|
73
|
+
- $\text{Blended CAC} = \text{Total Marketing Spend} / \text{Total New Customers}$
|
|
74
|
+
- $\text{Paid CAC} = \text{Paid Ad Spend} / \text{Paid Attributed Customers}$
|
|
75
|
+
|
|
76
|
+
### Phase 4: Server-to-Server Conversions API (CAPI) Pipeline Deployment
|
|
77
|
+
1. Implement server-side dispatch worker capturing server-verified conversions (e.g. Stripe checkout completed).
|
|
78
|
+
2. Hash customer PII identifiers (email, phone, name) using SHA-256 before transmission.
|
|
79
|
+
3. Attach shared `event_id` and browser `fbp`/`fbc` cookies to enable ad platform deduplication with client pixels.
|
|
80
|
+
4. Dispatch payload to Meta Conversions API and Google Ads Enhanced Conversions endpoints.
|
|
81
|
+
|
|
82
|
+
### Phase 5: Cohort LTV/CAC Payback Window Auditing & Executive Reporting
|
|
83
|
+
1. Calculate cohort payback period: $\text{Payback Months} = \text{CAC} / (\text{ARPU} \times \text{Gross Margin \%})$.
|
|
84
|
+
2. Generate executive attribution summary report at `reports/ad-attribution-modeling/roas-summary.json`.
|
|
85
|
+
3. Highlight underperforming channels where CAC exceeds LTV / 3 payback threshold.
|
|
86
|
+
4. Commit attribution analytics engine to repository.
|
|
87
|
+
```bash
|
|
88
|
+
git add src/analytics/ docs/ad-attribution-modeling/
|
|
89
|
+
git commit -m "feat(ad-attribution-modeling): implement multi-touch attribution and server CAPI engine"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Code & Configuration Exemplars
|
|
93
|
+
|
|
94
|
+
### Exemplar 1: TypeScript Multi-Touch Attribution Engine
|
|
95
|
+
```typescript
|
|
96
|
+
export interface Touchpoint {
|
|
97
|
+
channel: string;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type AttributionModel = 'first_touch' | 'last_touch' | 'linear' | 'u_shaped';
|
|
102
|
+
|
|
103
|
+
export function calculateAttributedWeights(
|
|
104
|
+
touchpoints: Touchpoint[],
|
|
105
|
+
model: AttributionModel
|
|
106
|
+
): Record<string, number> {
|
|
107
|
+
const result: Record<string, number> = {};
|
|
108
|
+
const n = touchpoints.length;
|
|
109
|
+
if (n === 0) return result;
|
|
110
|
+
|
|
111
|
+
touchpoints.forEach(t => { result[t.channel] = (result[t.channel] || 0); });
|
|
112
|
+
|
|
113
|
+
if (n === 1 || model === 'first_touch') {
|
|
114
|
+
result[touchpoints[0].channel] += 1.0;
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
if (model === 'last_touch') {
|
|
118
|
+
result[touchpoints[n - 1].channel] += 1.0;
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
if (model === 'linear') {
|
|
122
|
+
const weight = 1.0 / n;
|
|
123
|
+
touchpoints.forEach(t => { result[t.channel] += weight; });
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
if (model === 'u_shaped') {
|
|
127
|
+
if (n === 2) {
|
|
128
|
+
result[touchpoints[0].channel] += 0.5;
|
|
129
|
+
result[touchpoints[1].channel] += 0.5;
|
|
130
|
+
} else {
|
|
131
|
+
result[touchpoints[0].channel] += 0.4;
|
|
132
|
+
result[touchpoints[n - 1].channel] += 0.4;
|
|
133
|
+
const middleWeight = 0.2 / (n - 2);
|
|
134
|
+
for (let i = 1; i < n - 1; i++) {
|
|
135
|
+
result[touchpoints[i].channel] += middleWeight;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Exemplar 2: Server-Side Meta CAPI Conversion Dispatcher
|
|
145
|
+
```typescript
|
|
146
|
+
import crypto from 'node:crypto';
|
|
147
|
+
|
|
148
|
+
export interface CapiConversionPayload {
|
|
149
|
+
eventName: string;
|
|
150
|
+
eventId: string;
|
|
151
|
+
eventTime: number;
|
|
152
|
+
userEmail: string;
|
|
153
|
+
value: number;
|
|
154
|
+
currency: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function hashSha256(value: string): string {
|
|
158
|
+
return crypto.createHash('sha256').update(value.trim().toLowerCase()).digest('hex');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function formatMetaCapiPayload(payload: CapiConversionPayload, pixelId: string) {
|
|
162
|
+
return {
|
|
163
|
+
data: [
|
|
164
|
+
{
|
|
165
|
+
event_name: payload.eventName,
|
|
166
|
+
event_time: payload.eventTime,
|
|
167
|
+
event_id: payload.eventId,
|
|
168
|
+
user_data: {
|
|
169
|
+
em: [hashSha256(payload.userEmail)],
|
|
170
|
+
},
|
|
171
|
+
custom_data: {
|
|
172
|
+
currency: payload.currency,
|
|
173
|
+
value: payload.value,
|
|
174
|
+
},
|
|
175
|
+
action_source: 'website',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Edge Cases & Error Recovery Procedures
|
|
183
|
+
|
|
184
|
+
### Scenario A: Duplicate Conversion Reporting between Browser Pixel and Server CAPI
|
|
185
|
+
1. **Diagnosis**: Ad platform counts purchase event twice, inflating reported ROAS by 100%.
|
|
186
|
+
2. **Recovery Protocol**:
|
|
187
|
+
- Step 1: Verify `event_id` string parity between client-side pixel event and server-side CAPI payload.
|
|
188
|
+
- Step 2: Ensure timestamps on both dispatches are within platform deduplication window (under 48 hours).
|
|
189
|
+
- Step 3: Inspect Meta Events Manager deduplication diagnostics to confirm 100% deduplication rate.
|
|
190
|
+
|
|
191
|
+
### Scenario B: Orphaned Touchpoint Sessions Due to Cross-Domain Redirects
|
|
192
|
+
1. **Diagnosis**: UTM parameters lost when user redirects from marketing landing page to auth/checkout subdomain.
|
|
193
|
+
2. **Recovery Protocol**:
|
|
194
|
+
- Step 1: Implement first-party cookie persistence storing original UTM touchpoint for 30 days.
|
|
195
|
+
- Step 2: Append persistent anonymous session ID across cross-domain link anchors.
|
|
196
|
+
- Step 3: Re-stitch orphaned checkout sessions using server-side anonymous ID lookup.
|
|
197
|
+
|
|
198
|
+
## Verification & Validation Checklist
|
|
199
|
+
- [ ] Frontmatter conforms strictly to `author: "agents-united"` and `version: "2.0.0"`.
|
|
200
|
+
- [ ] All 7 mandatory sections present with explicit headers.
|
|
201
|
+
- [ ] Step-by-Step Execution Runbook body contains >= 50 lines.
|
|
202
|
+
- [ ] Multi-touch models (Linear, U-Shaped, W-Shaped) formulated with exact math.
|
|
203
|
+
- [ ] Server-Side CAPI integration with SHA-256 PII hashing detailed.
|
|
204
|
+
- [ ] Code exemplars provided with valid syntax fencing.
|
|
205
|
+
- [ ] Zero dummy placeholder strings or unpopulated template markers present.
|
|
206
|
+
- [ ] Project build, test suite, and doctor check pass 100% cleanly.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ad-creative-design
|
|
3
|
+
description: High-converting advertising visual layouts, social banner design
|
|
4
|
+
systems, aspect ratio formatting, and visual hook variations.
|
|
5
|
+
metadata:
|
|
6
|
+
author: Agents United Creative Team
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
license: MIT
|
|
9
|
+
icon: 🖼️
|
|
10
|
+
disable-slash-command: true
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Ad Creative Design Playbook
|
|
14
|
+
|
|
15
|
+
## Overview & Purpose
|
|
16
|
+
`ad-creative-design` provides standardized design frameworks and visual hierarchies for digital advertising campaigns across Meta, Google Display, LinkedIn, and X.
|
|
17
|
+
|
|
18
|
+
## Core Directives & Standards
|
|
19
|
+
1. **Visual Hierarchy** — Lead with a high-contrast visual hook (top 40% of viewport), followed by a 1-sentence value proposition, social proof badge, and an actionable CTA.
|
|
20
|
+
2. **Aspect Ratio Compliance** — Export designs in 1:1 (Feed/Square), 9:16 (Stories/Reels/Shorts), and 1.91:1 (Landscape/Feed).
|
|
21
|
+
3. **Contrast & Readability** — Maintain WCAG AA compliant text contrast against background gradients or imagery.
|
|
22
|
+
4. **Multi-Hook Variation** — Provide at least 3 distinct visual angle variations per campaign concept (Product Demo screenshot, Stat/Metric Callout, Minimalist Typography).
|
|
23
|
+
|
|
24
|
+
## Verification Checklist
|
|
25
|
+
- [ ] Visual elements scale cleanly across mobile screen viewports.
|
|
26
|
+
- [ ] Text covers less than 20% of ad image area to maximize ad delivery score.
|
|
27
|
+
- [ ] CTA button stands out with clear accent color contrast.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-prototype-refactoring
|
|
3
|
+
description: Refactoring rapid AI-generated prototypes from Lovable, v0, and
|
|
4
|
+
Bolt into production-ready modular React components, typed design tokens, and
|
|
5
|
+
clean architectures.
|
|
6
|
+
metadata:
|
|
7
|
+
author: Agents United Frontend Group
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
license: MIT
|
|
10
|
+
icon: 🧩
|
|
11
|
+
disable-slash-command: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# AI Prototype Refactoring Playbook (Lovable / v0 / Bolt)
|
|
15
|
+
|
|
16
|
+
## Overview & Purpose
|
|
17
|
+
`ai-prototype-refactoring` standardizes the ingestion and transformation of single-file AI prototype exports (from Lovable.dev, v0.dev, Bolt.new) into enterprise-grade modular React/TypeScript codebases.
|
|
18
|
+
|
|
19
|
+
## Core Directives & Standards
|
|
20
|
+
1. **Deconstruct Monolithic Files** — Break large 1000+ line single-file components into atomic design hierarchy (`atoms`, `molecules`, `organisms`, `layouts`).
|
|
21
|
+
2. **Strict TypeScript Typing** — Replace all inferred `any` and inline untyped JSON objects with formal TypeScript interfaces and Zod validation schemas.
|
|
22
|
+
3. **Design System Token Mapping** — Extract hardcoded arbitrary Tailwind classes (e.g. `bg-[#1a2b3c]`, `p-[17px]`) into semantic Tailwind configuration tokens (e.g. `bg-primary`, `p-4`).
|
|
23
|
+
4. **Interactive State & Hook Extraction** — Move inline messy `useState` spaghetti into custom hooks (`useCartState`, `useFilterParams`, `useAuthModal`).
|
|
24
|
+
5. **Accessibility (a11y) & Semantic HTML** — Replace unsemantic `div` click handlers with semantic `<button>`, `<nav>`, `<main>`, `<dialog>`, and accessible ARIA attributes.
|
|
25
|
+
|
|
26
|
+
## Verification Checklist
|
|
27
|
+
- [ ] Refactored components pass strict TypeScript compilation (`tsc --noEmit`).
|
|
28
|
+
- [ ] Unit and visual regression tests author for critical interaction flows.
|
|
29
|
+
- [ ] No hardcoded placeholder mock data remaining in production component code.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-design
|
|
3
|
+
description: Production-grade Architecture Design playbook for microservices,
|
|
4
|
+
event-driven backends, and C4 domain modeling.
|
|
5
|
+
metadata:
|
|
6
|
+
author: agents-united
|
|
7
|
+
version: 2.0.0
|
|
8
|
+
icon: 📐
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# System Architecture Design & ADR Management
|
|
12
|
+
|
|
13
|
+
## Overview & Purpose
|
|
14
|
+
The System Architecture Design & ADR Management skill provides a deterministic, battle-tested framework for executing architecture-design processes across the Agents United multi-agent ecosystem.
|
|
15
|
+
|
|
16
|
+
Following this skill ensures high quality, zero-regression execution, rigorous testing gates, and seamless cross-functional team alignment.
|
|
17
|
+
|
|
18
|
+
## Execution Triggers & Prerequisites
|
|
19
|
+
### Execution Triggers
|
|
20
|
+
- Direct request or workflow step invoking architecture-design.
|
|
21
|
+
- Auditing, implementing, or standardizing architecture-design procedures.
|
|
22
|
+
- Addressing technical debt, architectural reviews, or production readiness gates.
|
|
23
|
+
- Preparing pull requests or automated release validations.
|
|
24
|
+
|
|
25
|
+
### Prerequisites
|
|
26
|
+
- Active project repository workspace with version control configured.
|
|
27
|
+
- Operational testing, typechecking, and build toolchains.
|
|
28
|
+
- Domain requirements, architectural constraints, or user stories defined.
|
|
29
|
+
- Clean git working tree before beginning execution.
|
|
30
|
+
|
|
31
|
+
## Input & Output Requirements
|
|
32
|
+
### Inputs
|
|
33
|
+
| Parameter | Type | Required | Description |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| `target_scope` | String | Yes | Target module, service, component, or file path |
|
|
36
|
+
| `config` | Object | Optional | Specific domain configurations, thresholds, and options |
|
|
37
|
+
| `output_dir` | Directory Path | Optional | Destination directory for generated artifacts and reports |
|
|
38
|
+
| `strict_mode` | Boolean | Optional | Enforce strict zero-warning validation and high test coverage |
|
|
39
|
+
|
|
40
|
+
### Outputs
|
|
41
|
+
| Artifact | Path / Format | Description |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| Specification Document | `docs/architecture-design/spec.md` | Full technical specification and architectural plan |
|
|
44
|
+
| Implementation Files | `src/architecture-design/*` | Production-ready source code, tests, and configurations |
|
|
45
|
+
| Execution Report | `reports/architecture-design/summary.json` | Verification metrics, test results, and audit summary |
|
|
46
|
+
|
|
47
|
+
## Step-by-Step Execution Runbook
|
|
48
|
+
|
|
49
|
+
### Phase 1: Domain Decomposition & C4 Model Framing
|
|
50
|
+
1. Deconstruct system requirements into Context, Container, Component, and Code layers.
|
|
51
|
+
2. Define bounded contexts and domain aggregates to prevent leaky domain boundaries.
|
|
52
|
+
3. Chart synchronous vs asynchronous communication channels and latency budgets.
|
|
53
|
+
4. Identify stateful storage requirements and data partitioning strategies.
|
|
54
|
+
5. Draft high-level architecture diagram and component topology.
|
|
55
|
+
|
|
56
|
+
### Phase 2: Tradeoff Analysis & Non-Functional Requirements (NFRs)
|
|
57
|
+
1. Quantify SLA/SLO requirements: p99 latency (<150ms), availability (99.99%), throughput (10k rps).
|
|
58
|
+
2. Evaluate CAP theorem tradeoffs: Consistency vs Availability during network partitions.
|
|
59
|
+
3. Assess infrastructure cost implications across compute, bandwidth, and managed services.
|
|
60
|
+
4. Perform threat modeling (STRIDE) against network boundaries and data stores.
|
|
61
|
+
5. Document architectural alternatives considered and reasons for rejection.
|
|
62
|
+
|
|
63
|
+
### Phase 3: ADR Authoring & Interface Contract Definition
|
|
64
|
+
1. Author formal ADR in docs/adr/ADR-XXXX.md following MADR template standards.
|
|
65
|
+
2. Specify OpenAPI / gRPC Protobuf interface contracts for inter-service boundaries.
|
|
66
|
+
3. Define idempotency keys and retry policies for distributed operations.
|
|
67
|
+
4. Define failure domains, circuit breaker thresholds, and fallback degradations.
|
|
68
|
+
5. Submit ADR for peer review by security and system architecture teams.
|
|
69
|
+
|
|
70
|
+
### Phase 4: Architecture Validation & Prototyping Spike
|
|
71
|
+
1. Build minimal executable spike to validate performance and latency assumptions.
|
|
72
|
+
2. Verify distributed tracing propagation across boundary headers (TraceContext).
|
|
73
|
+
3. Run automated load testing against prototype endpoints using k6 or autocannon.
|
|
74
|
+
4. Validate disaster recovery and failover behavior under simulated node outages.
|
|
75
|
+
5. Review spike results against target SLO metrics.
|
|
76
|
+
|
|
77
|
+
### Phase 5: Governance & Downstream Implementation Handoff
|
|
78
|
+
1. Publish accepted ADR to repository architecture registry.
|
|
79
|
+
2. Generate service scaffold templates with pre-configured telemetry and lint rules.
|
|
80
|
+
3. Brief backend and infrastructure subagents on architectural constraints.
|
|
81
|
+
4. Create milestone tracking tickets linked directly to ADR acceptance criteria.
|
|
82
|
+
5. Establish quarterly architectural drift review cadence.
|
|
83
|
+
|
|
84
|
+
## Code & Configuration Exemplars
|
|
85
|
+
|
|
86
|
+
### Exemplar 1: System Architecture Design & ADR Management Configuration & Specification
|
|
87
|
+
```yaml
|
|
88
|
+
title: "ADR-004: Event-Driven Order Processing Architecture"
|
|
89
|
+
status: "accepted"
|
|
90
|
+
date: "2026-08-14"
|
|
91
|
+
deciders: ["System Architect", "Backend Lead"]
|
|
92
|
+
context: |
|
|
93
|
+
Synchronous REST calls between Checkout and Inventory services caused cascading latency spikes during peak loads.
|
|
94
|
+
decision: |
|
|
95
|
+
We will adopt an event-driven architecture using Apache Kafka with transactional outbox patterns.
|
|
96
|
+
consequences:
|
|
97
|
+
positive:
|
|
98
|
+
- Decouples checkout service latency from inventory processing.
|
|
99
|
+
- Guarantees at-least-once message delivery via transactional outbox.
|
|
100
|
+
negative:
|
|
101
|
+
- Eventual consistency requires asynchronous UI status polling.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Exemplar 2: System Architecture Design & ADR Management TypeScript Type Contract
|
|
105
|
+
```typescript
|
|
106
|
+
export interface ArchitectureDecisionRecord {
|
|
107
|
+
id: string;
|
|
108
|
+
title: string;
|
|
109
|
+
status: 'draft' | 'proposed' | 'accepted' | 'rejected' | 'deprecated';
|
|
110
|
+
context: string;
|
|
111
|
+
decision: string;
|
|
112
|
+
consequences: {
|
|
113
|
+
positive: string[];
|
|
114
|
+
negative: string[];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Edge Cases & Error Recovery Procedures
|
|
120
|
+
|
|
121
|
+
### Scenario A: Validation Failure in System Architecture Design & ADR Management
|
|
122
|
+
1. **Diagnosis**: Static analysis, typechecking, or unit tests fail validation rules during execution.
|
|
123
|
+
2. **Recovery Protocol**:
|
|
124
|
+
- Step 1: Inspect detailed error log output in test/build terminal.
|
|
125
|
+
- Step 2: Formulate targeted hypothesis and isolate failing line or assertion.
|
|
126
|
+
- Step 3: Implement surgical code fix and re-run verification suite.
|
|
127
|
+
|
|
128
|
+
### Scenario B: Missing or Incompatible Dependency
|
|
129
|
+
1. **Diagnosis**: Required toolchain binary or library dependency is missing from the environment.
|
|
130
|
+
2. **Recovery Protocol**:
|
|
131
|
+
- Step 1: Verify `package.json` engine requirements and local environment versions.
|
|
132
|
+
- Step 2: Install required peer dependencies cleanly with lockfile sync.
|
|
133
|
+
- Step 3: Resume runbook from Phase 1.
|
|
134
|
+
|
|
135
|
+
## Verification & Validation Checklist
|
|
136
|
+
- [ ] Frontmatter conforms strictly to `author: "agents-united"` and `version: "2.0.0"`.
|
|
137
|
+
- [ ] All 7 mandatory sections present with explicit headers.
|
|
138
|
+
- [ ] Step-by-Step Execution Runbook body contains >= 50 lines.
|
|
139
|
+
- [ ] Code exemplars provided with valid syntax fencing.
|
|
140
|
+
- [ ] Zero dummy placeholder strings or unpopulated template markers present.
|
|
141
|
+
- [ ] Project build, test suite, and doctor check pass 100% cleanly.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: azure-infrastructure-bicep
|
|
3
|
+
description: Enterprise cloud infrastructure automation on Microsoft Azure using
|
|
4
|
+
Bicep IaC, Azure Container Apps, AKS, Azure OpenAI services, and Managed
|
|
5
|
+
Identities.
|
|
6
|
+
metadata:
|
|
7
|
+
author: Agents United DevOps Group
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
license: MIT
|
|
10
|
+
icon: ☁️
|
|
11
|
+
disable-slash-command: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Azure Infrastructure with Bicep Playbook
|
|
15
|
+
|
|
16
|
+
## Overview & Purpose
|
|
17
|
+
`azure-infrastructure-bicep` defines cloud architecture standards and Infrastructure-as-Code (IaC) templates for deploying scalable applications on Microsoft Azure.
|
|
18
|
+
|
|
19
|
+
## Core Directives & Standards
|
|
20
|
+
1. **Modular Bicep Templates** — Organize IaC into reusable Bicep modules (`modules/containerApp.bicep`, `modules/keyVault.bicep`, `modules/openAI.bicep`) with strict parameter typing.
|
|
21
|
+
2. **Passwordless Managed Identities** — Use Azure System-Assigned or User-Assigned Managed Identities and Azure RBAC instead of hardcoded connection strings or access keys.
|
|
22
|
+
3. **Azure Container Apps (ACA) Microservices** — Deploy containerized workloads with KEDA auto-scaling (HTTP traffic and queue depth scaling) and Dapr sidecars.
|
|
23
|
+
4. **Azure OpenAI Service Deployment** — Provision dedicated Azure OpenAI Cognitive Service accounts with private endpoints, virtual network integration, and rate-limit monitoring.
|
|
24
|
+
5. **Azure Key Vault Integration** — Store all application secrets in Key Vault and inject them into container environments via Key Vault secret references.
|
|
25
|
+
|
|
26
|
+
## Verification Checklist
|
|
27
|
+
- [ ] Bicep templates pass `az bicep build` and `az deployment group what-if` dry-run validations.
|
|
28
|
+
- [ ] Public network access disabled on storage accounts and databases (private endpoints enforced).
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backend-api-design
|
|
3
|
+
description: Production-grade Backend API Design playbook for RESTful, gRPC, and
|
|
4
|
+
GraphQL enterprise architectures.
|
|
5
|
+
metadata:
|
|
6
|
+
author: agents-united
|
|
7
|
+
version: 2.0.0
|
|
8
|
+
icon: 🔌
|
|
9
|
+
disable-slash-command: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Backend API Design & Contract Specification
|
|
13
|
+
|
|
14
|
+
## Overview & Purpose
|
|
15
|
+
The Backend API Design & Contract Specification skill provides a deterministic, battle-tested framework for executing backend-api-design processes across the Agents United multi-agent ecosystem.
|
|
16
|
+
|
|
17
|
+
Following this skill ensures high quality, zero-regression execution, rigorous testing gates, and seamless cross-functional team alignment.
|
|
18
|
+
|
|
19
|
+
## Execution Triggers & Prerequisites
|
|
20
|
+
### Execution Triggers
|
|
21
|
+
- Direct request or workflow step invoking backend-api-design.
|
|
22
|
+
- Auditing, implementing, or standardizing backend-api-design procedures.
|
|
23
|
+
- Addressing technical debt, architectural reviews, or production readiness gates.
|
|
24
|
+
- Preparing pull requests or automated release validations.
|
|
25
|
+
|
|
26
|
+
### Prerequisites
|
|
27
|
+
- Active project repository workspace with version control configured.
|
|
28
|
+
- Operational testing, typechecking, and build toolchains.
|
|
29
|
+
- Domain requirements, architectural constraints, or user stories defined.
|
|
30
|
+
- Clean git working tree before beginning execution.
|
|
31
|
+
|
|
32
|
+
## Input & Output Requirements
|
|
33
|
+
### Inputs
|
|
34
|
+
| Parameter | Type | Required | Description |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| `target_scope` | String | Yes | Target module, service, component, or file path |
|
|
37
|
+
| `config` | Object | Optional | Specific domain configurations, thresholds, and options |
|
|
38
|
+
| `output_dir` | Directory Path | Optional | Destination directory for generated artifacts and reports |
|
|
39
|
+
| `strict_mode` | Boolean | Optional | Enforce strict zero-warning validation and high test coverage |
|
|
40
|
+
|
|
41
|
+
### Outputs
|
|
42
|
+
| Artifact | Path / Format | Description |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| Specification Document | `docs/backend-api-design/spec.md` | Full technical specification and architectural plan |
|
|
45
|
+
| Implementation Files | `src/backend-api-design/*` | Production-ready source code, tests, and configurations |
|
|
46
|
+
| Execution Report | `reports/backend-api-design/summary.json` | Verification metrics, test results, and audit summary |
|
|
47
|
+
|
|
48
|
+
## Step-by-Step Execution Runbook
|
|
49
|
+
|
|
50
|
+
### Phase 1: API Resource & Contract Modeling
|
|
51
|
+
1. Model domain resources with standard pluralized URI paths (/api/v2/resources).
|
|
52
|
+
2. Select communication protocol: RESTful JSON, gRPC Protobuf, or GraphQL based on payload needs.
|
|
53
|
+
3. Define HTTP verb semantics strictly: GET (idempotent/safe), POST (create), PUT (replace), PATCH (partial), DELETE.
|
|
54
|
+
4. Establish unified error response schema matching RFC 7807 Problem Details.
|
|
55
|
+
5. Design pagination schemas supporting cursor-based and offset-based navigation.
|
|
56
|
+
|
|
57
|
+
### Phase 2: Schema Validation & Security Hardening
|
|
58
|
+
1. Write strict JSON Schema / Zod runtime validation definitions for all input payloads.
|
|
59
|
+
2. Enforce Idempotency-Key headers for all non-idempotent financial/state transitions.
|
|
60
|
+
3. Configure rate-limiting policies (token bucket algorithm) by authenticated tenant.
|
|
61
|
+
4. Implement OAuth2 / JWT bearer token authentication and RBAC scope authorization checks.
|
|
62
|
+
5. Sanitize all headers and query parameters against injection attacks.
|
|
63
|
+
|
|
64
|
+
### Phase 3: Implementation & Middleware Pipeline Assembly
|
|
65
|
+
1. Assemble Express / Fastify / Koa middleware pipeline: CORS -> Tracing -> Auth -> BodyParser -> RateLimit.
|
|
66
|
+
2. Implement controller handlers with explicit separation between transport and service domains.
|
|
67
|
+
3. Implement database transactions with optimistic locking for concurrent updates.
|
|
68
|
+
4. Wire up structured JSON logging with CorrelationId injected on every log line.
|
|
69
|
+
5. Enforce strict error boundary middleware to prevent uncaught promise rejections.
|
|
70
|
+
|
|
71
|
+
### Phase 4: Automated Contract Testing & Mock Server Verification
|
|
72
|
+
1. Run contract tests validating OpenAPI specification against live responses (Prism/Dredd).
|
|
73
|
+
2. Execute end-to-end integration tests using Supertest or Vitest.
|
|
74
|
+
3. Verify error code compliance for 400, 401, 403, 404, 409, 422, 429, and 500 scenarios.
|
|
75
|
+
4. Benchmark p95 response time under concurrent simulated load.
|
|
76
|
+
5. Validate backward-compatibility against previous API versions.
|
|
77
|
+
|
|
78
|
+
### Phase 5: SDK Generation & Documentation Publication
|
|
79
|
+
1. Generate TypeScript / Python client SDKs from OpenAPI definitions via @openapitools/openapi-generator-cli.
|
|
80
|
+
2. Publish interactive Swagger / Redoc documentation endpoint.
|
|
81
|
+
3. Generate changelog highlighting added fields, deprecated routes, and breaking changes.
|
|
82
|
+
4. Commit updated API schemas to version control.
|
|
83
|
+
5. Tag production release candidate.
|
|
84
|
+
|
|
85
|
+
## Code & Configuration Exemplars
|
|
86
|
+
|
|
87
|
+
### Exemplar 1: Backend API Design & Contract Specification Configuration & Specification
|
|
88
|
+
```yaml
|
|
89
|
+
openapi: 3.1.0
|
|
90
|
+
info:
|
|
91
|
+
title: Enterprise Order Management API
|
|
92
|
+
version: 2.0.0
|
|
93
|
+
paths:
|
|
94
|
+
/api/v2/orders:
|
|
95
|
+
post:
|
|
96
|
+
summary: Create idempotent purchase order
|
|
97
|
+
parameters:
|
|
98
|
+
- in: header
|
|
99
|
+
name: Idempotency-Key
|
|
100
|
+
required: true
|
|
101
|
+
schema:
|
|
102
|
+
type: string
|
|
103
|
+
format: uuid
|
|
104
|
+
requestBody:
|
|
105
|
+
required: true
|
|
106
|
+
content:
|
|
107
|
+
application/json:
|
|
108
|
+
schema:
|
|
109
|
+
$ref: '#/components/schemas/CreateOrderRequest'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Exemplar 2: Backend API Design & Contract Specification TypeScript Type Contract
|
|
113
|
+
```typescript
|
|
114
|
+
export interface ApiResponse<T> {
|
|
115
|
+
success: boolean;
|
|
116
|
+
data?: T;
|
|
117
|
+
error?: {
|
|
118
|
+
code: string;
|
|
119
|
+
message: string;
|
|
120
|
+
details?: Record<string, unknown>;
|
|
121
|
+
};
|
|
122
|
+
metadata: {
|
|
123
|
+
requestId: string;
|
|
124
|
+
timestamp: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Edge Cases & Error Recovery Procedures
|
|
130
|
+
|
|
131
|
+
### Scenario A: Validation Failure in Backend API Design & Contract Specification
|
|
132
|
+
1. **Diagnosis**: Static analysis, typechecking, or unit tests fail validation rules during execution.
|
|
133
|
+
2. **Recovery Protocol**:
|
|
134
|
+
- Step 1: Inspect detailed error log output in test/build terminal.
|
|
135
|
+
- Step 2: Formulate targeted hypothesis and isolate failing line or assertion.
|
|
136
|
+
- Step 3: Implement surgical code fix and re-run verification suite.
|
|
137
|
+
|
|
138
|
+
### Scenario B: Missing or Incompatible Dependency
|
|
139
|
+
1. **Diagnosis**: Required toolchain binary or library dependency is missing from the environment.
|
|
140
|
+
2. **Recovery Protocol**:
|
|
141
|
+
- Step 1: Verify `package.json` engine requirements and local environment versions.
|
|
142
|
+
- Step 2: Install required peer dependencies cleanly with lockfile sync.
|
|
143
|
+
- Step 3: Resume runbook from Phase 1.
|
|
144
|
+
|
|
145
|
+
## Verification & Validation Checklist
|
|
146
|
+
- [ ] Frontmatter conforms strictly to `author: "agents-united"` and `version: "2.0.0"`.
|
|
147
|
+
- [ ] All 7 mandatory sections present with explicit headers.
|
|
148
|
+
- [ ] Step-by-Step Execution Runbook body contains >= 50 lines.
|
|
149
|
+
- [ ] Code exemplars provided with valid syntax fencing.
|
|
150
|
+
- [ ] Zero dummy placeholder strings or unpopulated template markers present.
|
|
151
|
+
- [ ] Project build, test suite, and doctor check pass 100% cleanly.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chaos-engineering
|
|
3
|
+
description: Chaos engineering methodology, fault injection, network latency
|
|
4
|
+
simulation, service degradation tests, and disaster recovery validation.
|
|
5
|
+
metadata:
|
|
6
|
+
author: Agents United Core Team
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
source: https://github.com/NeoAnthropocene/agents-united
|
|
9
|
+
icon: 💥
|
|
10
|
+
disable-slash-command: true
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Chaos Engineering & Fault Injection Playbook
|
|
14
|
+
|
|
15
|
+
## Overview & Purpose
|
|
16
|
+
`chaos-engineering` provides a structured methodology for injecting controlled failures into distributed services and frontend applications to prove resilience before production incidents occur.
|
|
17
|
+
|
|
18
|
+
## Rules & Constraints
|
|
19
|
+
1. **Define Steady State** — Measure baseline normal behavior (error rate < 0.05%, p99 latency < 200ms) before injecting chaos.
|
|
20
|
+
2. **Formulate Falsifiable Hypothesis** — Hypothesize that the system will continue functioning despite specific service or network outages.
|
|
21
|
+
3. **Minimize Blast Radius** — Run chaos experiments in staging or with scoped tenant canary headers before cluster-wide testing.
|
|
22
|
+
4. **Automated Abort Conditions** — Configure automated triggers that immediately halt the experiment if key business SLOs degrade beyond safety margins.
|
|
23
|
+
|
|
24
|
+
## Step-by-Step Execution Runbook
|
|
25
|
+
|
|
26
|
+
### Phase 1 — Experiment Design & Hypothesis
|
|
27
|
+
- Select chaos vector: Network latency (Toxiproxy), Database connection drop, Redis cache outage, or Pod termination.
|
|
28
|
+
- Establish baseline monitoring dashboards.
|
|
29
|
+
|
|
30
|
+
### Phase 2 — Fault Injection Execution
|
|
31
|
+
- Trigger the fault in a controlled staging environment.
|
|
32
|
+
- Observe circuit breaker tripping, fallback cache utilization, and error message rendering.
|
|
33
|
+
|
|
34
|
+
### Phase 3 — Analysis & Remediation
|
|
35
|
+
- Document whether the system gracefully degraded or suffered cascading failures.
|
|
36
|
+
- Implement necessary resilience patches (timeouts, retries with jitter, fallback defaults).
|
|
37
|
+
|
|
38
|
+
## Verification Checklist
|
|
39
|
+
- [ ] System gracefully handles injected faults without crashing.
|
|
40
|
+
- [ ] Fallback user experience displays helpful degraded state UI.
|
|
41
|
+
- [ ] Post-experiment system recovers to steady state automatically.
|