@cubis/foundry 0.3.71 → 0.3.73
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/CHANGELOG.md +23 -2
- package/dist/cli/core.js +9 -22
- package/dist/cli/core.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/core.ts +13 -22
- package/workflows/powers/accessibility/POWER.md +83 -94
- package/workflows/powers/accessibility/SKILL.md +82 -94
- package/workflows/powers/agent-design/POWER.md +201 -0
- package/workflows/powers/agent-design/SKILL.md +198 -0
- package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
- package/workflows/powers/agent-design/references/skill-testing.md +164 -0
- package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
- package/workflows/powers/agentic-eval/POWER.md +62 -0
- package/workflows/powers/agentic-eval/SKILL.md +59 -0
- package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
- package/workflows/powers/api-designer/POWER.md +43 -71
- package/workflows/powers/api-designer/SKILL.md +43 -71
- package/workflows/powers/api-patterns/POWER.md +42 -56
- package/workflows/powers/api-patterns/SKILL.md +42 -57
- package/workflows/powers/architecture-designer/POWER.md +43 -60
- package/workflows/powers/architecture-designer/SKILL.md +43 -60
- package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
- package/workflows/powers/auth-architect/POWER.md +69 -0
- package/workflows/powers/auth-architect/SKILL.md +66 -0
- package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
- package/workflows/powers/behavioral-modes/POWER.md +100 -9
- package/workflows/powers/c-pro/POWER.md +105 -0
- package/workflows/powers/c-pro/SKILL.md +102 -0
- package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
- package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
- package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
- package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
- package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
- package/workflows/powers/changelog-generator/POWER.md +127 -63
- package/workflows/powers/changelog-generator/SKILL.md +126 -63
- package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
- package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
- package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
- package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
- package/workflows/powers/cli-developer/POWER.md +152 -95
- package/workflows/powers/cli-developer/SKILL.md +152 -95
- package/workflows/powers/cpp-pro/POWER.md +111 -0
- package/workflows/powers/cpp-pro/SKILL.md +108 -0
- package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
- package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
- package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
- package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
- package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
- package/workflows/powers/csharp-pro/POWER.md +47 -22
- package/workflows/powers/csharp-pro/SKILL.md +47 -22
- package/workflows/powers/dart-pro/POWER.md +68 -0
- package/workflows/powers/dart-pro/SKILL.md +65 -0
- package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
- package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
- package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
- package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
- package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
- package/workflows/powers/database-design/POWER.md +47 -33
- package/workflows/powers/database-design/SKILL.md +47 -33
- package/workflows/powers/database-optimizer/POWER.md +43 -64
- package/workflows/powers/database-optimizer/SKILL.md +43 -64
- package/workflows/powers/database-skills/POWER.md +59 -93
- package/workflows/powers/database-skills/SKILL.md +59 -93
- package/workflows/powers/debugging-strategies/POWER.md +69 -0
- package/workflows/powers/debugging-strategies/SKILL.md +66 -0
- package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
- package/workflows/powers/deep-research/POWER.md +67 -0
- package/workflows/powers/deep-research/SKILL.md +64 -0
- package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
- package/workflows/powers/design-system-builder/POWER.md +130 -116
- package/workflows/powers/design-system-builder/SKILL.md +130 -116
- package/workflows/powers/devops-engineer/POWER.md +120 -57
- package/workflows/powers/devops-engineer/SKILL.md +120 -57
- package/workflows/powers/docker-kubernetes/POWER.md +94 -0
- package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
- package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
- package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
- package/workflows/powers/documentation-templates/POWER.md +158 -127
- package/workflows/powers/documentation-templates/SKILL.md +158 -127
- package/workflows/powers/drizzle-expert/POWER.md +66 -0
- package/workflows/powers/drizzle-expert/SKILL.md +63 -0
- package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
- package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
- package/workflows/powers/error-ux-observability/POWER.md +144 -131
- package/workflows/powers/error-ux-observability/SKILL.md +143 -131
- package/workflows/powers/fastapi-expert/POWER.md +46 -60
- package/workflows/powers/fastapi-expert/SKILL.md +46 -60
- package/workflows/powers/firebase/POWER.md +65 -0
- package/workflows/powers/firebase/SKILL.md +62 -0
- package/workflows/powers/firebase/references/platform-routing.md +16 -0
- package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
- package/workflows/powers/flutter-design-system/POWER.md +63 -0
- package/workflows/powers/flutter-design-system/SKILL.md +60 -0
- package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
- package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
- package/workflows/powers/flutter-drift/POWER.md +65 -0
- package/workflows/powers/flutter-drift/SKILL.md +62 -0
- package/workflows/powers/flutter-drift/references/migrations.md +22 -0
- package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
- package/workflows/powers/flutter-feature/POWER.md +65 -0
- package/workflows/powers/flutter-feature/SKILL.md +62 -0
- package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
- package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
- package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
- package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
- package/workflows/powers/flutter-go-router/POWER.md +64 -0
- package/workflows/powers/flutter-go-router/SKILL.md +61 -0
- package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
- package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
- package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
- package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
- package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
- package/workflows/powers/flutter-repository/POWER.md +64 -0
- package/workflows/powers/flutter-repository/SKILL.md +61 -0
- package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
- package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
- package/workflows/powers/flutter-riverpod/POWER.md +70 -0
- package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
- package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
- package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
- package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
- package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
- package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
- package/workflows/powers/flutter-state-machine/POWER.md +62 -0
- package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
- package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
- package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
- package/workflows/powers/flutter-testing/POWER.md +64 -0
- package/workflows/powers/flutter-testing/SKILL.md +61 -0
- package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
- package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
- package/workflows/powers/frontend-code-review/POWER.md +137 -0
- package/workflows/powers/frontend-code-review/SKILL.md +134 -0
- package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
- package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
- package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
- package/workflows/powers/frontend-design/POWER.md +163 -362
- package/workflows/powers/frontend-design/SKILL.md +163 -362
- package/workflows/powers/game-development/POWER.md +57 -140
- package/workflows/powers/game-development/SKILL.md +57 -140
- package/workflows/powers/geo-fundamentals/POWER.md +64 -126
- package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
- package/workflows/powers/git-workflow/POWER.md +135 -0
- package/workflows/powers/git-workflow/SKILL.md +132 -0
- package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
- package/workflows/powers/golang-pro/POWER.md +46 -35
- package/workflows/powers/golang-pro/SKILL.md +46 -35
- package/workflows/powers/graphql-architect/POWER.md +44 -62
- package/workflows/powers/graphql-architect/SKILL.md +44 -62
- package/workflows/powers/i18n-localization/POWER.md +118 -103
- package/workflows/powers/i18n-localization/SKILL.md +118 -103
- package/workflows/powers/java-pro/POWER.md +47 -22
- package/workflows/powers/java-pro/SKILL.md +47 -22
- package/workflows/powers/javascript-pro/POWER.md +47 -34
- package/workflows/powers/javascript-pro/SKILL.md +47 -34
- package/workflows/powers/kotlin-pro/POWER.md +46 -23
- package/workflows/powers/kotlin-pro/SKILL.md +46 -23
- package/workflows/powers/legacy-modernizer/POWER.md +43 -60
- package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
- package/workflows/powers/mcp-builder/POWER.md +65 -0
- package/workflows/powers/mcp-builder/SKILL.md +62 -0
- package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
- package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
- package/workflows/powers/microservices-architect/POWER.md +43 -70
- package/workflows/powers/microservices-architect/SKILL.md +43 -70
- package/workflows/powers/mobile-design/POWER.md +110 -345
- package/workflows/powers/mobile-design/SKILL.md +110 -345
- package/workflows/powers/mongodb/POWER.md +67 -0
- package/workflows/powers/mongodb/SKILL.md +64 -0
- package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
- package/workflows/powers/mysql/POWER.md +67 -0
- package/workflows/powers/mysql/SKILL.md +64 -0
- package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
- package/workflows/powers/neki/POWER.md +67 -0
- package/workflows/powers/neki/SKILL.md +64 -0
- package/workflows/powers/neki/references/neki-checklist.md +18 -0
- package/workflows/powers/nestjs-expert/POWER.md +45 -91
- package/workflows/powers/nestjs-expert/SKILL.md +45 -91
- package/workflows/powers/nextjs-developer/POWER.md +51 -44
- package/workflows/powers/nextjs-developer/SKILL.md +51 -44
- package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
- package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
- package/workflows/powers/observability/POWER.md +109 -0
- package/workflows/powers/observability/SKILL.md +106 -0
- package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
- package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
- package/workflows/powers/openai-docs/POWER.md +61 -0
- package/workflows/powers/openai-docs/SKILL.md +58 -0
- package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
- package/workflows/powers/performance-profiling/POWER.md +61 -114
- package/workflows/powers/performance-profiling/SKILL.md +61 -114
- package/workflows/powers/php-pro/POWER.md +116 -0
- package/workflows/powers/php-pro/SKILL.md +113 -0
- package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
- package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
- package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
- package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
- package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
- package/workflows/powers/playwright-e2e/POWER.md +85 -0
- package/workflows/powers/playwright-e2e/SKILL.md +82 -0
- package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
- package/workflows/powers/postgres/POWER.md +67 -0
- package/workflows/powers/postgres/SKILL.md +64 -0
- package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
- package/workflows/powers/prompt-engineer/POWER.md +47 -30
- package/workflows/powers/prompt-engineer/SKILL.md +47 -30
- package/workflows/powers/python-pro/POWER.md +47 -36
- package/workflows/powers/python-pro/SKILL.md +47 -36
- package/workflows/powers/react-best-practices/POWER.md +56 -33
- package/workflows/powers/react-best-practices/SKILL.md +56 -33
- package/workflows/powers/react-expert/POWER.md +47 -37
- package/workflows/powers/react-expert/SKILL.md +47 -37
- package/workflows/powers/redis/POWER.md +67 -0
- package/workflows/powers/redis/SKILL.md +64 -0
- package/workflows/powers/redis/references/redis-checklist.md +19 -0
- package/workflows/powers/ruby-pro/POWER.md +118 -0
- package/workflows/powers/ruby-pro/SKILL.md +115 -0
- package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
- package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
- package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
- package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
- package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
- package/workflows/powers/rust-pro/POWER.md +45 -31
- package/workflows/powers/rust-pro/SKILL.md +45 -31
- package/workflows/powers/security-engineer/POWER.md +129 -0
- package/workflows/powers/security-engineer/SKILL.md +126 -0
- package/workflows/powers/seo-fundamentals/POWER.md +59 -102
- package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
- package/workflows/powers/serverless-patterns/POWER.md +171 -0
- package/workflows/powers/serverless-patterns/SKILL.md +168 -0
- package/workflows/powers/skill-creator/POWER.md +90 -0
- package/workflows/powers/skill-creator/SKILL.md +87 -0
- package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
- package/workflows/powers/skill-creator/references/schemas.md +430 -0
- package/workflows/powers/spec-miner/POWER.md +49 -57
- package/workflows/powers/spec-miner/SKILL.md +49 -57
- package/workflows/powers/sqlite/POWER.md +67 -0
- package/workflows/powers/sqlite/SKILL.md +64 -0
- package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
- package/workflows/powers/sre-engineer/POWER.md +123 -64
- package/workflows/powers/sre-engineer/SKILL.md +123 -64
- package/workflows/powers/static-analysis/POWER.md +121 -77
- package/workflows/powers/static-analysis/SKILL.md +121 -77
- package/workflows/powers/stripe-best-practices/POWER.md +140 -17
- package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
- package/workflows/powers/supabase/POWER.md +67 -0
- package/workflows/powers/supabase/SKILL.md +64 -0
- package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
- package/workflows/powers/swift-pro/POWER.md +118 -0
- package/workflows/powers/swift-pro/SKILL.md +115 -0
- package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
- package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
- package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
- package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
- package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
- package/workflows/powers/tailwind-patterns/POWER.md +71 -240
- package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
- package/workflows/powers/testing-patterns/POWER.md +155 -10
- package/workflows/powers/testing-patterns/SKILL.md +155 -10
- package/workflows/powers/typescript-pro/POWER.md +47 -38
- package/workflows/powers/typescript-pro/SKILL.md +47 -38
- package/workflows/powers/vitess/POWER.md +67 -0
- package/workflows/powers/vitess/SKILL.md +64 -0
- package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
- package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
- package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
- package/workflows/powers/web-perf/POWER.md +43 -170
- package/workflows/powers/web-perf/SKILL.md +43 -170
- package/workflows/powers/webapp-testing/POWER.md +43 -164
- package/workflows/powers/webapp-testing/SKILL.md +43 -164
- package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +65 -42
- package/workflows/workflows/agent-environment-setup/platforms/claude/rules/CLAUDE.md +8 -6
- package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +65 -41
- package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/copilot-instructions.md +8 -6
- package/workflows/workflows/agent-environment-setup/shared/rules/STEERING.md +9 -8
- package/workflows/workflows/agent-environment-setup/shared/rules/overrides/codex.md +1 -1
|
@@ -1,269 +1,100 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tailwind-patterns
|
|
3
|
-
description: Tailwind CSS v4
|
|
4
|
-
|
|
3
|
+
description: "Use for Tailwind CSS v4 architecture, CSS-first theme setup, utility composition, container-query usage, design-token hygiene, and dark-mode strategy."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: cubis-foundry
|
|
7
|
+
version: "4.0"
|
|
8
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
5
9
|
---
|
|
6
10
|
|
|
7
|
-
# Tailwind
|
|
11
|
+
# Tailwind Patterns
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Purpose
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## 1. Tailwind v4 Architecture
|
|
14
|
-
|
|
15
|
-
### What Changed from v3
|
|
16
|
-
|
|
17
|
-
| v3 (Legacy) | v4 (Current) |
|
|
18
|
-
|-------------|--------------|
|
|
19
|
-
| `tailwind.config.js` | CSS-based `@theme` directive |
|
|
20
|
-
| PostCSS plugin | Oxide engine (10x faster) |
|
|
21
|
-
| JIT mode | Native, always-on |
|
|
22
|
-
| Plugin system | CSS-native features |
|
|
23
|
-
| `@apply` directive | Still works, discouraged |
|
|
24
|
-
|
|
25
|
-
### v4 Core Concepts
|
|
26
|
-
|
|
27
|
-
| Concept | Description |
|
|
28
|
-
|---------|-------------|
|
|
29
|
-
| **CSS-first** | Configuration in CSS, not JavaScript |
|
|
30
|
-
| **Oxide Engine** | Rust-based compiler, much faster |
|
|
31
|
-
| **Native Nesting** | CSS nesting without PostCSS |
|
|
32
|
-
| **CSS Variables** | All tokens exposed as `--*` vars |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 2. CSS-Based Configuration
|
|
37
|
-
|
|
38
|
-
### Theme Definition
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
@theme {
|
|
42
|
-
/* Colors - use semantic names */
|
|
43
|
-
--color-primary: oklch(0.7 0.15 250);
|
|
44
|
-
--color-surface: oklch(0.98 0 0);
|
|
45
|
-
--color-surface-dark: oklch(0.15 0 0);
|
|
46
|
-
|
|
47
|
-
/* Spacing scale */
|
|
48
|
-
--spacing-xs: 0.25rem;
|
|
49
|
-
--spacing-sm: 0.5rem;
|
|
50
|
-
--spacing-md: 1rem;
|
|
51
|
-
--spacing-lg: 2rem;
|
|
52
|
-
|
|
53
|
-
/* Typography */
|
|
54
|
-
--font-sans: 'Inter', system-ui, sans-serif;
|
|
55
|
-
--font-mono: 'JetBrains Mono', monospace;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### When to Extend vs Override
|
|
60
|
-
|
|
61
|
-
| Action | Use When |
|
|
62
|
-
|--------|----------|
|
|
63
|
-
| **Extend** | Adding new values alongside defaults |
|
|
64
|
-
| **Override** | Replacing default scale entirely |
|
|
65
|
-
| **Semantic tokens** | Project-specific naming (primary, surface) |
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## 3. Container Queries (v4 Native)
|
|
70
|
-
|
|
71
|
-
### Breakpoint vs Container
|
|
72
|
-
|
|
73
|
-
| Type | Responds To |
|
|
74
|
-
|------|-------------|
|
|
75
|
-
| **Breakpoint** (`md:`) | Viewport width |
|
|
76
|
-
| **Container** (`@container`) | Parent element width |
|
|
77
|
-
|
|
78
|
-
### Container Query Usage
|
|
79
|
-
|
|
80
|
-
| Pattern | Classes |
|
|
81
|
-
|---------|---------|
|
|
82
|
-
| Define container | `@container` on parent |
|
|
83
|
-
| Container breakpoint | `@sm:`, `@md:`, `@lg:` on children |
|
|
84
|
-
| Named containers | `@container/card` for specificity |
|
|
85
|
-
|
|
86
|
-
### When to Use
|
|
87
|
-
|
|
88
|
-
| Scenario | Use |
|
|
89
|
-
|----------|-----|
|
|
90
|
-
| Page-level layouts | Viewport breakpoints |
|
|
91
|
-
| Component-level responsive | Container queries |
|
|
92
|
-
| Reusable components | Container queries (context-independent) |
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## 4. Responsive Design
|
|
97
|
-
|
|
98
|
-
### Breakpoint System
|
|
99
|
-
|
|
100
|
-
| Prefix | Min Width | Target |
|
|
101
|
-
|--------|-----------|--------|
|
|
102
|
-
| (none) | 0px | Mobile-first base |
|
|
103
|
-
| `sm:` | 640px | Large phone / small tablet |
|
|
104
|
-
| `md:` | 768px | Tablet |
|
|
105
|
-
| `lg:` | 1024px | Laptop |
|
|
106
|
-
| `xl:` | 1280px | Desktop |
|
|
107
|
-
| `2xl:` | 1536px | Large desktop |
|
|
108
|
-
|
|
109
|
-
### Mobile-First Principle
|
|
110
|
-
|
|
111
|
-
1. Write mobile styles first (no prefix)
|
|
112
|
-
2. Add larger screen overrides with prefixes
|
|
113
|
-
3. Example: `w-full md:w-1/2 lg:w-1/3`
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## 5. Dark Mode
|
|
118
|
-
|
|
119
|
-
### Configuration Strategies
|
|
120
|
-
|
|
121
|
-
| Method | Behavior | Use When |
|
|
122
|
-
|--------|----------|----------|
|
|
123
|
-
| `class` | `.dark` class toggles | Manual theme switcher |
|
|
124
|
-
| `media` | Follows system preference | No user control |
|
|
125
|
-
| `selector` | Custom selector (v4) | Complex theming |
|
|
126
|
-
|
|
127
|
-
### Dark Mode Pattern
|
|
128
|
-
|
|
129
|
-
| Element | Light | Dark |
|
|
130
|
-
|---------|-------|------|
|
|
131
|
-
| Background | `bg-white` | `dark:bg-zinc-900` |
|
|
132
|
-
| Text | `text-zinc-900` | `dark:text-zinc-100` |
|
|
133
|
-
| Borders | `border-zinc-200` | `dark:border-zinc-700` |
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## 6. Modern Layout Patterns
|
|
138
|
-
|
|
139
|
-
### Flexbox Patterns
|
|
140
|
-
|
|
141
|
-
| Pattern | Classes |
|
|
142
|
-
|---------|---------|
|
|
143
|
-
| Center (both axes) | `flex items-center justify-center` |
|
|
144
|
-
| Vertical stack | `flex flex-col gap-4` |
|
|
145
|
-
| Horizontal row | `flex gap-4` |
|
|
146
|
-
| Space between | `flex justify-between items-center` |
|
|
147
|
-
| Wrap grid | `flex flex-wrap gap-4` |
|
|
148
|
-
|
|
149
|
-
### Grid Patterns
|
|
150
|
-
|
|
151
|
-
| Pattern | Classes |
|
|
152
|
-
|---------|---------|
|
|
153
|
-
| Auto-fit responsive | `grid grid-cols-[repeat(auto-fit,minmax(250px,1fr))]` |
|
|
154
|
-
| Asymmetric (Bento) | `grid grid-cols-3 grid-rows-2` with spans |
|
|
155
|
-
| Sidebar layout | `grid grid-cols-[auto_1fr]` |
|
|
156
|
-
|
|
157
|
-
> **Note:** Prefer asymmetric/Bento layouts over symmetric 3-column grids.
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 7. Modern Color System
|
|
162
|
-
|
|
163
|
-
### OKLCH vs RGB/HSL
|
|
164
|
-
|
|
165
|
-
| Format | Advantage |
|
|
166
|
-
|--------|-----------|
|
|
167
|
-
| **OKLCH** | Perceptually uniform, better for design |
|
|
168
|
-
| **HSL** | Intuitive hue/saturation |
|
|
169
|
-
| **RGB** | Legacy compatibility |
|
|
15
|
+
Use for Tailwind CSS v4 architecture, CSS-first theme setup, utility composition, container-query usage, design-token hygiene, and dark-mode strategy.
|
|
170
16
|
|
|
171
|
-
|
|
17
|
+
## When to Use
|
|
172
18
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
19
|
+
- Building or refactoring Tailwind-based UI systems.
|
|
20
|
+
- Choosing theme token structure and CSS-first configuration.
|
|
21
|
+
- Applying container queries, responsive composition, and utility extraction.
|
|
22
|
+
- Reviewing class composition for maintainability and scale.
|
|
23
|
+
- Setting up dark mode, color-scheme toggling, or multi-theme systems.
|
|
24
|
+
- Optimizing Tailwind output for production bundle size.
|
|
178
25
|
|
|
179
|
-
|
|
26
|
+
## Instructions
|
|
180
27
|
|
|
181
|
-
|
|
28
|
+
1. Confirm whether the codebase is truly Tailwind-first and which v4 features are active.
|
|
29
|
+
2. Establish semantic tokens (color, spacing, type, radius) before piling on utilities.
|
|
30
|
+
3. Define dark-mode and color-scheme strategy at the theme level, not per-component.
|
|
31
|
+
4. Use responsive and container-query rules deliberately at the component boundary.
|
|
32
|
+
5. Extract repeated patterns only when reuse and readability clearly improve.
|
|
33
|
+
6. Verify the result stays readable, consistent, and easy to extend.
|
|
182
34
|
|
|
183
|
-
###
|
|
35
|
+
### Baseline standards
|
|
184
36
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
37
|
+
- Prefer CSS-first theme and token definition in v4-era setups.
|
|
38
|
+
- Keep utility composition semantic at the component boundary.
|
|
39
|
+
- Use container queries for component context, not everything.
|
|
40
|
+
- Treat arbitrary values as exceptions, not the system.
|
|
41
|
+
- Keep spacing, typography, and color scales coherent.
|
|
42
|
+
- Define dark mode via `@custom-variant` or built-in `dark:` — never inline JavaScript toggling of raw classes.
|
|
43
|
+
- Use CSS custom properties for tokens that need runtime switching.
|
|
190
44
|
|
|
191
|
-
###
|
|
45
|
+
### Implementation guidance
|
|
192
46
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
| `text-xl`+ | 1.25rem+ | Headings |
|
|
47
|
+
- Use `@theme` blocks to define design tokens as CSS custom properties.
|
|
48
|
+
- Prefer `@layer` directives to control specificity ordering.
|
|
49
|
+
- Use `@variant` for semantic state grouping (e.g., `@variant hover, focus-visible`).
|
|
50
|
+
- Keep component-level `@apply` usage to shared design-system primitives, not arbitrary shortcuts.
|
|
51
|
+
- Use `@container` at the component wrapper level with named containers for clarity.
|
|
52
|
+
- Compose responsive with container queries: responsive for page layout, container queries for component-internal layout.
|
|
200
53
|
|
|
201
|
-
|
|
54
|
+
### Dark mode and theming
|
|
202
55
|
|
|
203
|
-
|
|
56
|
+
- Define color tokens as HSL or OKLCH custom properties for easy theme switching.
|
|
57
|
+
- Use `@custom-variant dark` with a class or media-query strategy — pick one per project and enforce it.
|
|
58
|
+
- Keep contrast ratios WCAG AA minimum (4.5:1 text, 3:1 large text / UI).
|
|
59
|
+
- Test both themes with real content, not just color swatches.
|
|
204
60
|
|
|
205
|
-
###
|
|
61
|
+
### Performance and production
|
|
206
62
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
| `animate-bounce` | Bouncing effect |
|
|
63
|
+
- Purge unused styles by keeping utility usage in template files Tailwind can scan.
|
|
64
|
+
- Avoid dynamic class construction (`bg-${color}-500`) — Tailwind cannot detect these at build time.
|
|
65
|
+
- Keep `@apply` chains short — long chains defeat tree-shaking.
|
|
66
|
+
- Use `content` configuration to limit scan scope in monorepos.
|
|
67
|
+
- Prefer targeted `@import` over importing the entire Tailwind base when only utilities are needed.
|
|
213
68
|
|
|
214
|
-
###
|
|
69
|
+
### Constraints
|
|
215
70
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
71
|
+
- Avoid dumping arbitrary values into every class list.
|
|
72
|
+
- Avoid mixing old config habits into a CSS-first setup without reason.
|
|
73
|
+
- Avoid repeating long class strings when a component or token should exist.
|
|
74
|
+
- Avoid styling choices that fight the design system instead of clarifying it.
|
|
75
|
+
- Avoid dynamic class name construction that breaks purge scanning.
|
|
76
|
+
- Avoid overriding Tailwind with inline styles or `!important` instead of fixing token conflicts.
|
|
77
|
+
- Avoid using `@apply` with responsive or state variants — compose those in the template.
|
|
222
78
|
|
|
223
|
-
|
|
79
|
+
## Output Format
|
|
224
80
|
|
|
225
|
-
|
|
81
|
+
Provide implementation guidance, code examples, and configuration as appropriate to the task.
|
|
226
82
|
|
|
227
|
-
|
|
83
|
+
## References
|
|
228
84
|
|
|
229
|
-
|
|
230
|
-
|--------|--------|
|
|
231
|
-
| Same class combo 3+ times | Extract component |
|
|
232
|
-
| Complex state variants | Extract component |
|
|
233
|
-
| Design system element | Extract + document |
|
|
85
|
+
Load on demand. Do not preload all reference files.
|
|
234
86
|
|
|
235
|
-
|
|
87
|
+
| File | Load when |
|
|
88
|
+
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `references/token-and-composition-checklist.md` | You need deeper Tailwind guidance for v4 token setup, utility composition, container queries, and class extraction rules. |
|
|
90
|
+
| `references/dark-mode-and-theming-guide.md` | The task involves dark mode setup, multi-theme systems, color-scheme toggling, or OKLCH token architecture. |
|
|
91
|
+
| `references/performance-and-purge-checklist.md` | The task involves production build optimization, bundle size reduction, or monorepo content configuration. |
|
|
236
92
|
|
|
237
|
-
|
|
238
|
-
|--------|----------|
|
|
239
|
-
| **React/Vue component** | Dynamic, JS needed |
|
|
240
|
-
| **@apply in CSS** | Static, no JS needed |
|
|
241
|
-
| **Design tokens** | Reusable values |
|
|
93
|
+
## Scripts
|
|
242
94
|
|
|
243
|
-
|
|
95
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
244
96
|
|
|
245
|
-
##
|
|
246
|
-
|
|
247
|
-
| Don't | Do |
|
|
248
|
-
|-------|-----|
|
|
249
|
-
| Arbitrary values everywhere | Use design system scale |
|
|
250
|
-
| `!important` | Fix specificity properly |
|
|
251
|
-
| Inline `style=` | Use utilities |
|
|
252
|
-
| Duplicate long class lists | Extract component |
|
|
253
|
-
| Mix v3 config with v4 | Migrate fully to CSS-first |
|
|
254
|
-
| Use `@apply` heavily | Prefer components |
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## 12. Performance Principles
|
|
259
|
-
|
|
260
|
-
| Principle | Implementation |
|
|
261
|
-
|-----------|----------------|
|
|
262
|
-
| **Purge unused** | Automatic in v4 |
|
|
263
|
-
| **Avoid dynamism** | No template string classes |
|
|
264
|
-
| **Use Oxide** | Default in v4, 10x faster |
|
|
265
|
-
| **Cache builds** | CI/CD caching |
|
|
266
|
-
|
|
267
|
-
---
|
|
97
|
+
## Examples
|
|
268
98
|
|
|
269
|
-
|
|
99
|
+
- "Help me with tailwind patterns best practices in this project"
|
|
100
|
+
- "Review my tailwind patterns implementation for issues"
|
|
@@ -2,23 +2,168 @@
|
|
|
2
2
|
---
|
|
3
3
|
inclusion: manual
|
|
4
4
|
name: testing-patterns
|
|
5
|
-
description:
|
|
5
|
+
description: Design test strategies with unit, integration, and e2e testing. Apply TDD, mocking, fixtures, coverage analysis, and test architecture best practices.
|
|
6
|
+
license: Apache-2.0
|
|
6
7
|
metadata:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
|
|
10
11
|
---
|
|
11
12
|
|
|
12
13
|
# Testing Patterns
|
|
13
14
|
|
|
14
|
-
##
|
|
15
|
+
## Purpose
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Guide test strategy, structure, and implementation across all testing levels. Covers unit, integration, and e2e testing patterns, TDD methodology, mocking strategies, and test architecture.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
## When to Use
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
- Writing tests for new features or bug fixes
|
|
22
|
+
- Designing a test strategy for a new project or module
|
|
23
|
+
- Debugging flaky or slow tests
|
|
24
|
+
- Reviewing test quality and coverage gaps
|
|
25
|
+
- Setting up test infrastructure (runners, fixtures, mocks)
|
|
26
|
+
- Deciding what level of testing is appropriate
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
## Instructions
|
|
29
|
+
|
|
30
|
+
### Step 1 — Choose the Right Test Level
|
|
31
|
+
|
|
32
|
+
| Level | Tests | Speed | Confidence | When to Use |
|
|
33
|
+
| ----------- | ---------------------------- | -------- | ---------------------------- | -------------------------------------------------- |
|
|
34
|
+
| Unit | Individual functions/classes | ms | Logic correctness | Pure logic, calculations, transformers |
|
|
35
|
+
| Integration | Module boundaries | 100ms–1s | Components work together | API routes, database queries, service interactions |
|
|
36
|
+
| E2E | Full user flows | 5–30s | System works as user expects | Critical paths (signup, checkout, deploy) |
|
|
37
|
+
|
|
38
|
+
**Testing Trophy** (preferred distribution):
|
|
39
|
+
|
|
40
|
+
- Many integration tests (highest ROI)
|
|
41
|
+
- Some unit tests (fast logic verification)
|
|
42
|
+
- Few e2e tests (critical paths only)
|
|
43
|
+
- Static analysis as the foundation (TypeScript, linting)
|
|
44
|
+
|
|
45
|
+
### Step 2 — Write Effective Tests
|
|
46
|
+
|
|
47
|
+
**Structure every test as Arrange → Act → Assert**:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
test("calculates total with tax", () => {
|
|
51
|
+
// Arrange
|
|
52
|
+
const items = [{ price: 100 }, { price: 200 }];
|
|
53
|
+
const taxRate = 0.1;
|
|
54
|
+
|
|
55
|
+
// Act
|
|
56
|
+
const total = calculateTotal(items, taxRate);
|
|
57
|
+
|
|
58
|
+
// Assert
|
|
59
|
+
expect(total).toBe(330);
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Naming**: Use natural language that describes the behavior:
|
|
64
|
+
|
|
65
|
+
- DO: `"returns empty array when no items match filter"`
|
|
66
|
+
- DON'T: `"test filter"` or `"test1"`
|
|
67
|
+
|
|
68
|
+
**One assertion per behavior** (not per test):
|
|
69
|
+
|
|
70
|
+
- One test can have multiple `expect()` calls if they verify the same behavior
|
|
71
|
+
- Split separate behaviors into separate tests
|
|
72
|
+
|
|
73
|
+
### Step 3 — Mock Strategically
|
|
74
|
+
|
|
75
|
+
**Mock at boundaries, not everywhere**:
|
|
76
|
+
|
|
77
|
+
- Mock: external APIs, databases, file system, time, randomness
|
|
78
|
+
- Don't mock: your own code, simple utilities, data transformations
|
|
79
|
+
|
|
80
|
+
**Mock patterns**:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Dependency injection (preferred)
|
|
84
|
+
function createUserService(db: Database) {
|
|
85
|
+
return { getUser: (id) => db.query("SELECT...", [id]) };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Module mocking (when DI not available)
|
|
89
|
+
vi.mock("./database", () => ({
|
|
90
|
+
query: vi.fn().mockResolvedValue([{ id: 1, name: "Alice" }]),
|
|
91
|
+
}));
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Avoid**:
|
|
95
|
+
|
|
96
|
+
- Mocking implementation details (private methods, internal state)
|
|
97
|
+
- Over-mocking (if you mock everything, you're testing nothing)
|
|
98
|
+
- Snapshot tests for behavior (only for serialized output like HTML)
|
|
99
|
+
|
|
100
|
+
### Step 4 — Handle Test Data
|
|
101
|
+
|
|
102
|
+
**Factories over fixtures**:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
function createUser(overrides = {}) {
|
|
106
|
+
return {
|
|
107
|
+
id: crypto.randomUUID(),
|
|
108
|
+
name: "Test User",
|
|
109
|
+
email: "test@example.com",
|
|
110
|
+
role: "user",
|
|
111
|
+
...overrides,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Usage
|
|
116
|
+
const admin = createUser({ role: "admin" });
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Test isolation**:
|
|
120
|
+
|
|
121
|
+
- Each test creates its own data (no shared mutable state)
|
|
122
|
+
- Clean up after integration tests (database, files)
|
|
123
|
+
- Use transactions for database tests (rollback after each test)
|
|
124
|
+
|
|
125
|
+
### Step 5 — Fix Common Test Problems
|
|
126
|
+
|
|
127
|
+
**Flaky tests**:
|
|
128
|
+
|
|
129
|
+
- Remove timing dependencies (`setTimeout`, `sleep`)
|
|
130
|
+
- Use deterministic data (no `Math.random()` without seeding)
|
|
131
|
+
- Await all async operations properly
|
|
132
|
+
- Isolate external dependencies (mock network, use test databases)
|
|
133
|
+
|
|
134
|
+
**Slow tests**:
|
|
135
|
+
|
|
136
|
+
- Run in parallel when tests are isolated
|
|
137
|
+
- Use in-memory databases for integration tests
|
|
138
|
+
- Minimize e2e tests — push logic down to unit/integration
|
|
139
|
+
- Profile and fix the slowest 10% first
|
|
140
|
+
|
|
141
|
+
**Brittle tests**:
|
|
142
|
+
|
|
143
|
+
- Test behavior, not implementation
|
|
144
|
+
- Use accessible queries in UI tests (role, label — not CSS selectors)
|
|
145
|
+
- Avoid testing framework internals
|
|
146
|
+
|
|
147
|
+
## Output Format
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
## Test Strategy
|
|
151
|
+
[approach and reasoning for test level choices]
|
|
152
|
+
|
|
153
|
+
## Tests
|
|
154
|
+
[test code organized by describe blocks]
|
|
155
|
+
|
|
156
|
+
## Coverage Notes
|
|
157
|
+
[what's tested, what's intentionally not tested, and why]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Examples
|
|
161
|
+
|
|
162
|
+
**User**: "Write tests for this user registration function"
|
|
163
|
+
|
|
164
|
+
**Response approach**: Unit tests for validation logic (email format, password strength). Integration test for the full registration flow (validate → hash password → insert DB → send email). Mock the email service and database. Test edge cases (duplicate email, weak password, missing fields).
|
|
165
|
+
|
|
166
|
+
**User**: "Our test suite takes 20 minutes, help us speed it up"
|
|
167
|
+
|
|
168
|
+
**Response approach**: Profile the slowest tests. Look for unnecessary e2e tests that could be integration. Check for missing parallelization. Identify shared state causing serial execution. Suggest in-memory database for integration tests.
|
|
24
169
|
````
|