mindforge-cc 10.0.2 → 10.7.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/.mindforge/config.json +73 -2
- package/.mindforge/engine/autonomous/cross-iteration-bridge.md +96 -0
- package/.mindforge/engine/cost-tracking/budget-enforcer.md +68 -0
- package/.mindforge/engine/cost-tracking/router.md +58 -0
- package/.mindforge/engine/cost-tracking/token-ledger.md +77 -0
- package/.mindforge/engine/council/council-protocol.md +96 -0
- package/.mindforge/engine/council/council-templates.md +85 -0
- package/.mindforge/engine/council/synthesis-engine.md +71 -0
- package/.mindforge/engine/cross-model-eval.md +74 -0
- package/.mindforge/engine/instincts/capture-engine.md +63 -0
- package/.mindforge/engine/instincts/instinct-schema.md +76 -0
- package/.mindforge/engine/instincts/promotion-engine.md +77 -0
- package/.mindforge/engine/proactive/signal-detector.md +60 -0
- package/.mindforge/engine/proactive/suggestion-engine.md +100 -0
- package/.mindforge/engine/skills/composition.md +83 -0
- package/.mindforge/engine/skills/loader.md +16 -0
- package/.mindforge/personas/agent-architect.md +57 -0
- package/.mindforge/personas/agent-evaluator.md +162 -0
- package/.mindforge/personas/agent-memory-designer.md +157 -0
- package/.mindforge/personas/agent-ops-engineer.md +120 -0
- package/.mindforge/personas/agent-orchestrator.md +112 -0
- package/.mindforge/personas/ai-economist.md +57 -0
- package/.mindforge/personas/ai-safety-engineer.md +57 -0
- package/.mindforge/personas/analytics-engineer.md +57 -0
- package/.mindforge/personas/anti-pattern-hunter.md +61 -0
- package/.mindforge/personas/api-gateway-designer.md +132 -0
- package/.mindforge/personas/auth-engineer.md +112 -0
- package/.mindforge/personas/build-engineer.md +57 -0
- package/.mindforge/personas/business-analyst.md +56 -0
- package/.mindforge/personas/cache-architect.md +100 -0
- package/.mindforge/personas/causal-scientist.md +57 -0
- package/.mindforge/personas/cdn-architect.md +118 -0
- package/.mindforge/personas/change-agent.md +104 -0
- package/.mindforge/personas/code-narrator.md +52 -0
- package/.mindforge/personas/codegen-specialist.md +68 -0
- package/.mindforge/personas/communication-architect.md +102 -0
- package/.mindforge/personas/compliance-engineer.md +96 -0
- package/.mindforge/personas/consensus-engineer.md +116 -0
- package/.mindforge/personas/contract-tester.md +60 -192
- package/.mindforge/personas/cost-optimizer.md +71 -0
- package/.mindforge/personas/council-architect.md +66 -0
- package/.mindforge/personas/council-critic.md +67 -0
- package/.mindforge/personas/council-pragmatist.md +71 -0
- package/.mindforge/personas/council-skeptic.md +73 -0
- package/.mindforge/personas/data-architect.md +108 -0
- package/.mindforge/personas/data-mesh-architect.md +57 -0
- package/.mindforge/personas/data-pipeline-architect.md +120 -0
- package/.mindforge/personas/de-sloppifier.md +60 -0
- package/.mindforge/personas/debt-manager.md +66 -0
- package/.mindforge/personas/decision-architect.md +82 -51
- package/.mindforge/personas/deployment-captain.md +74 -0
- package/.mindforge/personas/design-system-lead.md +112 -0
- package/.mindforge/personas/dmux-orchestrator.md +75 -0
- package/.mindforge/personas/doc-auditor.md +84 -0
- package/.mindforge/personas/dx-engineer.md +96 -0
- package/.mindforge/personas/ecommerce-engineer.md +57 -0
- package/.mindforge/personas/edge-engineer.md +94 -0
- package/.mindforge/personas/edtech-architect.md +106 -0
- package/.mindforge/personas/embedding-architect.md +57 -0
- package/.mindforge/personas/environment-engineer.md +57 -0
- package/.mindforge/personas/eval-judge.md +55 -0
- package/.mindforge/personas/event-architect.md +102 -0
- package/.mindforge/personas/experiment-designer.md +138 -0
- package/.mindforge/personas/feature-store-engineer.md +57 -0
- package/.mindforge/personas/finops-analyst.md +66 -0
- package/.mindforge/personas/fintech-architect.md +57 -0
- package/.mindforge/personas/flutter-engineer.md +104 -0
- package/.mindforge/personas/gaming-engineer.md +57 -0
- package/.mindforge/personas/graphql-designer.md +73 -0
- package/.mindforge/personas/healthcare-engineer.md +57 -0
- package/.mindforge/personas/hiring-strategist.md +105 -0
- package/.mindforge/personas/hitl-architect.md +165 -0
- package/.mindforge/personas/i18n-architect.md +69 -0
- package/.mindforge/personas/instinct-curator.md +83 -0
- package/.mindforge/personas/iot-architect.md +105 -0
- package/.mindforge/personas/knowledge-curator.md +139 -0
- package/.mindforge/personas/knowledge-engineer.md +57 -0
- package/.mindforge/personas/lakehouse-architect.md +57 -0
- package/.mindforge/personas/llm-orchestrator.md +57 -0
- package/.mindforge/personas/logistics-architect.md +106 -0
- package/.mindforge/personas/market-analyst.md +53 -0
- package/.mindforge/personas/marketplace-engineer.md +105 -0
- package/.mindforge/personas/mcp-designer.md +54 -0
- package/.mindforge/personas/meeting-designer.md +104 -0
- package/.mindforge/personas/mentorship-lead.md +106 -0
- package/.mindforge/personas/migration-architect.md +57 -0
- package/.mindforge/personas/ml-ops-engineer.md +101 -0
- package/.mindforge/personas/mobile-architect.md +105 -0
- package/.mindforge/personas/mobile-security-engineer.md +106 -0
- package/.mindforge/personas/multi-model-bridge.md +86 -0
- package/.mindforge/personas/multi-tenancy-architect.md +71 -0
- package/.mindforge/personas/multimodal-engineer.md +57 -0
- package/.mindforge/personas/offline-specialist.md +105 -0
- package/.mindforge/personas/onboarding-navigator.md +63 -0
- package/.mindforge/personas/payments-engineer.md +135 -0
- package/.mindforge/personas/pipeline-engineer.md +115 -0
- package/.mindforge/personas/platform-engineer.md +97 -0
- package/.mindforge/personas/platform-lead.md +57 -0
- package/.mindforge/personas/privacy-engineer.md +57 -0
- package/.mindforge/personas/product-owner.md +56 -0
- package/.mindforge/personas/productivity-analyst.md +57 -0
- package/.mindforge/personas/prompt-architect.md +101 -0
- package/.mindforge/personas/proofreader.md +53 -0
- package/.mindforge/personas/pwa-architect.md +105 -0
- package/.mindforge/personas/quality-scorer.md +63 -0
- package/.mindforge/personas/react-native-engineer.md +106 -0
- package/.mindforge/personas/resilience-engineer.md +69 -0
- package/.mindforge/personas/rfc-architect.md +64 -0
- package/.mindforge/personas/saga-orchestrator.md +80 -0
- package/.mindforge/personas/secrets-engineer.md +57 -0
- package/.mindforge/personas/skill-smith.md +79 -0
- package/.mindforge/personas/sre-lead.md +107 -0
- package/.mindforge/personas/stream-engineer.md +57 -0
- package/.mindforge/personas/streaming-engineer.md +64 -0
- package/.mindforge/personas/swarm-templates.json +695 -38
- package/.mindforge/personas/system-designer.md +57 -0
- package/.mindforge/personas/team-coach.md +120 -0
- package/.mindforge/personas/tech-lead-coach.md +103 -0
- package/.mindforge/personas/technical-writer-lead.md +111 -0
- package/.mindforge/personas/threat-modeler.md +82 -0
- package/.mindforge/personas/vibe-checker.md +75 -0
- package/.mindforge/personas/worktree-manager.md +56 -0
- package/.mindforge/personas/zero-trust-engineer.md +113 -0
- package/.mindforge/skills/a11y-testing/SKILL.md +143 -0
- package/.mindforge/skills/agent-evaluation-framework/SKILL.md +227 -0
- package/.mindforge/skills/agent-introspection-debugging/SKILL.md +88 -0
- package/.mindforge/skills/agent-loops/SKILL.md +84 -0
- package/.mindforge/skills/agent-memory-design/SKILL.md +199 -0
- package/.mindforge/skills/agent-orchestration-patterns/SKILL.md +129 -0
- package/.mindforge/skills/agent-tool-selection/SKILL.md +204 -0
- package/.mindforge/skills/ai-agent-deployment/SKILL.md +176 -0
- package/.mindforge/skills/ai-cost-management/SKILL.md +57 -0
- package/.mindforge/skills/ai-safety-alignment/SKILL.md +53 -0
- package/.mindforge/skills/analytics-instrumentation/SKILL.md +172 -0
- package/.mindforge/skills/api-gateway-patterns/SKILL.md +177 -0
- package/.mindforge/skills/api-marketplace/SKILL.md +56 -0
- package/.mindforge/skills/api-versioning/SKILL.md +100 -0
- package/.mindforge/skills/app-store-deployment/SKILL.md +44 -0
- package/.mindforge/skills/architecture-tradeoff-analysis/SKILL.md +97 -0
- package/.mindforge/skills/audit-logging/SKILL.md +140 -0
- package/.mindforge/skills/auth-patterns/SKILL.md +148 -0
- package/.mindforge/skills/autonomous-agent-harness/SKILL.md +218 -0
- package/.mindforge/skills/autonomous-agents/SKILL.md +59 -0
- package/.mindforge/skills/autonomous-loops/SKILL.md +105 -0
- package/.mindforge/skills/build-system-optimization/SKILL.md +54 -0
- package/.mindforge/skills/build-vs-buy/SKILL.md +80 -0
- package/.mindforge/skills/bundle-optimization/SKILL.md +174 -0
- package/.mindforge/skills/business-analyst/SKILL.md +82 -0
- package/.mindforge/skills/caching-strategies/SKILL.md +132 -0
- package/.mindforge/skills/capacity-planning/SKILL.md +96 -0
- package/.mindforge/skills/causal-inference/SKILL.md +42 -0
- package/.mindforge/skills/cdn-optimization/SKILL.md +212 -0
- package/.mindforge/skills/change-management/SKILL.md +106 -0
- package/.mindforge/skills/chaos-engineering/SKILL.md +99 -0
- package/.mindforge/skills/ci-cd-pipeline/SKILL.md +118 -0
- package/.mindforge/skills/cli-design/SKILL.md +118 -0
- package/.mindforge/skills/code-generation-patterns/SKILL.md +92 -0
- package/.mindforge/skills/code-review-methodology/SKILL.md +180 -0
- package/.mindforge/skills/code-tour/SKILL.md +145 -0
- package/.mindforge/skills/codebase-onboarding/SKILL.md +95 -0
- package/.mindforge/skills/compliance-as-code/SKILL.md +195 -0
- package/.mindforge/skills/conflict-resolution/SKILL.md +87 -0
- package/.mindforge/skills/connection-pooling/SKILL.md +151 -0
- package/.mindforge/skills/container-security/SKILL.md +151 -0
- package/.mindforge/skills/context-engineering/SKILL.md +114 -0
- package/.mindforge/skills/continuous-learning/SKILL.md +84 -0
- package/.mindforge/skills/contract-testing/SKILL.md +85 -0
- package/.mindforge/skills/cost-aware-routing/SKILL.md +83 -0
- package/.mindforge/skills/cost-estimation/SKILL.md +82 -0
- package/.mindforge/skills/council/SKILL.md +68 -0
- package/.mindforge/skills/cqrs-event-sourcing/SKILL.md +95 -0
- package/.mindforge/skills/cross-platform-testing/SKILL.md +43 -0
- package/.mindforge/skills/data-governance/SKILL.md +42 -0
- package/.mindforge/skills/data-lakehouse/SKILL.md +42 -0
- package/.mindforge/skills/data-mesh/SKILL.md +42 -0
- package/.mindforge/skills/data-modeling/SKILL.md +107 -0
- package/.mindforge/skills/data-pipeline-design/SKILL.md +171 -0
- package/.mindforge/skills/data-privacy-engineering/SKILL.md +42 -0
- package/.mindforge/skills/database-performance/SKILL.md +174 -0
- package/.mindforge/skills/database-sharding-advanced/SKILL.md +206 -0
- package/.mindforge/skills/de-sloppify/SKILL.md +120 -0
- package/.mindforge/skills/defense-in-depth/SKILL.md +84 -0
- package/.mindforge/skills/delegation-patterns/SKILL.md +123 -0
- package/.mindforge/skills/dependency-management/SKILL.md +94 -0
- package/.mindforge/skills/deployment-workflow/SKILL.md +135 -0
- package/.mindforge/skills/design-system/SKILL.md +113 -0
- package/.mindforge/skills/developer-onboarding/SKILL.md +99 -0
- package/.mindforge/skills/developer-productivity-metrics/SKILL.md +59 -0
- package/.mindforge/skills/distributed-consensus/SKILL.md +141 -0
- package/.mindforge/skills/dmux-workflows/SKILL.md +141 -0
- package/.mindforge/skills/dns-architecture/SKILL.md +167 -0
- package/.mindforge/skills/doc-health-audit/SKILL.md +102 -0
- package/.mindforge/skills/ecommerce-architecture/SKILL.md +41 -0
- package/.mindforge/skills/edge-computing/SKILL.md +91 -0
- package/.mindforge/skills/edtech-platform/SKILL.md +41 -0
- package/.mindforge/skills/email-deliverability/SKILL.md +177 -0
- package/.mindforge/skills/embedding-systems/SKILL.md +55 -0
- package/.mindforge/skills/environment-management/SKILL.md +54 -0
- package/.mindforge/skills/error-handling-architecture/SKILL.md +118 -0
- package/.mindforge/skills/estimation-techniques/SKILL.md +113 -0
- package/.mindforge/skills/eval-harness/SKILL.md +180 -0
- package/.mindforge/skills/event-driven-architecture/SKILL.md +162 -0
- package/.mindforge/skills/experiment-design/SKILL.md +139 -0
- package/.mindforge/skills/experiment-platform/SKILL.md +43 -0
- package/.mindforge/skills/feature-engineering/SKILL.md +42 -0
- package/.mindforge/skills/feature-flag-management/SKILL.md +183 -0
- package/.mindforge/skills/fine-tuning-workflow/SKILL.md +189 -0
- package/.mindforge/skills/fintech-patterns/SKILL.md +41 -0
- package/.mindforge/skills/flutter-architecture/SKILL.md +42 -0
- package/.mindforge/skills/gaming-backend/SKILL.md +41 -0
- package/.mindforge/skills/git-workflow-design/SKILL.md +129 -0
- package/.mindforge/skills/graceful-degradation/SKILL.md +95 -0
- package/.mindforge/skills/graphql-patterns/SKILL.md +243 -0
- package/.mindforge/skills/guardrails-and-safety/SKILL.md +137 -0
- package/.mindforge/skills/healthcare-systems/SKILL.md +40 -0
- package/.mindforge/skills/hiring-engineering/SKILL.md +119 -0
- package/.mindforge/skills/human-in-the-loop-design/SKILL.md +234 -0
- package/.mindforge/skills/i18n-architecture/SKILL.md +147 -0
- package/.mindforge/skills/idempotency-patterns/SKILL.md +84 -0
- package/.mindforge/skills/incident-communication/SKILL.md +96 -0
- package/.mindforge/skills/incident-management/SKILL.md +97 -0
- package/.mindforge/skills/infrastructure-as-code/SKILL.md +98 -0
- package/.mindforge/skills/instinct-clustering/SKILL.md +190 -0
- package/.mindforge/skills/internal-developer-platform/SKILL.md +51 -0
- package/.mindforge/skills/iot-platform/SKILL.md +41 -0
- package/.mindforge/skills/k8s-deployment/SKILL.md +358 -0
- package/.mindforge/skills/knowledge-graphs/SKILL.md +56 -0
- package/.mindforge/skills/knowledge-sharing-systems/SKILL.md +112 -0
- package/.mindforge/skills/llm-cost-optimization/SKILL.md +198 -0
- package/.mindforge/skills/llm-orchestration/SKILL.md +56 -0
- package/.mindforge/skills/load-testing/SKILL.md +84 -0
- package/.mindforge/skills/logistics-optimization/SKILL.md +40 -0
- package/.mindforge/skills/market-researcher/SKILL.md +99 -0
- package/.mindforge/skills/marketplace-trust/SKILL.md +40 -0
- package/.mindforge/skills/mcp-server-patterns/SKILL.md +264 -0
- package/.mindforge/skills/media-streaming/SKILL.md +41 -0
- package/.mindforge/skills/meeting-architecture/SKILL.md +146 -0
- package/.mindforge/skills/mentoring-patterns/SKILL.md +77 -0
- package/.mindforge/skills/microservices-patterns/SKILL.md +83 -0
- package/.mindforge/skills/migration-platform/SKILL.md +61 -0
- package/.mindforge/skills/migration-strategies/SKILL.md +129 -0
- package/.mindforge/skills/ml-feature-store/SKILL.md +56 -0
- package/.mindforge/skills/ml-monitoring/SKILL.md +42 -0
- package/.mindforge/skills/mobile-performance/SKILL.md +44 -0
- package/.mindforge/skills/mobile-security/SKILL.md +45 -0
- package/.mindforge/skills/model-evaluation/SKILL.md +53 -0
- package/.mindforge/skills/monorepo-management/SKILL.md +100 -0
- package/.mindforge/skills/multi-llm-consult/SKILL.md +75 -0
- package/.mindforge/skills/multi-tenancy-patterns/SKILL.md +145 -0
- package/.mindforge/skills/multi-turn-conversation-design/SKILL.md +206 -0
- package/.mindforge/skills/multimodal-ai/SKILL.md +51 -0
- package/.mindforge/skills/mutation-testing/SKILL.md +97 -0
- package/.mindforge/skills/notification-system-design/SKILL.md +168 -0
- package/.mindforge/skills/observability-stack/SKILL.md +136 -0
- package/.mindforge/skills/offline-first-design/SKILL.md +43 -0
- package/.mindforge/skills/on-call-design/SKILL.md +111 -0
- package/.mindforge/skills/pagination-patterns/SKILL.md +230 -0
- package/.mindforge/skills/payment-integration/SKILL.md +176 -0
- package/.mindforge/skills/performance-reviews/SKILL.md +140 -0
- package/.mindforge/skills/platform-observability/SKILL.md +58 -0
- package/.mindforge/skills/platform-reliability/SKILL.md +52 -0
- package/.mindforge/skills/post-incident-learning/SKILL.md +96 -0
- package/.mindforge/skills/product-manager/SKILL.md +104 -0
- package/.mindforge/skills/progressive-web-app/SKILL.md +44 -0
- package/.mindforge/skills/prompt-engineering/SKILL.md +94 -0
- package/.mindforge/skills/proofreader/SKILL.md +158 -0
- package/.mindforge/skills/push-notification-architecture/SKILL.md +45 -0
- package/.mindforge/skills/python-performance/SKILL.md +183 -0
- package/.mindforge/skills/quality-audit/SKILL.md +171 -0
- package/.mindforge/skills/queue-design/SKILL.md +85 -0
- package/.mindforge/skills/rag-architecture/SKILL.md +176 -0
- package/.mindforge/skills/rate-limiting-design/SKILL.md +94 -0
- package/.mindforge/skills/react-native-patterns/SKILL.md +42 -0
- package/.mindforge/skills/react-performance/SKILL.md +229 -0
- package/.mindforge/skills/real-time-analytics/SKILL.md +42 -0
- package/.mindforge/skills/real-time-sync/SKILL.md +83 -0
- package/.mindforge/skills/responsive-native/SKILL.md +44 -0
- package/.mindforge/skills/responsive-patterns/SKILL.md +141 -0
- package/.mindforge/skills/rfc-pipeline/SKILL.md +114 -0
- package/.mindforge/skills/saas-multi-tenant/SKILL.md +41 -0
- package/.mindforge/skills/santa-method/SKILL.md +134 -0
- package/.mindforge/skills/search-implementation/SKILL.md +98 -0
- package/.mindforge/skills/secrets-platform/SKILL.md +56 -0
- package/.mindforge/skills/secrets-rotation/SKILL.md +173 -0
- package/.mindforge/skills/self-serve-infrastructure/SKILL.md +51 -0
- package/.mindforge/skills/serverless-patterns/SKILL.md +119 -0
- package/.mindforge/skills/skill-creator-meta/SKILL.md +146 -0
- package/.mindforge/skills/sprint-retrospective-facilitation/SKILL.md +112 -0
- package/.mindforge/skills/stakeholder-communication/SKILL.md +85 -0
- package/.mindforge/skills/state-management/SKILL.md +104 -0
- package/.mindforge/skills/stream-processing/SKILL.md +43 -0
- package/.mindforge/skills/streaming-architecture/SKILL.md +81 -0
- package/.mindforge/skills/supply-chain-security/SKILL.md +145 -0
- package/.mindforge/skills/synthetic-data-generation/SKILL.md +52 -0
- package/.mindforge/skills/system-design/SKILL.md +88 -0
- package/.mindforge/skills/team-topology-design/SKILL.md +107 -0
- package/.mindforge/skills/technical-debt-management/SKILL.md +86 -0
- package/.mindforge/skills/technical-interview-design/SKILL.md +98 -0
- package/.mindforge/skills/technical-leadership/SKILL.md +75 -0
- package/.mindforge/skills/technical-writing/SKILL.md +237 -0
- package/.mindforge/skills/technology-radar/SKILL.md +88 -0
- package/.mindforge/skills/testing-anti-patterns/SKILL.md +288 -0
- package/.mindforge/skills/threat-modeling/SKILL.md +109 -0
- package/.mindforge/skills/tool-design/SKILL.md +138 -0
- package/.mindforge/skills/typescript-advanced/SKILL.md +198 -0
- package/.mindforge/skills/using-git-worktrees/SKILL.md +139 -0
- package/.mindforge/skills/verification-loop/SKILL.md +97 -0
- package/.mindforge/skills/vibe-security/SKILL.md +165 -0
- package/.mindforge/skills/visual-regression-testing/SKILL.md +97 -0
- package/.mindforge/skills/websocket-patterns/SKILL.md +203 -0
- package/.mindforge/skills/writing-plans/SKILL.md +170 -0
- package/.mindforge/skills/writing-skills/SKILL.md +216 -0
- package/.mindforge/skills/zero-trust-architecture/SKILL.md +166 -0
- package/CHANGELOG.md +195 -0
- package/MINDFORGE.md +4 -4
- package/README.md +2 -2
- package/RELEASENOTES.md +66 -0
- package/bin/installer-core.js +1 -1
- package/bin/wizard/theme.js +2 -2
- package/docs/commands-reference.md +18 -1
- package/package.json +2 -2
- package/.mindforge/personas/data-privacy-engineer.md +0 -187
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-agent-deployment
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.1.1
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: ai agent deployment, agent hosting, agent scaling, agent versioning, agent A/B testing, agent monitoring production, agent rollback, agent health check, agent cost production, agent performance monitoring, agent canary, agent shadow testing
|
|
7
|
+
compose: deployment-workflow
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill — AI Agent Deployment
|
|
11
|
+
|
|
12
|
+
## When this skill activates
|
|
13
|
+
Any task involving deploying AI agents to production, versioning agent configurations,
|
|
14
|
+
A/B testing agent variants, monitoring agent quality in production,
|
|
15
|
+
or managing the operational lifecycle of AI agents.
|
|
16
|
+
|
|
17
|
+
## Mandatory actions when this skill is active
|
|
18
|
+
|
|
19
|
+
### Before writing any code
|
|
20
|
+
1. Define the agent version tuple: model + prompt + tools + config (all pinned together).
|
|
21
|
+
2. Identify success metrics (quality, latency, cost, user satisfaction).
|
|
22
|
+
3. Plan rollback strategy (instant version pointer switch).
|
|
23
|
+
4. Design monitoring (token usage, error rate, quality signal).
|
|
24
|
+
|
|
25
|
+
### During implementation
|
|
26
|
+
- Package agent as a versioned, immutable deployment artifact.
|
|
27
|
+
- Implement health check endpoint (synthetic task probe).
|
|
28
|
+
- Add structured logging for every agent action (input, output, tools used, tokens).
|
|
29
|
+
- Build traffic splitting capability for A/B and canary.
|
|
30
|
+
- Instrument cost tracking per-task and per-user.
|
|
31
|
+
- Implement graceful degradation (fallback to simpler model on failure).
|
|
32
|
+
|
|
33
|
+
### After implementation
|
|
34
|
+
- Verify shadow test shows no regression vs current version.
|
|
35
|
+
- Confirm monitoring dashboards capture all key metrics.
|
|
36
|
+
- Test rollback procedure end-to-end.
|
|
37
|
+
- Validate cost projections against actual usage.
|
|
38
|
+
- Run synthetic probes for health verification.
|
|
39
|
+
|
|
40
|
+
## Versioning Strategy
|
|
41
|
+
|
|
42
|
+
### Agent Version = Immutable Tuple
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"version": "agent-v2.3.1",
|
|
46
|
+
"model": "claude-sonnet-4-20250514",
|
|
47
|
+
"prompt_hash": "sha256:abc123...",
|
|
48
|
+
"tools": ["search_v2", "code_exec_v1", "web_browse_v3"],
|
|
49
|
+
"config": {
|
|
50
|
+
"temperature": 0.3,
|
|
51
|
+
"max_tokens": 4096,
|
|
52
|
+
"timeout_ms": 30000
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Rules
|
|
58
|
+
- Changing ANY component = new version.
|
|
59
|
+
- Never mutate a deployed version in place.
|
|
60
|
+
- Keep previous N versions warm for instant rollback.
|
|
61
|
+
- Version string includes all components for traceability.
|
|
62
|
+
|
|
63
|
+
## Hosting Patterns
|
|
64
|
+
|
|
65
|
+
### Containerized (Recommended)
|
|
66
|
+
- Docker container with model client, prompt, tool implementations.
|
|
67
|
+
- Auto-scale on queue depth (not CPU — agents are I/O bound).
|
|
68
|
+
- GPU allocation only if running local inference.
|
|
69
|
+
- Isolate per-tenant for data separation.
|
|
70
|
+
|
|
71
|
+
### Scaling Signals
|
|
72
|
+
| Signal | Scale Direction | Reason |
|
|
73
|
+
|--------|----------------|--------|
|
|
74
|
+
| Queue depth increasing | Scale up | Work is backing up |
|
|
75
|
+
| P95 latency rising | Scale up | Capacity insufficient |
|
|
76
|
+
| Queue empty for 5min | Scale down | Over-provisioned |
|
|
77
|
+
| Error rate > 5% | Pause scaling | Fix errors first |
|
|
78
|
+
|
|
79
|
+
## A/B Testing
|
|
80
|
+
|
|
81
|
+
### Setup
|
|
82
|
+
1. Define hypothesis (e.g., "new prompt reduces hallucination by 20%").
|
|
83
|
+
2. Split traffic (e.g., 90/10 control/experiment).
|
|
84
|
+
3. Run for statistical significance (typically 1000+ samples per variant).
|
|
85
|
+
4. Measure: quality score, latency, cost, user feedback.
|
|
86
|
+
|
|
87
|
+
### Metrics to Compare
|
|
88
|
+
- Task success rate (did the agent complete the task correctly?).
|
|
89
|
+
- Token usage (cost proxy).
|
|
90
|
+
- Latency p50/p95/p99.
|
|
91
|
+
- Tool failure rate.
|
|
92
|
+
- User satisfaction signal (thumbs up/down, follow-up corrections).
|
|
93
|
+
- Hallucination rate (if measurable via ground truth).
|
|
94
|
+
|
|
95
|
+
### Graduation Criteria
|
|
96
|
+
- Improvement statistically significant (p < 0.05).
|
|
97
|
+
- No regression in any critical metric.
|
|
98
|
+
- Cost increase acceptable (<20% for same quality).
|
|
99
|
+
|
|
100
|
+
## Shadow Testing
|
|
101
|
+
|
|
102
|
+
### Pattern
|
|
103
|
+
```
|
|
104
|
+
User Request → Production Agent (responds to user)
|
|
105
|
+
→ Shadow Agent (runs silently, output logged)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Purpose
|
|
109
|
+
- Test new version against real traffic without user impact.
|
|
110
|
+
- Compare outputs offline (human eval or automated scoring).
|
|
111
|
+
- Detect regressions before any user sees them.
|
|
112
|
+
|
|
113
|
+
### Rules
|
|
114
|
+
- Shadow agent output never reaches the user.
|
|
115
|
+
- Shadow uses same input but may have different model/prompt/tools.
|
|
116
|
+
- Compare at scale (1000+ requests) before promoting.
|
|
117
|
+
- Track divergence rate and categorize differences.
|
|
118
|
+
|
|
119
|
+
## Monitoring
|
|
120
|
+
|
|
121
|
+
### Key Metrics (Real-Time Dashboard)
|
|
122
|
+
| Metric | Alert Threshold | Action |
|
|
123
|
+
|--------|----------------|--------|
|
|
124
|
+
| Token usage/task | >2x baseline | Check for loops/verbose output |
|
|
125
|
+
| Latency p95 | >30s | Scale up or investigate bottleneck |
|
|
126
|
+
| Tool failure rate | >5% | Check tool availability |
|
|
127
|
+
| Hallucination rate | >3% | Rollback, investigate prompt |
|
|
128
|
+
| User negative feedback | >10% | Investigate, consider rollback |
|
|
129
|
+
| Cost per task | >$0.50 | Check for inefficiency |
|
|
130
|
+
|
|
131
|
+
### Structured Logging
|
|
132
|
+
Every agent invocation must log:
|
|
133
|
+
- Request ID, user ID, agent version.
|
|
134
|
+
- Input (sanitized of PII).
|
|
135
|
+
- Output summary.
|
|
136
|
+
- Tools invoked and their results.
|
|
137
|
+
- Token counts (input, output, total).
|
|
138
|
+
- Latency breakdown (thinking, tool calls, generation).
|
|
139
|
+
- Success/failure determination.
|
|
140
|
+
|
|
141
|
+
## Rollback
|
|
142
|
+
|
|
143
|
+
### Instant Rollback
|
|
144
|
+
- Version pointer in config store (not redeployment).
|
|
145
|
+
- Switch pointer → immediate traffic to previous version.
|
|
146
|
+
- Keep N previous versions warm (containers running, ready).
|
|
147
|
+
- Rollback decision within 5 minutes of detecting regression.
|
|
148
|
+
|
|
149
|
+
### Rollback Triggers (Automatic)
|
|
150
|
+
- Error rate > 10% for 3 consecutive minutes.
|
|
151
|
+
- P95 latency > 60s for 5 minutes.
|
|
152
|
+
- User negative feedback spike (3x normal rate).
|
|
153
|
+
|
|
154
|
+
## Health Checks
|
|
155
|
+
|
|
156
|
+
### Synthetic Probes
|
|
157
|
+
- Run a known-good task against the agent every 5 minutes.
|
|
158
|
+
- Verify output matches expected structure.
|
|
159
|
+
- Check latency within bounds.
|
|
160
|
+
- Alert if probe fails 2 consecutive times.
|
|
161
|
+
|
|
162
|
+
### Probe Design
|
|
163
|
+
- Task must be deterministic (or have verifiable structure).
|
|
164
|
+
- Must exercise core capabilities (reasoning + at least one tool).
|
|
165
|
+
- Must complete within health check timeout (10s recommended).
|
|
166
|
+
- Results logged for trend analysis.
|
|
167
|
+
|
|
168
|
+
## Self-check
|
|
169
|
+
- [ ] Agent version tuple defined (model + prompt + tools + config).
|
|
170
|
+
- [ ] Health check probes running every 5 minutes.
|
|
171
|
+
- [ ] Monitoring covers: tokens, latency, errors, quality, cost.
|
|
172
|
+
- [ ] Rollback tested and confirmed instant.
|
|
173
|
+
- [ ] Shadow test shows no regression.
|
|
174
|
+
- [ ] A/B framework ready for future experiments.
|
|
175
|
+
- [ ] Cost per task tracked and within budget.
|
|
176
|
+
- [ ] Graceful degradation implemented for failures.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-cost-management
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.5.0
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: AI cost management, token budget optimization, model cost selection, LLM response caching, batch inference processing, AI infrastructure cost, token usage monitoring, cost-aware model routing, inference cost reduction, GPU utilization optimization, AI spend tracking, cost per query optimization
|
|
7
|
+
compose:
|
|
8
|
+
- llm-cost-optimization
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# AI Cost Management & Optimization
|
|
12
|
+
|
|
13
|
+
## When this skill activates
|
|
14
|
+
|
|
15
|
+
This skill activates when optimizing AI inference costs, implementing token budgeting, designing cost-aware model routing, or tracking AI spending at scale. It applies to production AI systems where compute costs are significant (>$10K/month) and must be controlled without degrading user experience.
|
|
16
|
+
|
|
17
|
+
## Mandatory actions when this skill is active
|
|
18
|
+
|
|
19
|
+
### Before writing any code
|
|
20
|
+
|
|
21
|
+
1. **Establish cost baseline** — Measure current costs per dimension: cost per request, cost per user, cost per model, cost per task type. Identify cost drivers: which models, which tasks, which users consume the most budget. Focus optimization efforts on the top 20% of cost drivers (Pareto principle).
|
|
22
|
+
2. **Set cost budgets and alerts** — Define acceptable cost thresholds per day, per week, per month. Set up alerts when spending exceeds thresholds (50%, 80%, 100%). Alerts prevent runaway costs from unexpected usage spikes or inefficient code.
|
|
23
|
+
3. **Design cost attribution model** — Assign costs to cost centers: per-team, per-product, per-customer tier (free vs. paid). Enables chargeback (internal teams pay for their usage) and informs product decisions (should free tier have lower model quality to reduce costs?).
|
|
24
|
+
4. **Identify optimization opportunities** — Rank opportunities by potential savings: caching (30-70% reduction for repetitive queries), model downgrade (10-50% reduction with minimal quality loss), batching (20-40% reduction via throughput optimization), prompt compression (10-30% reduction by reducing tokens).
|
|
25
|
+
|
|
26
|
+
### During implementation
|
|
27
|
+
|
|
28
|
+
- **Implement aggressive response caching** — Cache LLM responses keyed by prompt hash + model + hyperparameters. Cache hit rate >50% is achievable for many use cases. Use Redis or Memcached for low-latency lookups (<1ms). Set TTL based on content freshness requirements (hours for news, days for documentation, indefinite for static content).
|
|
29
|
+
- **Design cost-aware routing** — Route requests to the cheapest model that meets quality requirements. Example: simple classification → Haiku ($0.25/MTok), complex reasoning → Opus ($15/MTok). Measure quality degradation when downgrading models. If accuracy drop is <2%, downgrade is safe.
|
|
30
|
+
- **Compress prompts aggressively** — Remove filler words, use abbreviations, compress whitespace. Test that compressed prompts produce equivalent outputs. Measure compression ratio (original tokens / compressed tokens). Target: 20-50% compression with <1% quality loss.
|
|
31
|
+
- **Batch inference for throughput** — Group requests into batches (10-100 per batch) to maximize GPU utilization. Batching increases throughput (requests/second) and reduces cost per request (amortize fixed overhead). Trade-off: higher latency (wait for batch to fill) for lower cost.
|
|
32
|
+
- **Implement prompt caching (for supported models)** — Use prompt caching for repeated prompt prefixes (system message, context). Claude and GPT-4 support prompt caching. Reduces cost by 90% for cached tokens. Ensure prompts are structured with stable prefixes and variable suffixes.
|
|
33
|
+
- **Track token usage per request** — Log input tokens, output tokens, and total cost per request. Aggregate by model, task type, user, and time. Identify outliers: queries with unusually high token counts (may indicate inefficient prompts or bugs). Set up monitoring dashboards.
|
|
34
|
+
|
|
35
|
+
### After implementation
|
|
36
|
+
|
|
37
|
+
- **Measure cache hit rate** — Track % of requests served from cache. Target: >50% hit rate for production systems with repetitive queries. If lower, analyze cache misses: are prompts subtly different (normalize prompts), is TTL too short (increase TTL), or is traffic too diverse (caching won't help)?
|
|
38
|
+
- **Validate quality after cost optimization** — Compare model accuracy, user satisfaction, or business metrics before and after optimization. Acceptable thresholds: <2% accuracy drop, <5% user satisfaction drop. If degradation is higher, roll back optimizations.
|
|
39
|
+
- **Benchmark cost reduction** — Measure cost per request after optimizations vs. baseline. Target: 30-50% cost reduction from caching + routing + compression. Document savings in $/month and ROI (developer time spent vs. cost saved).
|
|
40
|
+
- **Monitor for cost anomalies** — Set up alerts for sudden cost spikes (>2x daily average) or unusual patterns (single user consuming 10x typical usage). Anomalies indicate bugs (infinite loops, retry storms) or abuse (attackers exploiting free tier).
|
|
41
|
+
|
|
42
|
+
## Self-check before task completion
|
|
43
|
+
|
|
44
|
+
- [ ] Cost baseline is measured per request, user, model, and task type
|
|
45
|
+
- [ ] Cost budgets are set with alerts at 50%, 80%, 100% thresholds
|
|
46
|
+
- [ ] Cost attribution model assigns costs to teams, products, or customer tiers
|
|
47
|
+
- [ ] Optimization opportunities are ranked by potential savings and effort
|
|
48
|
+
- [ ] Response caching is implemented with cache hit rate tracked (target >50%)
|
|
49
|
+
- [ ] Cost-aware routing selects cheapest model that meets quality requirements
|
|
50
|
+
- [ ] Prompt compression achieves 20-50% token reduction with <1% quality loss
|
|
51
|
+
- [ ] Batch inference is implemented for throughput optimization (10-100 requests per batch)
|
|
52
|
+
- [ ] Prompt caching (if supported) reduces cost by 90% for repeated prompt prefixes
|
|
53
|
+
- [ ] Token usage is logged per request and aggregated by model, task, user, time
|
|
54
|
+
- [ ] Cache hit rate is validated at >50% for production systems with repetitive queries
|
|
55
|
+
- [ ] Model quality is validated post-optimization (<2% accuracy drop, <5% satisfaction drop)
|
|
56
|
+
- [ ] Cost reduction is benchmarked (target 30-50% reduction from baseline)
|
|
57
|
+
- [ ] Cost anomaly alerts are configured for spikes (>2x daily average) and abuse patterns
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-safety-alignment
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.5.0
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: AI safety implementation, AI alignment technique, output filtering AI, content moderation AI, bias detection model, AI guardrail implementation, harmful content prevention, AI red teaming, model safety evaluation, AI ethics implementation, alignment testing, responsible AI deployment
|
|
7
|
+
compose:
|
|
8
|
+
- guardrails-and-safety
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# AI Safety & Alignment
|
|
12
|
+
|
|
13
|
+
## When this skill activates
|
|
14
|
+
|
|
15
|
+
This skill activates when implementing output filters, content moderation systems, bias detection, adversarial robustness, or alignment techniques for AI systems. It applies when deploying AI in production environments where safety failures have legal, reputational, or ethical consequences.
|
|
16
|
+
|
|
17
|
+
## Mandatory actions when this skill is active
|
|
18
|
+
|
|
19
|
+
### Before writing any code
|
|
20
|
+
|
|
21
|
+
1. **Define harm taxonomy** — Categorize potential harms specific to your domain: toxic content, misinformation, bias (demographic, cultural), privacy leaks, prompt injection, jailbreaks, copyright violations. Prioritize by severity and likelihood. Not all harms are equal.
|
|
22
|
+
2. **Establish safety thresholds** — Define numeric thresholds for each harm category: toxicity score <0.3, PII detection confidence >0.9, bias parity ratio 0.8-1.2. Thresholds must be tuned on representative data, not arbitrary guesses.
|
|
23
|
+
3. **Select detection models** — Choose specialized classifiers per harm type: Perspective API or custom models for toxicity, named entity recognition for PII, fairness metrics for bias. General-purpose LLMs are too slow and expensive for real-time safety filtering.
|
|
24
|
+
4. **Design layered defense** — Implement multiple safety layers: input validation (reject malicious prompts), model guardrails (constrain model behavior), output filtering (catch harmful completions), monitoring (detect safety failures post-deployment). Single-layer defense is insufficient.
|
|
25
|
+
|
|
26
|
+
### During implementation
|
|
27
|
+
|
|
28
|
+
- **Implement input sanitization first** — Validate all user inputs before reaching the model. Reject or sanitize: SQL injection patterns, prompt injection attempts (ignore previous instructions), PII in prompts, excessive length, special characters that break parsing. Log rejected inputs for analysis.
|
|
29
|
+
- **Apply constitutional AI principles** — Constrain model behavior via system prompts: "You are a helpful assistant. You must not generate harmful, biased, or illegal content. If asked to do so, politely refuse and explain why." Test refusal behavior extensively.
|
|
30
|
+
- **Use classifier-guided generation** — For high-risk domains, run a safety classifier on every output before returning to the user. If toxicity/bias/PII is detected above threshold, retry generation with a modified prompt or return a safe default response.
|
|
31
|
+
- **Implement red-teaming as tests** — Create automated adversarial tests: jailbreak attempts, bias triggers, edge cases designed to elicit failures. Run these tests in CI/CD. Safety regressions must block deployment.
|
|
32
|
+
- **Log all safety events** — Record every safety filter activation: input rejected, output filtered, threshold exceeded. Include context: user ID, timestamp, input/output text, classifier scores. This data is critical for tuning thresholds and identifying attack patterns.
|
|
33
|
+
- **Design graceful degradation** — When safety filters trigger, provide user-friendly explanations: "I can't generate that content because [reason]." Do not expose internal classifier scores or filter logic (attackers use this to evade detection).
|
|
34
|
+
|
|
35
|
+
### After implementation
|
|
36
|
+
|
|
37
|
+
- **Validate safety coverage** — Test the system with a held-out safety dataset: known toxic examples, bias triggers, jailbreak prompts. Measure recall (% of harmful content caught) and precision (% of flagged content that is truly harmful). Target: recall >95%, precision >90%.
|
|
38
|
+
- **Measure bias across demographics** — Evaluate model outputs for demographic parity, equalized odds, and calibration across protected attributes (race, gender, age). Use fairness toolkits (Fairlearn, AI Fairness 360). Bias gaps >20% require mitigation.
|
|
39
|
+
- **Conduct human red-teaming** — Hire external red-teamers to attempt jailbreaks and adversarial attacks. Automated tests miss creative attack vectors. Budget 20-40 hours of red-teaming per major release.
|
|
40
|
+
- **Monitor safety in production** — Track safety metrics over time: filter activation rate, false positive rate, user complaints about incorrect filtering. Safety degrades as attackers adapt and user behavior shifts.
|
|
41
|
+
|
|
42
|
+
## Self-check before task completion
|
|
43
|
+
|
|
44
|
+
- [ ] Harm taxonomy is defined with severity ratings and likelihood estimates
|
|
45
|
+
- [ ] Safety thresholds are set per harm type and validated on representative data
|
|
46
|
+
- [ ] Input sanitization rejects malicious prompts before reaching the model
|
|
47
|
+
- [ ] Output filtering runs on every completion with <100ms latency overhead
|
|
48
|
+
- [ ] Constitutional AI constraints are embedded in system prompts and tested
|
|
49
|
+
- [ ] Automated red-teaming tests run in CI/CD and block deployment on failures
|
|
50
|
+
- [ ] Safety events are logged with full context for post-hoc analysis
|
|
51
|
+
- [ ] Bias is measured across demographics with fairness parity within acceptable bounds
|
|
52
|
+
- [ ] Human red-teaming has been conducted with documented attack attempts and mitigations
|
|
53
|
+
- [ ] Production monitoring tracks filter activation rate and false positive trends
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: analytics-instrumentation
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.4
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: analytics instrumentation, event taxonomy, tracking plan, data layer architecture, privacy-aware analytics, funnel measurement, event naming convention, analytics schema, user journey tracking, conversion tracking, analytics governance, event validation
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill — Analytics Instrumentation (Privacy-Aware Event Architecture)
|
|
10
|
+
|
|
11
|
+
## When this skill activates
|
|
12
|
+
When designing event tracking systems, building data layers, creating tracking plans,
|
|
13
|
+
instrumenting user journeys, or establishing analytics governance. Use for any task
|
|
14
|
+
that involves measuring user behavior in a structured, privacy-respecting way.
|
|
15
|
+
|
|
16
|
+
Core principle: **Track intent, not surveillance** — measure what users DO to improve
|
|
17
|
+
what you BUILD, never to manipulate or over-collect.
|
|
18
|
+
|
|
19
|
+
## Mandatory actions when this skill is active
|
|
20
|
+
|
|
21
|
+
### Event Taxonomy Design
|
|
22
|
+
|
|
23
|
+
1. **Naming convention (object_action format):**
|
|
24
|
+
```
|
|
25
|
+
Format: [object]_[action]
|
|
26
|
+
Examples:
|
|
27
|
+
- button_clicked
|
|
28
|
+
- form_submitted
|
|
29
|
+
- page_viewed
|
|
30
|
+
- cart_item_added
|
|
31
|
+
- search_performed
|
|
32
|
+
- error_encountered
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Rules:
|
|
36
|
+
- Always past tense for the action (clicked, not click)
|
|
37
|
+
- Lowercase with underscores (snake_case)
|
|
38
|
+
- Object first, action second (noun_verb)
|
|
39
|
+
- Maximum 3 words total (object can be compound: cart_item_added)
|
|
40
|
+
- Never include PII in event names
|
|
41
|
+
- Never include dynamic values in event names (no "product_12345_viewed")
|
|
42
|
+
|
|
43
|
+
2. **Event property schema:**
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"event": "button_clicked",
|
|
47
|
+
"properties": {
|
|
48
|
+
"button_id": "string (required) — unique identifier",
|
|
49
|
+
"button_text": "string (required) — visible label",
|
|
50
|
+
"page_path": "string (required) — current URL path",
|
|
51
|
+
"section": "string (optional) — page section containing button",
|
|
52
|
+
"variant": "string (optional) — A/B test variant if applicable"
|
|
53
|
+
},
|
|
54
|
+
"context": {
|
|
55
|
+
"timestamp": "ISO-8601 (auto)",
|
|
56
|
+
"session_id": "string (auto)",
|
|
57
|
+
"device_type": "string (auto)",
|
|
58
|
+
"viewport_width": "number (auto)"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Rules:
|
|
64
|
+
- Separate event-specific properties from auto-collected context
|
|
65
|
+
- Mark each property as required or optional
|
|
66
|
+
- Include data type and brief description
|
|
67
|
+
- Never include PII in properties without explicit consent flag
|
|
68
|
+
|
|
69
|
+
### Tracking Plan
|
|
70
|
+
|
|
71
|
+
3. **Tracking plan structure (source of truth):**
|
|
72
|
+
```
|
|
73
|
+
| Event Name | Trigger | Properties | Owner | Status |
|
|
74
|
+
|------------------|----------------------------|--------------------|----------|--------------|
|
|
75
|
+
| page_viewed | Page load complete | page_path, title | @fe-team | Implemented |
|
|
76
|
+
| button_clicked | Any tracked button click | button_id, text | @fe-team | In Review |
|
|
77
|
+
| form_submitted | Form submission success | form_id, fields | @fe-team | Planned |
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Rules:
|
|
81
|
+
- Every event MUST have an owner (team or individual)
|
|
82
|
+
- Status lifecycle: Planned → In Review → Implemented → Validated → Deprecated
|
|
83
|
+
- Review tracking plan quarterly: deprecate unused events
|
|
84
|
+
- New events require tracking plan entry BEFORE implementation
|
|
85
|
+
|
|
86
|
+
### Data Layer Architecture
|
|
87
|
+
|
|
88
|
+
4. **Data layer implementation:**
|
|
89
|
+
```javascript
|
|
90
|
+
// Structured data layer (consumed by analytics tools)
|
|
91
|
+
window.dataLayer = window.dataLayer || [];
|
|
92
|
+
|
|
93
|
+
// Push events with standard structure
|
|
94
|
+
window.dataLayer.push({
|
|
95
|
+
event: 'button_clicked',
|
|
96
|
+
properties: {
|
|
97
|
+
button_id: 'cta-signup-hero',
|
|
98
|
+
button_text: 'Start Free Trial',
|
|
99
|
+
page_path: '/pricing'
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Rules:
|
|
105
|
+
- Data layer is the SINGLE source of truth (analytics tools consume it, don't instrument directly)
|
|
106
|
+
- Never push to data layer before consent is granted
|
|
107
|
+
- Validate data layer pushes against schema in CI
|
|
108
|
+
- Data layer must be populated server-side for critical events (don't rely solely on client JS)
|
|
109
|
+
|
|
110
|
+
### Privacy-Aware Analytics
|
|
111
|
+
|
|
112
|
+
5. **Privacy requirements (non-negotiable):**
|
|
113
|
+
- Obtain consent BEFORE any tracking fires (banner/modal with granular choices)
|
|
114
|
+
- Honor Do Not Track (DNT) header — respect user preference
|
|
115
|
+
- Anonymize by default: no full IP, no fingerprinting, no cross-site tracking
|
|
116
|
+
- Data retention: define maximum retention per event type (default 13 months for GDPR)
|
|
117
|
+
- Right to deletion: ensure analytics pipeline can purge by user ID
|
|
118
|
+
- Consent categories: necessary (no consent needed) | analytics (consent required) | marketing (separate consent)
|
|
119
|
+
|
|
120
|
+
6. **Consent implementation:**
|
|
121
|
+
```javascript
|
|
122
|
+
// Only track if user has consented to analytics category
|
|
123
|
+
if (consentManager.hasConsent('analytics')) {
|
|
124
|
+
dataLayer.push({ event: 'page_viewed', properties: {...} });
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Funnel Measurement
|
|
129
|
+
|
|
130
|
+
7. **Funnel definition:**
|
|
131
|
+
```
|
|
132
|
+
Funnel: [name]
|
|
133
|
+
Steps:
|
|
134
|
+
1. page_viewed (page_path = '/pricing') → Entry
|
|
135
|
+
2. button_clicked (button_id = 'select-plan') → Intent
|
|
136
|
+
3. form_submitted (form_id = 'payment') → Commitment
|
|
137
|
+
4. purchase_completed → Conversion
|
|
138
|
+
|
|
139
|
+
Metrics per step:
|
|
140
|
+
- Volume (count)
|
|
141
|
+
- Conversion rate (step N / step N-1)
|
|
142
|
+
- Drop-off rate (1 - conversion rate)
|
|
143
|
+
- Time between steps (median, p95)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Rules:
|
|
147
|
+
- Define funnels for every critical user journey
|
|
148
|
+
- Segment funnels by: device, acquisition source, user cohort, experiment variant
|
|
149
|
+
- Alert on significant drop-off changes (>10% deviation from baseline)
|
|
150
|
+
- Funnel steps must use the same event taxonomy
|
|
151
|
+
|
|
152
|
+
### Analytics Governance
|
|
153
|
+
|
|
154
|
+
8. **Governance processes:**
|
|
155
|
+
- **Schema validation in CI**: every new event must match the tracking plan schema
|
|
156
|
+
- **Unused event cleanup**: quarterly audit, deprecate events with <100 fires/month
|
|
157
|
+
- **Naming review**: new events require team lead approval (prevents drift)
|
|
158
|
+
- **Data quality monitoring**: alert on sudden volume spikes/drops (instrumentation bugs)
|
|
159
|
+
- **Documentation**: tracking plan is the living doc, not code comments
|
|
160
|
+
|
|
161
|
+
## Self-check before task completion
|
|
162
|
+
|
|
163
|
+
Before marking a task done when this skill was active:
|
|
164
|
+
|
|
165
|
+
- [ ] Did I follow the object_action naming convention?
|
|
166
|
+
- [ ] Is every event documented in the tracking plan with owner and status?
|
|
167
|
+
- [ ] Does the data layer implementation gate on user consent?
|
|
168
|
+
- [ ] Are PII fields excluded from event properties (or flagged for special handling)?
|
|
169
|
+
- [ ] Did I define funnels for critical user journeys with per-step metrics?
|
|
170
|
+
- [ ] Is there a governance process for event lifecycle management?
|
|
171
|
+
- [ ] Can the schema be validated in CI (preventing undocumented events)?
|
|
172
|
+
- [ ] Is data retention defined and compliant with privacy regulations?
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-gateway-patterns
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 0.1.0
|
|
5
|
+
status: stable
|
|
6
|
+
compose: api-design
|
|
7
|
+
triggers: api gateway, gateway rate limiting, request routing, auth offloading, response transformation, backend for frontend, gateway circuit breaker, request aggregation, api composition, gateway caching, gateway throttling, gateway authentication
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill — API Gateway Patterns
|
|
11
|
+
|
|
12
|
+
## When this skill activates
|
|
13
|
+
Any task involving API gateway configuration, gateway rate limiting, request
|
|
14
|
+
routing, authentication offloading, BFF patterns, or gateway-level caching.
|
|
15
|
+
|
|
16
|
+
## Mandatory actions when this skill is active
|
|
17
|
+
|
|
18
|
+
### Before writing any code
|
|
19
|
+
1. Identify which cross-cutting concerns belong at the gateway vs service level.
|
|
20
|
+
2. Define rate limiting strategy (algorithm, limits, granularity).
|
|
21
|
+
3. Determine if BFF pattern is needed (multiple client types).
|
|
22
|
+
|
|
23
|
+
### During implementation
|
|
24
|
+
- Keep gateway logic stateless (no session state in gateway).
|
|
25
|
+
- Implement circuit breakers per downstream service.
|
|
26
|
+
- Add request correlation IDs at the gateway for distributed tracing.
|
|
27
|
+
|
|
28
|
+
### After implementation
|
|
29
|
+
- Load test rate limiting configuration.
|
|
30
|
+
- Verify circuit breaker thresholds with failure injection.
|
|
31
|
+
- Document gateway routing rules in ARCHITECTURE.md.
|
|
32
|
+
|
|
33
|
+
## Rate Limiting Algorithms
|
|
34
|
+
|
|
35
|
+
### Token Bucket
|
|
36
|
+
- Bucket holds N tokens, refills at constant rate.
|
|
37
|
+
- Each request consumes one token.
|
|
38
|
+
- Allows bursts up to bucket capacity.
|
|
39
|
+
- Best for: APIs that need burst tolerance.
|
|
40
|
+
|
|
41
|
+
### Sliding Window
|
|
42
|
+
- Count requests in rolling time window.
|
|
43
|
+
- Smoother than fixed window (no boundary burst issue).
|
|
44
|
+
- Best for: strict per-second/minute rate enforcement.
|
|
45
|
+
|
|
46
|
+
### Fixed Window
|
|
47
|
+
- Count requests per calendar interval (e.g., per minute).
|
|
48
|
+
- Simple to implement, but allows 2x burst at window boundary.
|
|
49
|
+
- Best for: simple use cases where boundary bursts are acceptable.
|
|
50
|
+
|
|
51
|
+
### Rate Limit Granularity
|
|
52
|
+
- **Per-user**: fairest, prevents one user from affecting others.
|
|
53
|
+
- **Per-IP**: catches unauthenticated abuse, but shared IPs cause issues.
|
|
54
|
+
- **Per-endpoint**: different limits for reads vs writes.
|
|
55
|
+
- **Per-plan**: higher limits for premium tier customers.
|
|
56
|
+
|
|
57
|
+
### Response Headers
|
|
58
|
+
```
|
|
59
|
+
X-RateLimit-Limit: 1000
|
|
60
|
+
X-RateLimit-Remaining: 847
|
|
61
|
+
X-RateLimit-Reset: 1623456789
|
|
62
|
+
Retry-After: 30
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Authentication Offloading
|
|
66
|
+
|
|
67
|
+
### Pattern
|
|
68
|
+
1. Client sends request with auth token to gateway.
|
|
69
|
+
2. Gateway validates JWT signature and expiration.
|
|
70
|
+
3. Gateway extracts claims (user_id, roles, permissions).
|
|
71
|
+
4. Gateway passes claims as trusted headers to downstream services.
|
|
72
|
+
5. Downstream services trust headers (internal network only).
|
|
73
|
+
|
|
74
|
+
### Benefits
|
|
75
|
+
- Auth logic in one place, not duplicated across services.
|
|
76
|
+
- Downstream services are simpler (no JWT library needed).
|
|
77
|
+
- Token refresh/rotation handled centrally.
|
|
78
|
+
|
|
79
|
+
### Security Considerations
|
|
80
|
+
- Strip incoming trust headers from external requests (prevent spoofing).
|
|
81
|
+
- Internal services MUST reject requests without gateway headers.
|
|
82
|
+
- Gateway must validate token on every request (no caching of auth decisions).
|
|
83
|
+
|
|
84
|
+
## Backend for Frontend (BFF)
|
|
85
|
+
|
|
86
|
+
### Pattern
|
|
87
|
+
- One gateway per client type: web, mobile, third-party.
|
|
88
|
+
- Each BFF tailored to client needs (field selection, aggregation).
|
|
89
|
+
- Mobile BFF: fewer fields, compressed responses, batch endpoints.
|
|
90
|
+
- Web BFF: full responses, pagination, real-time subscriptions.
|
|
91
|
+
- Third-party BFF: stable API, versioned, rate-limited.
|
|
92
|
+
|
|
93
|
+
### When to Use BFF
|
|
94
|
+
- Different clients need different data shapes.
|
|
95
|
+
- Mobile clients need response optimization (bandwidth).
|
|
96
|
+
- Third-party API needs different auth and rate limiting.
|
|
97
|
+
|
|
98
|
+
## Request Aggregation
|
|
99
|
+
|
|
100
|
+
### Pattern
|
|
101
|
+
- Client sends one request to gateway.
|
|
102
|
+
- Gateway fans out to multiple backend services.
|
|
103
|
+
- Gateway combines responses into single response.
|
|
104
|
+
- Returns aggregated result to client.
|
|
105
|
+
|
|
106
|
+
### Best Practices
|
|
107
|
+
- Set timeout per downstream call (don't wait forever).
|
|
108
|
+
- Return partial results if some backends fail (degrade gracefully).
|
|
109
|
+
- Cache individual backend responses independently.
|
|
110
|
+
- Use async/parallel calls to backends (not sequential).
|
|
111
|
+
|
|
112
|
+
## Circuit Breaking (Per-Route)
|
|
113
|
+
|
|
114
|
+
### States
|
|
115
|
+
- **Closed**: requests flow normally, failures counted.
|
|
116
|
+
- **Open**: requests immediately fail (503), no backend calls.
|
|
117
|
+
- **Half-Open**: allow one probe request to test recovery.
|
|
118
|
+
|
|
119
|
+
### Configuration Per Downstream
|
|
120
|
+
```yaml
|
|
121
|
+
payment-service:
|
|
122
|
+
failure_threshold: 5 # failures before opening
|
|
123
|
+
timeout: 10s # time in open state before half-open
|
|
124
|
+
success_threshold: 3 # successes in half-open to close
|
|
125
|
+
|
|
126
|
+
inventory-service:
|
|
127
|
+
failure_threshold: 10
|
|
128
|
+
timeout: 30s
|
|
129
|
+
success_threshold: 5
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Fallback Strategies
|
|
133
|
+
- Return cached response (stale but functional).
|
|
134
|
+
- Return default/empty response with degraded flag.
|
|
135
|
+
- Route to alternative backend (failover service).
|
|
136
|
+
|
|
137
|
+
## Gateway Caching
|
|
138
|
+
|
|
139
|
+
### What to Cache
|
|
140
|
+
- GET responses with stable data (product catalog, configuration).
|
|
141
|
+
- Use ETag/Last-Modified for conditional requests.
|
|
142
|
+
- Cache per-user or per-role (never cache authenticated data globally).
|
|
143
|
+
|
|
144
|
+
### What NOT to Cache
|
|
145
|
+
- POST/PUT/DELETE responses.
|
|
146
|
+
- Responses with `Cache-Control: no-store`.
|
|
147
|
+
- Responses containing PII without per-user isolation.
|
|
148
|
+
|
|
149
|
+
### Cache Invalidation at Gateway
|
|
150
|
+
- TTL-based (simple, eventual consistency).
|
|
151
|
+
- Purge API (explicit invalidation from backend on mutation).
|
|
152
|
+
- Surrogate keys (tag responses, purge by tag).
|
|
153
|
+
|
|
154
|
+
## Response Transformation
|
|
155
|
+
|
|
156
|
+
### Appropriate at Gateway
|
|
157
|
+
- Field filtering (client requests specific fields).
|
|
158
|
+
- Pagination wrapping (add metadata to list responses).
|
|
159
|
+
- Format conversion (JSON to XML for legacy clients).
|
|
160
|
+
- Header manipulation (add CORS, security headers).
|
|
161
|
+
|
|
162
|
+
### NOT Appropriate at Gateway
|
|
163
|
+
- Business logic transformation.
|
|
164
|
+
- Data enrichment from other services.
|
|
165
|
+
- Complex aggregation with business rules.
|
|
166
|
+
|
|
167
|
+
## Self-check before task completion
|
|
168
|
+
|
|
169
|
+
Before marking a task done when this skill was active:
|
|
170
|
+
|
|
171
|
+
- [ ] Did I read the full SKILL.md before starting? (Not just the triggers)
|
|
172
|
+
- [ ] Is gateway logic stateless?
|
|
173
|
+
- [ ] Are rate limits per-user (not just per-IP)?
|
|
174
|
+
- [ ] Are circuit breakers configured per downstream service?
|
|
175
|
+
- [ ] Is auth offloading stripping external trust headers?
|
|
176
|
+
- [ ] Is business logic kept out of the gateway?
|
|
177
|
+
- [ ] Are request correlation IDs generated at the gateway?
|