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,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threat-modeling
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.3
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: threat model, STRIDE, attack tree, DREAD, threat surface, trust boundary, attack vector, data flow diagram, DFD, adversary, threat assessment
|
|
7
|
+
compose:
|
|
8
|
+
- security-review
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Skill — Threat Modeling
|
|
12
|
+
|
|
13
|
+
## When this skill activates
|
|
14
|
+
When analyzing security threats to a system, component, or feature. When
|
|
15
|
+
constructing attack trees, identifying trust boundaries, or scoring risks
|
|
16
|
+
using structured methodologies.
|
|
17
|
+
|
|
18
|
+
## Mandatory actions when this skill is active
|
|
19
|
+
|
|
20
|
+
### Before threat modeling
|
|
21
|
+
1. Switch to `threat-modeler` persona.
|
|
22
|
+
2. Identify the **scope** — what system/component are we modeling?
|
|
23
|
+
3. Gather the system's **data flow** — how does data move through it?
|
|
24
|
+
4. Identify all **trust boundaries** — where does trust level change?
|
|
25
|
+
|
|
26
|
+
### STRIDE Methodology
|
|
27
|
+
|
|
28
|
+
Apply STRIDE to each trust boundary crossing:
|
|
29
|
+
|
|
30
|
+
| Threat | Question | Example |
|
|
31
|
+
|--------|----------|---------|
|
|
32
|
+
| **S**poofing | Can an attacker pretend to be someone else? | Forged auth tokens, session hijacking |
|
|
33
|
+
| **T**ampering | Can data be modified in transit or at rest? | Man-in-the-middle, DB manipulation |
|
|
34
|
+
| **R**epudiation | Can actions be denied without proof? | Missing audit logs, unsigned transactions |
|
|
35
|
+
| **I**nformation Disclosure | Can sensitive data leak? | Error messages with stack traces, verbose APIs |
|
|
36
|
+
| **D**enial of Service | Can the system be overwhelmed? | Unbounded queries, missing rate limits |
|
|
37
|
+
| **E**levation of Privilege | Can a user gain unauthorized access? | Missing authz checks, IDOR, path traversal |
|
|
38
|
+
|
|
39
|
+
### DREAD Scoring
|
|
40
|
+
|
|
41
|
+
Score each identified threat (1-10 for each dimension):
|
|
42
|
+
|
|
43
|
+
| Dimension | 1 (Low) | 5 (Medium) | 10 (High) |
|
|
44
|
+
|-----------|---------|------------|-----------|
|
|
45
|
+
| **D**amage | Minor inconvenience | Data loss for some users | Full system compromise |
|
|
46
|
+
| **R**eproducibility | Requires rare conditions | Requires specific setup | Anyone can reproduce |
|
|
47
|
+
| **E**xploitability | Requires deep expertise | Requires some skill | Script kiddie level |
|
|
48
|
+
| **A**ffected Users | Single user | Subset of users | All users |
|
|
49
|
+
| **D**iscoverability | Hidden, requires source | Findable with effort | Obvious, publicly known |
|
|
50
|
+
|
|
51
|
+
**Risk Score** = (D + R + E + A + D) / 5
|
|
52
|
+
- Score 1-3: Low risk (monitor)
|
|
53
|
+
- Score 4-6: Medium risk (mitigate within sprint)
|
|
54
|
+
- Score 7-10: High/Critical risk (mitigate IMMEDIATELY)
|
|
55
|
+
|
|
56
|
+
### Attack Tree Construction
|
|
57
|
+
|
|
58
|
+
For high-scoring threats, build an attack tree:
|
|
59
|
+
```
|
|
60
|
+
[Goal: Unauthorized admin access]
|
|
61
|
+
├── [OR] Steal admin credentials
|
|
62
|
+
│ ├── [AND] Phish admin user
|
|
63
|
+
│ │ ├── Send convincing email
|
|
64
|
+
│ │ └── Capture credentials on fake page
|
|
65
|
+
│ └── [AND] Exploit password reset
|
|
66
|
+
│ ├── Enumerate valid emails
|
|
67
|
+
│ └── Intercept reset token
|
|
68
|
+
└── [OR] Escalate from regular user
|
|
69
|
+
├── [AND] Exploit IDOR
|
|
70
|
+
│ ├── Find predictable resource IDs
|
|
71
|
+
│ └── Access admin endpoints directly
|
|
72
|
+
└── [AND] Exploit role assignment bug
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Output Format
|
|
76
|
+
|
|
77
|
+
Write to `.planning/THREAT-MODEL-[component]-[timestamp].md`:
|
|
78
|
+
```markdown
|
|
79
|
+
# Threat Model: [Component]
|
|
80
|
+
Date: [timestamp]
|
|
81
|
+
Scope: [what was analyzed]
|
|
82
|
+
|
|
83
|
+
## Data Flow Diagram
|
|
84
|
+
[ASCII or description of data flow with trust boundaries marked]
|
|
85
|
+
|
|
86
|
+
## Trust Boundaries
|
|
87
|
+
1. [boundary]: [what crosses it]
|
|
88
|
+
|
|
89
|
+
## Identified Threats
|
|
90
|
+
| # | Category | Threat | DREAD Score | Mitigation | Status |
|
|
91
|
+
|---|----------|--------|-------------|-----------|--------|
|
|
92
|
+
|
|
93
|
+
## Attack Trees (for High/Critical threats)
|
|
94
|
+
[Trees for any threat scoring 7+]
|
|
95
|
+
|
|
96
|
+
## Recommendations
|
|
97
|
+
[Prioritized list of mitigations]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### After threat modeling
|
|
101
|
+
- Review all High/Critical findings with security-reviewer persona
|
|
102
|
+
- Create action items for each unmitigated threat
|
|
103
|
+
- Log threat model in AUDIT with finding counts by severity
|
|
104
|
+
|
|
105
|
+
## Self-check before task completion
|
|
106
|
+
- [ ] Did I apply STRIDE to ALL trust boundary crossings (not just obvious ones)?
|
|
107
|
+
- [ ] Did I score every identified threat with DREAD?
|
|
108
|
+
- [ ] Did I build attack trees for all threats scoring 7+?
|
|
109
|
+
- [ ] Did I write the threat model to .planning/THREAT-MODEL-[component].md?
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tool-design
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.7
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: tool design, ai tool interface, tool input schema, tool output contract, idempotent tool design, tool batching strategy, tool composition pattern, tool discovery mechanism, tool error semantics, function calling design, zod schema design, json schema tool
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Tool Design
|
|
10
|
+
|
|
11
|
+
## When this skill activates
|
|
12
|
+
|
|
13
|
+
This skill activates when designing tools (functions, APIs, MCP servers) that AI agents will invoke. It covers input schema design, output contracts, idempotency, error handling, batching, composition, and discoverability. Use this skill whenever building interfaces between AI models and executable capabilities.
|
|
14
|
+
|
|
15
|
+
## Mandatory actions when this skill is active
|
|
16
|
+
|
|
17
|
+
### Before
|
|
18
|
+
|
|
19
|
+
1. **Identify the consumer** — Determine which AI model(s) will use this tool. Different models have different tool-calling behaviors and schema support.
|
|
20
|
+
2. **Define the capability boundary** — One tool should do one thing well. If describing the tool requires "and" twice, split it into multiple tools.
|
|
21
|
+
3. **Survey existing tools** — Check if an existing tool already covers this capability. Duplicate tools confuse AI selection.
|
|
22
|
+
4. **Assess side effects** — Classify the tool as read-only (safe to retry) or write (requires idempotency). This drives the entire error handling strategy.
|
|
23
|
+
|
|
24
|
+
### During
|
|
25
|
+
|
|
26
|
+
#### Tool Anatomy
|
|
27
|
+
|
|
28
|
+
Every tool must define these components:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
{
|
|
32
|
+
name: string, // verb_noun format: "search_files", "create_user"
|
|
33
|
+
description: string, // 1-2 sentences: what it does, when to use it, when NOT to use it
|
|
34
|
+
inputSchema: Schema, // Typed, validated, documented
|
|
35
|
+
outputSchema: Schema, // Typed, consistent across success/error
|
|
36
|
+
sideEffects: boolean, // Does it change state?
|
|
37
|
+
idempotent: boolean // Safe to call twice with same input?
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- **Name** — Use `verb_noun` format. Be specific: `search_codebase` not `search`. The model uses the name for selection.
|
|
42
|
+
- **Description** — This is the most important field for AI tool selection. Include: what it does, when to use it, when NOT to use it, and what it returns.
|
|
43
|
+
- **Negative guidance** — Tell the model when NOT to use the tool: "Do not use this for file reads; use read_file instead." Prevents misuse.
|
|
44
|
+
|
|
45
|
+
#### Schema Design
|
|
46
|
+
|
|
47
|
+
**TypeScript (Zod):**
|
|
48
|
+
```typescript
|
|
49
|
+
const inputSchema = z.object({
|
|
50
|
+
query: z.string().min(1).describe("Search query, supports regex"),
|
|
51
|
+
maxResults: z.number().int().min(1).max(100).default(10).describe("Max results to return"),
|
|
52
|
+
filePattern: z.string().optional().describe("Glob pattern to filter files, e.g. '*.ts'")
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Schema principles:**
|
|
57
|
+
- Every field has a `description`. The AI reads descriptions to understand how to populate fields.
|
|
58
|
+
- Use constrained types: `min`, `max`, `enum`, `pattern`. Tighter schemas = fewer invalid calls.
|
|
59
|
+
- Required fields first, optional fields with sensible defaults after.
|
|
60
|
+
- Prefer flat schemas over deeply nested objects. AI models handle flat structures more reliably.
|
|
61
|
+
- Use `enum` for fixed option sets. Never rely on the AI guessing valid values from a description alone.
|
|
62
|
+
|
|
63
|
+
#### Output Contract
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// Success
|
|
67
|
+
{ success: true, data: T, metadata: { duration_ms: number, cached: boolean } }
|
|
68
|
+
|
|
69
|
+
// Error
|
|
70
|
+
{ success: false, error: { code: string, message: string, retryable: boolean, context: object } }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **Consistent shape** — Success and error responses must share a common discriminator field (`success`). The AI parses both paths.
|
|
74
|
+
- **Typed error codes** — Use machine-readable codes: `FILE_NOT_FOUND`, `PERMISSION_DENIED`, `RATE_LIMITED`. Not just human messages.
|
|
75
|
+
- **Retryable flag** — Tell the AI whether retrying might work. This drives agent retry logic.
|
|
76
|
+
- **Context in errors** — Include what was attempted and why it failed: `{ attempted: "read /foo/bar.ts", reason: "file does not exist" }`.
|
|
77
|
+
|
|
78
|
+
#### Idempotency
|
|
79
|
+
|
|
80
|
+
- **Read operations** — Inherently idempotent. Safe to retry without side effects.
|
|
81
|
+
- **Write operations** — Require explicit idempotency design. Two approaches:
|
|
82
|
+
- **Idempotency key** — Client provides a unique key. Server deduplicates. Same key = same result.
|
|
83
|
+
- **Natural idempotency** — "set X to Y" is idempotent; "increment X" is not.
|
|
84
|
+
- **Implementation** — Store idempotency keys with TTL (24hr). Return cached result for duplicates. Critical because AI agents retry on network errors — non-idempotent tools create duplicates.
|
|
85
|
+
|
|
86
|
+
#### Error Semantics
|
|
87
|
+
|
|
88
|
+
| Error Category | Retryable | Agent Action |
|
|
89
|
+
|---------------|-----------|--------------|
|
|
90
|
+
| Validation error (bad input) | No | Fix input, call again |
|
|
91
|
+
| Not found | No | Report to user or try alternative |
|
|
92
|
+
| Permission denied | No | Escalate, request auth |
|
|
93
|
+
| Rate limited | Yes | Wait and retry with backoff |
|
|
94
|
+
| Timeout | Yes | Retry with longer timeout |
|
|
95
|
+
| Internal error | Maybe | Retry once, then escalate |
|
|
96
|
+
| Conflict (optimistic lock) | Yes | Re-read state, retry |
|
|
97
|
+
|
|
98
|
+
- **Never return bare strings for errors.** Always return typed error objects.
|
|
99
|
+
- **Include remediation hints** — If the error is fixable, tell the AI how: `"hint": "File path must be absolute. Received relative path."`.
|
|
100
|
+
|
|
101
|
+
#### Batching Strategy
|
|
102
|
+
|
|
103
|
+
- **When to batch** — Multiple independent calls that could be combined (e.g., reading 5 files in one call).
|
|
104
|
+
- **Batch input** — Accept arrays: `{ files: ["a.ts", "b.ts", "c.ts"] }` instead of 3 separate calls.
|
|
105
|
+
- **Partial success** — Report per-item results. Never all-or-nothing for batches.
|
|
106
|
+
- **Size limits** — Max 20 items per batch. Unbounded batches cause timeouts.
|
|
107
|
+
- **When NOT to batch** — Items with dependencies on each other's results require sequential calls.
|
|
108
|
+
|
|
109
|
+
#### Composition (Tools Calling Tools)
|
|
110
|
+
|
|
111
|
+
- **Max 2-depth** — Tool A can call Tool B, but B should not call C. Deep composition is impossible to debug.
|
|
112
|
+
- **Composition contracts** — Inner tools must have strict schemas. Outer tool validates intermediate results.
|
|
113
|
+
- **Transparency** — Document when tools call other tools internally.
|
|
114
|
+
- **Failure isolation** — Inner tool failures must be handled gracefully, not propagated raw.
|
|
115
|
+
|
|
116
|
+
#### Discovery Mechanism
|
|
117
|
+
|
|
118
|
+
- **Tool registry** — Catalog all tools with name, description, capability tags. Group by domain (file, search, git).
|
|
119
|
+
- **Descriptions for AI** — Optimize for AI selection ("when to use"), not human documentation.
|
|
120
|
+
- **Dynamic registration** — Tools added/removed at runtime must update the AI's available tool list.
|
|
121
|
+
|
|
122
|
+
### After
|
|
123
|
+
|
|
124
|
+
1. **Test with AI** — Verify the model selects correctly, provides valid inputs, and handles outputs properly.
|
|
125
|
+
2. **Test edge cases** — Invalid, empty, and max-size inputs. Verify error responses are informative.
|
|
126
|
+
3. **Measure latency** — Target <5 seconds for interactive use. Document selection criteria vs alternatives.
|
|
127
|
+
|
|
128
|
+
## Self-check before task completion
|
|
129
|
+
|
|
130
|
+
- [ ] Tool name follows verb_noun convention and is distinct from existing tools
|
|
131
|
+
- [ ] Description includes what, when to use, and when NOT to use
|
|
132
|
+
- [ ] Input schema has descriptions on every field with appropriate constraints
|
|
133
|
+
- [ ] Output contract is consistent (success/error discriminator, typed error codes)
|
|
134
|
+
- [ ] Write operations are idempotent (idempotency key or natural idempotency)
|
|
135
|
+
- [ ] Errors include retryable flag and remediation hints
|
|
136
|
+
- [ ] Batch operations support partial success/failure reporting
|
|
137
|
+
- [ ] Composition depth does not exceed 2 levels
|
|
138
|
+
- [ ] Tool tested with an AI model for correct selection and invocation
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-advanced
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.6
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: typescript advanced, generics pattern, conditional type, discriminated union, mapped type, template literal type, type inference pattern, utility type, type guard, type narrowing, branded type, variance annotation
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill — TypeScript Advanced Type Patterns
|
|
10
|
+
|
|
11
|
+
## When this skill activates
|
|
12
|
+
Any task involving advanced TypeScript type system features: generics design,
|
|
13
|
+
conditional types, discriminated unions, mapped types, template literal types,
|
|
14
|
+
branded types, variance annotations, or complex type inference patterns.
|
|
15
|
+
|
|
16
|
+
## Mandatory actions when this skill is active
|
|
17
|
+
|
|
18
|
+
### Before writing any code
|
|
19
|
+
1. Identify the type-level problem being solved. Ask: "What invalid states should
|
|
20
|
+
the type system make impossible?"
|
|
21
|
+
2. Check the project's `tsconfig.json` for `strict: true`. If not enabled, flag it
|
|
22
|
+
as a prerequisite for advanced type patterns to work correctly.
|
|
23
|
+
3. Determine if the pattern needs to be exported for consumers (public API types
|
|
24
|
+
require more careful design than internal utility types).
|
|
25
|
+
|
|
26
|
+
### During implementation
|
|
27
|
+
|
|
28
|
+
#### Generics
|
|
29
|
+
- Always add constraints to generic parameters: `<T extends BaseType>` not bare `<T>`.
|
|
30
|
+
- Provide defaults when there is a sensible one: `<T extends Record<string, unknown> = Record<string, unknown>>`.
|
|
31
|
+
- Place inference sites at the position where TypeScript can infer the type from usage:
|
|
32
|
+
```typescript
|
|
33
|
+
// Good: T is inferred from the argument
|
|
34
|
+
function wrap<T>(value: T): Wrapper<T>
|
|
35
|
+
// Bad: T cannot be inferred, caller must specify
|
|
36
|
+
function wrap<T>(): Wrapper<T>
|
|
37
|
+
```
|
|
38
|
+
- Avoid "generic soup" (3+ type parameters). If needed, use a config object type:
|
|
39
|
+
```typescript
|
|
40
|
+
type Config<TInput, TOutput, TError> = { ... }
|
|
41
|
+
function process<C extends Config<any, any, any>>(config: C): ...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Conditional Types
|
|
45
|
+
- Use `infer` keyword to extract types from structures:
|
|
46
|
+
```typescript
|
|
47
|
+
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
|
|
48
|
+
type ReturnOf<T> = T extends (...args: any[]) => infer R ? R : never;
|
|
49
|
+
```
|
|
50
|
+
- Understand distributive behavior: `T extends U ? X : Y` distributes over unions
|
|
51
|
+
when T is a naked type parameter. Wrap in `[T] extends [U]` to prevent distribution.
|
|
52
|
+
- Nest conditional types sparingly (max 3 levels). Extract intermediate types for clarity:
|
|
53
|
+
```typescript
|
|
54
|
+
// Instead of deeply nested conditionals
|
|
55
|
+
type Step1<T> = T extends Array<infer U> ? U : T;
|
|
56
|
+
type Step2<T> = Step1<T> extends object ? keyof Step1<T> : never;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Discriminated Unions
|
|
60
|
+
- Every variant MUST have a literal-typed discriminant field (typically `type` or `kind`):
|
|
61
|
+
```typescript
|
|
62
|
+
type Shape =
|
|
63
|
+
| { kind: "circle"; radius: number }
|
|
64
|
+
| { kind: "rectangle"; width: number; height: number }
|
|
65
|
+
| { kind: "triangle"; base: number; height: number };
|
|
66
|
+
```
|
|
67
|
+
- Implement exhaustive handling with `never` checks:
|
|
68
|
+
```typescript
|
|
69
|
+
function assertNever(x: never): never {
|
|
70
|
+
throw new Error(`Unexpected: ${JSON.stringify(x)}`);
|
|
71
|
+
}
|
|
72
|
+
function area(shape: Shape): number {
|
|
73
|
+
switch (shape.kind) {
|
|
74
|
+
case "circle": return Math.PI * shape.radius ** 2;
|
|
75
|
+
case "rectangle": return shape.width * shape.height;
|
|
76
|
+
case "triangle": return 0.5 * shape.base * shape.height;
|
|
77
|
+
default: return assertNever(shape);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
- Adding a new variant to the union automatically causes compile errors at every
|
|
82
|
+
switch/if that is missing the new case. This is the primary value.
|
|
83
|
+
|
|
84
|
+
#### Mapped Types
|
|
85
|
+
- Use key remapping (`as`) for transforming keys:
|
|
86
|
+
```typescript
|
|
87
|
+
type Getters<T> = {
|
|
88
|
+
[K in keyof T as `get${Capitalize<string & K>}`]: () => T[K];
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
- Use modifiers (`readonly`, `?`, `-readonly`, `-?`) deliberately:
|
|
92
|
+
```typescript
|
|
93
|
+
type Mutable<T> = { -readonly [K in keyof T]: T[K] };
|
|
94
|
+
type Required<T> = { [K in keyof T]-?: T[K] };
|
|
95
|
+
```
|
|
96
|
+
- Filter keys using `as` with `never`:
|
|
97
|
+
```typescript
|
|
98
|
+
type OnlyStrings<T> = {
|
|
99
|
+
[K in keyof T as T[K] extends string ? K : never]: T[K];
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Template Literal Types
|
|
104
|
+
- Use for string manipulation at the type level:
|
|
105
|
+
```typescript
|
|
106
|
+
type EventName<T extends string> = `on${Capitalize<T>}`;
|
|
107
|
+
type Route = `/${string}` | `/${string}/${string}`;
|
|
108
|
+
```
|
|
109
|
+
- Combine with mapped types for powerful API typing:
|
|
110
|
+
```typescript
|
|
111
|
+
type CSSProperties = {
|
|
112
|
+
[K in keyof CSSStyleDeclaration as K extends string
|
|
113
|
+
? `--${K}` | K
|
|
114
|
+
: never]: string;
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
- Use intrinsic string types: `Uppercase`, `Lowercase`, `Capitalize`, `Uncapitalize`.
|
|
118
|
+
|
|
119
|
+
#### Branded / Opaque Types
|
|
120
|
+
- Use for domain safety (preventing accidental misuse of primitive types):
|
|
121
|
+
```typescript
|
|
122
|
+
declare const brand: unique symbol;
|
|
123
|
+
type Brand<T, B> = T & { readonly [brand]: B };
|
|
124
|
+
|
|
125
|
+
type UserId = Brand<string, "UserId">;
|
|
126
|
+
type OrderId = Brand<string, "OrderId">;
|
|
127
|
+
|
|
128
|
+
// Now these are incompatible even though both are strings
|
|
129
|
+
function getUser(id: UserId): User { ... }
|
|
130
|
+
const orderId = "abc" as OrderId;
|
|
131
|
+
getUser(orderId); // Compile error!
|
|
132
|
+
```
|
|
133
|
+
- Provide constructor functions that validate at runtime:
|
|
134
|
+
```typescript
|
|
135
|
+
function createUserId(raw: string): UserId {
|
|
136
|
+
if (!raw.startsWith("usr_")) throw new Error("Invalid UserId format");
|
|
137
|
+
return raw as UserId;
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Variance Annotations
|
|
142
|
+
- Use `in` (contravariant) and `out` (covariant) on generic type parameters
|
|
143
|
+
for explicit variance when the compiler cannot infer it:
|
|
144
|
+
```typescript
|
|
145
|
+
type Consumer<in T> = (value: T) => void;
|
|
146
|
+
type Producer<out T> = () => T;
|
|
147
|
+
type Transformer<in I, out O> = (input: I) => O;
|
|
148
|
+
```
|
|
149
|
+
- Benefits: faster type checking, earlier error detection, documents intent.
|
|
150
|
+
- Only needed on interface/type alias declarations, not on function signatures.
|
|
151
|
+
|
|
152
|
+
#### The `satisfies` Operator
|
|
153
|
+
- Use `satisfies` to validate a value matches a type without widening:
|
|
154
|
+
```typescript
|
|
155
|
+
const palette = {
|
|
156
|
+
red: [255, 0, 0],
|
|
157
|
+
green: "#00ff00",
|
|
158
|
+
} satisfies Record<string, string | number[]>;
|
|
159
|
+
// palette.red is still number[] (not string | number[])
|
|
160
|
+
```
|
|
161
|
+
- Prefer `satisfies` over `as const` + type annotation when you need both
|
|
162
|
+
type checking AND narrow inference.
|
|
163
|
+
|
|
164
|
+
#### Type Guards and Narrowing
|
|
165
|
+
- Prefer `is` return type for custom type guards:
|
|
166
|
+
```typescript
|
|
167
|
+
function isCircle(shape: Shape): shape is { kind: "circle"; radius: number } {
|
|
168
|
+
return shape.kind === "circle";
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
- Use `asserts` for assertion functions that throw:
|
|
172
|
+
```typescript
|
|
173
|
+
function assertDefined<T>(val: T | undefined): asserts val is T {
|
|
174
|
+
if (val === undefined) throw new Error("Expected defined value");
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
- Prefer `in` operator narrowing for object type checks over `typeof` for complex objects.
|
|
178
|
+
|
|
179
|
+
### After implementation
|
|
180
|
+
1. Verify `npx tsc --noEmit` passes with zero errors.
|
|
181
|
+
2. Hover over inferred types in the IDE to confirm they resolve to expected shapes.
|
|
182
|
+
3. Write at least one "negative test" — a `// @ts-expect-error` comment proving the
|
|
183
|
+
type correctly rejects invalid usage.
|
|
184
|
+
4. Check that type computation does not cause noticeable IDE lag (overly recursive
|
|
185
|
+
types can crash the language server).
|
|
186
|
+
|
|
187
|
+
## Self-check before task completion
|
|
188
|
+
|
|
189
|
+
Before marking a task done when this skill was active:
|
|
190
|
+
|
|
191
|
+
- [ ] All generic type parameters have constraints (no bare `<T>` without `extends`).
|
|
192
|
+
- [ ] Discriminated unions have exhaustive switch/if with `never` fallback.
|
|
193
|
+
- [ ] No `any` types introduced (use `unknown` and narrow).
|
|
194
|
+
- [ ] Branded types have runtime validation constructors.
|
|
195
|
+
- [ ] Conditional types are no more than 3 levels deep.
|
|
196
|
+
- [ ] `@ts-expect-error` negative tests prove the types reject invalid input.
|
|
197
|
+
- [ ] `tsc --noEmit` passes cleanly.
|
|
198
|
+
- [ ] IDE responsiveness is acceptable (no type computation lag).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-git-worktrees
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.6
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: git worktree, worktree create, parallel workspace, isolated branch, worktree management, worktree cleanup, worktree per feature, multiple checkouts, worktree workflow, parallel git, worktree list, concurrent branches
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill — Using Git Worktrees
|
|
10
|
+
|
|
11
|
+
## When this skill activates
|
|
12
|
+
|
|
13
|
+
When working with multiple branches simultaneously, needing isolated working
|
|
14
|
+
directories for parallel development, or managing worktree lifecycle operations.
|
|
15
|
+
Worktrees allow multiple working trees attached to the same repository, sharing a
|
|
16
|
+
single `.git` directory. This eliminates stashing, context-switching overhead, and
|
|
17
|
+
the risk of uncommitted changes bleeding across tasks.
|
|
18
|
+
|
|
19
|
+
Use this skill when you need to:
|
|
20
|
+
- Work on a feature while reviewing another branch
|
|
21
|
+
- Test different branches simultaneously without cloning
|
|
22
|
+
- Maintain a clean main checkout while developing in parallel
|
|
23
|
+
- Set up dmux-style parallel pane workflows with filesystem isolation
|
|
24
|
+
|
|
25
|
+
## Mandatory actions when this skill is active
|
|
26
|
+
|
|
27
|
+
### Before creating worktrees
|
|
28
|
+
|
|
29
|
+
1. **Understand the model:**
|
|
30
|
+
- A worktree is a separate working directory linked to the same `.git` store
|
|
31
|
+
- All worktrees share the same refs, remotes, and object database
|
|
32
|
+
- Changes committed in any worktree are immediately visible to all others
|
|
33
|
+
- The "main" worktree is the original clone; "linked" worktrees are additions
|
|
34
|
+
|
|
35
|
+
2. **Pre-flight checks:**
|
|
36
|
+
- Verify the target branch does not already have a worktree checked out
|
|
37
|
+
(git does NOT allow the same branch in two worktrees simultaneously)
|
|
38
|
+
- Ensure the parent directory for new worktrees exists
|
|
39
|
+
- Confirm submodule state if the repo uses submodules (they require manual init)
|
|
40
|
+
- Check available disk space — each worktree is a full working copy
|
|
41
|
+
|
|
42
|
+
3. **Naming convention (mandatory):**
|
|
43
|
+
- Store worktrees in a sibling `.worktrees/` directory:
|
|
44
|
+
```
|
|
45
|
+
project/ # main worktree
|
|
46
|
+
project/.worktrees/
|
|
47
|
+
feat-auth/ # linked worktree for auth feature
|
|
48
|
+
fix-payments/ # linked worktree for payments bug
|
|
49
|
+
review-pr-42/ # linked worktree for PR review
|
|
50
|
+
```
|
|
51
|
+
- Name pattern: `[type]-[short-description]` matching branch suffix
|
|
52
|
+
- Never nest worktrees inside the main worktree directory
|
|
53
|
+
|
|
54
|
+
### During worktree usage
|
|
55
|
+
|
|
56
|
+
**Core commands:**
|
|
57
|
+
|
|
58
|
+
| Operation | Command |
|
|
59
|
+
|-----------|---------|
|
|
60
|
+
| Create from existing branch | `git worktree add ../.worktrees/[name] [branch]` |
|
|
61
|
+
| Create with new branch | `git worktree add -b feat/[name] ../.worktrees/[name]` |
|
|
62
|
+
| List all worktrees | `git worktree list` |
|
|
63
|
+
| Show worktree details | `git worktree list --verbose` |
|
|
64
|
+
| Remove a worktree | `git worktree remove ../.worktrees/[name]` |
|
|
65
|
+
| Force remove (dirty) | `git worktree remove --force ../.worktrees/[name]` |
|
|
66
|
+
| Clean stale entries | `git worktree prune` |
|
|
67
|
+
| Lock (prevent prune) | `git worktree lock ../.worktrees/[name]` |
|
|
68
|
+
| Unlock | `git worktree unlock ../.worktrees/[name]` |
|
|
69
|
+
|
|
70
|
+
**Workflow patterns:**
|
|
71
|
+
|
|
72
|
+
1. **Feature + Review parallel:**
|
|
73
|
+
```bash
|
|
74
|
+
# Continue working on your feature
|
|
75
|
+
git worktree add -b feat/new-api ../.worktrees/feat-new-api
|
|
76
|
+
# Simultaneously review a colleague's PR
|
|
77
|
+
git worktree add ../.worktrees/review-pr-42 origin/feat/their-branch
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
2. **Test across branches:**
|
|
81
|
+
```bash
|
|
82
|
+
git worktree add ../.worktrees/test-main main
|
|
83
|
+
git worktree add ../.worktrees/test-release release/2.0
|
|
84
|
+
# Run test suites in each directory independently
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. **Integration with dmux-workflows:**
|
|
88
|
+
- One tmux pane per worktree
|
|
89
|
+
- Each pane cd's into its worktree directory
|
|
90
|
+
- Each agent instance operates with full filesystem isolation
|
|
91
|
+
- Merge happens sequentially after all panes complete
|
|
92
|
+
|
|
93
|
+
**Gotchas and constraints:**
|
|
94
|
+
- Cannot checkout the same branch in two worktrees — git enforces this
|
|
95
|
+
- Submodules are NOT automatically initialized in linked worktrees; run
|
|
96
|
+
`git submodule update --init` in each new worktree if needed
|
|
97
|
+
- `.gitignore`'d build artifacts are per-worktree (each has its own node_modules,
|
|
98
|
+
build output, etc.)
|
|
99
|
+
- IDE settings (`.vscode/`, `.idea/`) are per-worktree — configure each separately
|
|
100
|
+
- Hooks in `.git/hooks/` are shared across all worktrees
|
|
101
|
+
- `git stash` is shared — stashes from one worktree are visible in all
|
|
102
|
+
|
|
103
|
+
### After worktree usage
|
|
104
|
+
|
|
105
|
+
1. **Cleanup protocol (mandatory after merge):**
|
|
106
|
+
```bash
|
|
107
|
+
# Verify the branch is fully merged
|
|
108
|
+
git branch --merged main | grep [branch-name]
|
|
109
|
+
# Remove the worktree
|
|
110
|
+
git worktree remove ../.worktrees/[name]
|
|
111
|
+
# Delete the branch if no longer needed
|
|
112
|
+
git branch -d [branch-name]
|
|
113
|
+
# Prune any stale worktree references
|
|
114
|
+
git worktree prune
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
2. **Never leave stale worktrees:**
|
|
118
|
+
- Stale worktrees consume disk space and pollute `git worktree list`
|
|
119
|
+
- After every merge or abandoned branch: remove the corresponding worktree
|
|
120
|
+
- Run `git worktree prune` weekly as maintenance hygiene
|
|
121
|
+
- Use `git worktree list` to audit — if a worktree's branch no longer exists
|
|
122
|
+
on remote, it is likely stale
|
|
123
|
+
|
|
124
|
+
3. **Post-cleanup verification:**
|
|
125
|
+
- `git worktree list` shows only the main worktree (or active ones)
|
|
126
|
+
- No orphaned directories remain in `.worktrees/`
|
|
127
|
+
- `git branch -v` shows no dangling local branches from removed worktrees
|
|
128
|
+
|
|
129
|
+
## Self-check before task completion
|
|
130
|
+
|
|
131
|
+
Before marking a worktree-related task done:
|
|
132
|
+
|
|
133
|
+
- [ ] Did I use the `.worktrees/` sibling directory convention?
|
|
134
|
+
- [ ] Did I verify the target branch was not already checked out elsewhere?
|
|
135
|
+
- [ ] Did I handle submodule initialization if applicable?
|
|
136
|
+
- [ ] Did I clean up worktrees after their purpose was fulfilled?
|
|
137
|
+
- [ ] Did I run `git worktree prune` to remove stale references?
|
|
138
|
+
- [ ] Did I delete merged branches that no longer need worktrees?
|
|
139
|
+
- [ ] Did I verify `git worktree list` shows a clean state?
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-loop
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.3
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: verification, quality gate, build check, type check, full verification, security scan, diff review, pre-merge, CI gate, green build, ship check, verify all
|
|
7
|
+
compose:
|
|
8
|
+
- security-review
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Skill — Verification Loop (6-Phase Quality Gate)
|
|
12
|
+
|
|
13
|
+
## When this skill activates
|
|
14
|
+
Before shipping, merging, or marking any implementation task as complete.
|
|
15
|
+
Provides a systematic 6-phase verification pipeline that catches issues
|
|
16
|
+
at the cheapest point to fix them.
|
|
17
|
+
|
|
18
|
+
## Mandatory actions when this skill is active
|
|
19
|
+
|
|
20
|
+
### The 6 Phases (sequential, fail-fast)
|
|
21
|
+
|
|
22
|
+
**Phase 1 — Build**
|
|
23
|
+
```bash
|
|
24
|
+
npm run build # or equivalent for project
|
|
25
|
+
```
|
|
26
|
+
- Must produce zero errors
|
|
27
|
+
- Warnings are acceptable but logged
|
|
28
|
+
- If build fails: fix before proceeding (no skipping)
|
|
29
|
+
|
|
30
|
+
**Phase 2 — Type Check**
|
|
31
|
+
```bash
|
|
32
|
+
npx tsc --noEmit # or equivalent
|
|
33
|
+
```
|
|
34
|
+
- All type errors must be resolved
|
|
35
|
+
- No `@ts-ignore` without documented reason
|
|
36
|
+
- Generic `any` types flagged as warnings
|
|
37
|
+
|
|
38
|
+
**Phase 3 — Lint**
|
|
39
|
+
```bash
|
|
40
|
+
npm run lint
|
|
41
|
+
```
|
|
42
|
+
- All lint errors must be resolved
|
|
43
|
+
- Auto-fixable issues: fix immediately (`--fix`)
|
|
44
|
+
- Non-auto-fixable: resolve manually before proceeding
|
|
45
|
+
|
|
46
|
+
**Phase 4 — Test**
|
|
47
|
+
```bash
|
|
48
|
+
npm test
|
|
49
|
+
```
|
|
50
|
+
- All tests must pass (zero failures)
|
|
51
|
+
- No skipped tests without documented reason
|
|
52
|
+
- If new code was added: verify test coverage exists
|
|
53
|
+
- Coverage threshold: per project config (default 80%)
|
|
54
|
+
|
|
55
|
+
**Phase 5 — Security Scan**
|
|
56
|
+
- Check for hardcoded secrets (grep for API keys, passwords, tokens)
|
|
57
|
+
- Check for new dependencies with known vulnerabilities
|
|
58
|
+
- Verify no dangerous code execution patterns (dynamic code evaluation, innerHTML, SQL concatenation) introduced
|
|
59
|
+
- Run security-review skill checklist on the diff
|
|
60
|
+
|
|
61
|
+
**Phase 6 — Diff Review**
|
|
62
|
+
```bash
|
|
63
|
+
git diff --staged # or git diff main...HEAD
|
|
64
|
+
```
|
|
65
|
+
- Review every changed line for:
|
|
66
|
+
- Accidental debug code (console.log, debugger, TODO)
|
|
67
|
+
- Unintended file changes (lock files, configs)
|
|
68
|
+
- Sensitive data exposure
|
|
69
|
+
- Logic errors visible in the diff
|
|
70
|
+
|
|
71
|
+
**Phase 6.5 — De-Slop Scan (Informational)**
|
|
72
|
+
- Run de-sloppify skill in dry-run scan mode on the current diff
|
|
73
|
+
- Report findings count per category:
|
|
74
|
+
- Debug code (console.log, debugger, print statements)
|
|
75
|
+
- Test slop (skipped tests, test-only exports)
|
|
76
|
+
- Commented code blocks (3+ consecutive commented lines)
|
|
77
|
+
- Naming inconsistencies (mixed camelCase/snake_case)
|
|
78
|
+
- TODO hacks (shipped workarounds disguised as TODOs)
|
|
79
|
+
- This phase is **INFORMATIONAL ONLY** — it does NOT block shipping
|
|
80
|
+
- If findings > 0: append summary to verification output as advisory
|
|
81
|
+
- Rationale: awareness of residual slop before shipping, without blocking velocity
|
|
82
|
+
|
|
83
|
+
### Execution Rules
|
|
84
|
+
- Phases execute in ORDER (1→2→3→4→5→6)
|
|
85
|
+
- Each phase must PASS before the next begins (fail-fast)
|
|
86
|
+
- On failure: report which phase failed, what the error is, suggest fix
|
|
87
|
+
- After fixing: restart from the FAILED phase (not from Phase 1)
|
|
88
|
+
- All 6 phases passing = "green" verification = safe to ship
|
|
89
|
+
|
|
90
|
+
### Integration
|
|
91
|
+
- `/mindforge:verify-loop` invokes this full pipeline
|
|
92
|
+
- `/mindforge:ship` MUST run verify-loop before proceeding
|
|
93
|
+
- Autonomous mode runs verify-loop after every task (Phase 4+5+6 minimum)
|
|
94
|
+
|
|
95
|
+
### After verification passes
|
|
96
|
+
- Log verification result in AUDIT with per-phase timing
|
|
97
|
+
- Report: "All 6 verification gates passed (+ Phase 6.5 advisory). Safe to proceed."
|