mindforge-cc 10.0.3 → 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 +25 -2
- package/.mindforge/engine/cross-model-eval.md +74 -0
- package/.mindforge/engine/proactive/signal-detector.md +60 -0
- package/.mindforge/engine/proactive/suggestion-engine.md +100 -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/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/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/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-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 +674 -44
- 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/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-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/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/contract-testing/SKILL.md +85 -0
- package/.mindforge/skills/cost-estimation/SKILL.md +82 -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/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-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/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 +13 -1
- 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 +176 -0
- package/MINDFORGE.md +4 -4
- package/package.json +2 -2
- package/.mindforge/personas/data-privacy-engineer.md +0 -187
|
@@ -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?
|
|
@@ -68,6 +68,18 @@ git diff --staged # or git diff main...HEAD
|
|
|
68
68
|
- Sensitive data exposure
|
|
69
69
|
- Logic errors visible in the diff
|
|
70
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
|
+
|
|
71
83
|
### Execution Rules
|
|
72
84
|
- Phases execute in ORDER (1→2→3→4→5→6)
|
|
73
85
|
- Each phase must PASS before the next begins (fail-fast)
|
|
@@ -82,4 +94,4 @@ git diff --staged # or git diff main...HEAD
|
|
|
82
94
|
|
|
83
95
|
### After verification passes
|
|
84
96
|
- Log verification result in AUDIT with per-phase timing
|
|
85
|
-
- Report: "All 6 verification gates passed. Safe to proceed."
|
|
97
|
+
- Report: "All 6 verification gates passed (+ Phase 6.5 advisory). Safe to proceed."
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vibe-security
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 10.0.5
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: vibe check security, quick security, rapid security, security intuition, fast security scan, security gut check, security quick look, attack surface quick, security sanity check, owasp quick, header check, security baseline
|
|
7
|
+
compose: security-review
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill — Vibe Security (Fast-Path Security Assessment)
|
|
11
|
+
|
|
12
|
+
## When this skill activates
|
|
13
|
+
|
|
14
|
+
When a rapid security assessment is needed (2-5 minutes) rather than a full
|
|
15
|
+
threat model (15-30 minutes). Use for quick sanity checks during development,
|
|
16
|
+
pre-commit security sweeps, or when something "feels off" about the security
|
|
17
|
+
posture. Covers the 7 most common vulnerability domains with actionable checks.
|
|
18
|
+
|
|
19
|
+
Core principle: **Speed over exhaustiveness** — catch the 80% of issues in 20%
|
|
20
|
+
of the time. Flag anything that needs deeper investigation for the full
|
|
21
|
+
security-review skill.
|
|
22
|
+
|
|
23
|
+
## Mandatory actions when this skill is active
|
|
24
|
+
|
|
25
|
+
### Before assessment begins
|
|
26
|
+
|
|
27
|
+
1. **Scope the check:**
|
|
28
|
+
- What changed? (diff-based: only assess modified/new code)
|
|
29
|
+
- What domain? (web app, API, CLI, library, infrastructure)
|
|
30
|
+
- What data sensitivity? (public, internal, PII, financial, health)
|
|
31
|
+
- Time budget: strictly 2-5 minutes (set a mental timer)
|
|
32
|
+
|
|
33
|
+
2. **Identify the attack surface:**
|
|
34
|
+
- Entry points: HTTP endpoints, CLI args, file inputs, env vars
|
|
35
|
+
- Data flows: user input → processing → storage → output
|
|
36
|
+
- Trust boundaries: client/server, service/service, internal/external
|
|
37
|
+
|
|
38
|
+
### During assessment
|
|
39
|
+
|
|
40
|
+
**Domain 1 — Access Control:**
|
|
41
|
+
- [ ] IDs are UUIDs, not sequential integers (prevents enumeration)
|
|
42
|
+
- [ ] Ownership verified at the data layer, not just the route layer
|
|
43
|
+
- [ ] Multi-tenant: org/team membership checked on every data access
|
|
44
|
+
- [ ] Admin endpoints have explicit role checks (not just "is authenticated")
|
|
45
|
+
- [ ] No horizontal privilege escalation (user A accessing user B's data)
|
|
46
|
+
|
|
47
|
+
**Domain 2 — XSS (Cross-Site Scripting):**
|
|
48
|
+
- [ ] Output encoding applied per context:
|
|
49
|
+
- HTML body: HTML entity encoding
|
|
50
|
+
- HTML attributes: attribute encoding
|
|
51
|
+
- JavaScript: JS string encoding
|
|
52
|
+
- URLs: percent encoding
|
|
53
|
+
- CSS: CSS encoding
|
|
54
|
+
- [ ] Content Security Policy (CSP) header present and restrictive
|
|
55
|
+
- [ ] DOMPurify or equivalent used for any user-generated HTML rendering
|
|
56
|
+
- [ ] No raw HTML injection patterns (e.g., innerHTML assignment from user input)
|
|
57
|
+
- [ ] React/framework auto-escaping not bypassed without sanitization
|
|
58
|
+
|
|
59
|
+
**Domain 3 — CSRF (Cross-Site Request Forgery):**
|
|
60
|
+
- [ ] CSRF tokens present on state-changing requests
|
|
61
|
+
- [ ] Tokens are session-tied and regenerated on login
|
|
62
|
+
- [ ] SameSite cookie attribute set (Lax minimum, Strict preferred)
|
|
63
|
+
- [ ] Double-submit cookie pattern as backup for API endpoints
|
|
64
|
+
- [ ] GET requests never perform state changes
|
|
65
|
+
|
|
66
|
+
**Domain 4 — SSRF (Server-Side Request Forgery):**
|
|
67
|
+
- [ ] URL allowlist validation (not blocklist — blocklists are bypassable)
|
|
68
|
+
- [ ] DNS rebinding prevention (resolve DNS, validate IP, THEN connect)
|
|
69
|
+
- [ ] Cloud metadata endpoint blocked: `169.254.169.254`, `fd00:ec2::254`
|
|
70
|
+
- [ ] Internal network ranges blocked: `10.x`, `172.16-31.x`, `192.168.x`
|
|
71
|
+
- [ ] IP bypass vectors checked (see catalog below)
|
|
72
|
+
|
|
73
|
+
**Domain 5 — SQL Injection:**
|
|
74
|
+
- [ ] All queries use parameterized statements (never string concatenation)
|
|
75
|
+
- [ ] ORM usage verified as safe (no raw query building from user input)
|
|
76
|
+
- [ ] Database user has least-privilege permissions (no DROP, no schema changes)
|
|
77
|
+
- [ ] Dynamic column/table names validated against allowlist (not user-controlled)
|
|
78
|
+
|
|
79
|
+
**Domain 6 — File Upload:**
|
|
80
|
+
- [ ] File type validated by magic bytes (not just extension)
|
|
81
|
+
- [ ] Files stored outside the webroot (not directly accessible via URL)
|
|
82
|
+
- [ ] Filename sanitized (stripped of path separators, null bytes, special chars)
|
|
83
|
+
- [ ] File size limits enforced server-side (not just client-side)
|
|
84
|
+
- [ ] Image files re-encoded to strip embedded scripts/metadata
|
|
85
|
+
|
|
86
|
+
**Domain 7 — Path Traversal:**
|
|
87
|
+
- [ ] Paths canonicalized before use (`path.resolve`, `realpath`)
|
|
88
|
+
- [ ] Resolved path validated against base directory (must be child of allowed dir)
|
|
89
|
+
- [ ] No user input used directly in filesystem paths
|
|
90
|
+
- [ ] Null byte injection prevented (relevant for older runtimes)
|
|
91
|
+
- [ ] Symlink following restricted or validated
|
|
92
|
+
|
|
93
|
+
**IP Bypass Catalog (for SSRF testing):**
|
|
94
|
+
```
|
|
95
|
+
127.0.0.1 variants:
|
|
96
|
+
- Decimal: 2130706433
|
|
97
|
+
- Octal: 017700000001
|
|
98
|
+
- Hex: 0x7f000001
|
|
99
|
+
- IPv6: ::1
|
|
100
|
+
- IPv6 mapped: ::ffff:127.0.0.1
|
|
101
|
+
- Short: 127.1
|
|
102
|
+
- Zero: 0.0.0.0
|
|
103
|
+
|
|
104
|
+
Cloud metadata:
|
|
105
|
+
- AWS: 169.254.169.254, fd00:ec2::254
|
|
106
|
+
- GCP: metadata.google.internal
|
|
107
|
+
- Azure: 169.254.169.254 (header: Metadata: true)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Security Headers Baseline:**
|
|
111
|
+
```
|
|
112
|
+
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
|
|
113
|
+
Content-Security-Policy: default-src 'self'; script-src 'self'
|
|
114
|
+
X-Content-Type-Options: nosniff
|
|
115
|
+
X-Frame-Options: DENY
|
|
116
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
117
|
+
Permissions-Policy: camera=(), microphone=(), geolocation=()
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- [ ] All 6 headers present in HTTP responses
|
|
121
|
+
- [ ] CSP does not include `unsafe-inline` or `unsafe-eval` without justification
|
|
122
|
+
|
|
123
|
+
### After assessment
|
|
124
|
+
|
|
125
|
+
1. **Generate VIBE-SECURITY-CHECK.md:**
|
|
126
|
+
```markdown
|
|
127
|
+
## Vibe Security Check — [date]
|
|
128
|
+
**Scope:** [what was assessed]
|
|
129
|
+
**Time spent:** [X minutes]
|
|
130
|
+
**Risk level:** LOW / MEDIUM / HIGH / CRITICAL
|
|
131
|
+
|
|
132
|
+
### Findings
|
|
133
|
+
| # | Domain | Finding | Severity | Remediation |
|
|
134
|
+
|---|--------|---------|----------|-------------|
|
|
135
|
+
| 1 | ... | ... | ... | ... |
|
|
136
|
+
|
|
137
|
+
### Headers Status
|
|
138
|
+
[present/missing for each of 6 headers]
|
|
139
|
+
|
|
140
|
+
### Needs Deeper Review
|
|
141
|
+
[list anything that requires full security-review skill]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. **Severity classification:**
|
|
145
|
+
- CRITICAL: Exploitable now, leads to data breach or auth bypass
|
|
146
|
+
- HIGH: Exploitable with moderate effort, significant impact
|
|
147
|
+
- MEDIUM: Requires specific conditions, limited impact
|
|
148
|
+
- LOW: Defense-in-depth improvement, not directly exploitable
|
|
149
|
+
|
|
150
|
+
3. **Escalation rules:**
|
|
151
|
+
- Any CRITICAL finding: STOP all other work, fix immediately
|
|
152
|
+
- 2+ HIGH findings: escalate to full `security-review` skill
|
|
153
|
+
- MEDIUM/LOW: add to backlog, fix in next sprint
|
|
154
|
+
|
|
155
|
+
## Self-check before task completion
|
|
156
|
+
|
|
157
|
+
Before marking a vibe security check done:
|
|
158
|
+
|
|
159
|
+
- [ ] Did I check all 7 domains (access control, XSS, CSRF, SSRF, SQLi, upload, path traversal)?
|
|
160
|
+
- [ ] Did I verify security headers (all 6 present and correctly configured)?
|
|
161
|
+
- [ ] Did I check for IP bypass vulnerabilities in any SSRF-adjacent code?
|
|
162
|
+
- [ ] Did I stay within the 5-minute time budget?
|
|
163
|
+
- [ ] Did I generate VIBE-SECURITY-CHECK.md with findings and severity?
|
|
164
|
+
- [ ] Did I escalate CRITICAL findings immediately?
|
|
165
|
+
- [ ] Did I flag items needing deeper review for the full security-review skill?
|