contextos-agents 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/AGENTS.md +421 -0
- package/.agents/adapters/aider/export.js +137 -0
- package/.agents/adapters/claude/export.js +55 -0
- package/.agents/adapters/copilot/export.js +107 -0
- package/.agents/adapters/cursor/export.js +210 -0
- package/.agents/adapters/gemini/export.js +115 -0
- package/.agents/adapters/shared.js +119 -0
- package/.agents/adapters/zed/export.js +111 -0
- package/.agents/core/profiles/backend.yaml +47 -0
- package/.agents/core/profiles/enterprise.yaml +46 -0
- package/.agents/core/profiles/frontend.yaml +46 -0
- package/.agents/core/profiles/hackathon.yaml +45 -0
- package/.agents/core/profiles/mvp.yaml +43 -0
- package/.agents/core/profiles/startup.yaml +48 -0
- package/.agents/core/skills/adapters/EXAMPLES.md +19 -0
- package/.agents/core/skills/adapters/SKILL.md +105 -0
- package/.agents/core/skills/adapters/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/adapters/VALIDATION.json +12 -0
- package/.agents/core/skills/adapters/skill.yaml +10 -0
- package/.agents/core/skills/architecture-diagrams/SKILL.md +108 -0
- package/.agents/core/skills/architecture-diagrams/VALIDATION.json +12 -0
- package/.agents/core/skills/architecture-diagrams/skill.yaml +8 -0
- package/.agents/core/skills/brutalist-design/SKILL.md +150 -0
- package/.agents/core/skills/brutalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/brutalist-design/skill.yaml +8 -0
- package/.agents/core/skills/context-manager/EXAMPLES.md +19 -0
- package/.agents/core/skills/context-manager/SKILL.md +126 -0
- package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-manager/VALIDATION.json +12 -0
- package/.agents/core/skills/context-manager/skill.yaml +10 -0
- package/.agents/core/skills/context-os/EXAMPLES.md +21 -0
- package/.agents/core/skills/context-os/SKILL.md +169 -0
- package/.agents/core/skills/context-os/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-os/VALIDATION.json +12 -0
- package/.agents/core/skills/context-os/packs.yaml +59 -0
- package/.agents/core/skills/context-os/references/context-rules.md +68 -0
- package/.agents/core/skills/context-os/references/pipeline.md +119 -0
- package/.agents/core/skills/context-os/references/project-graph.md +103 -0
- package/.agents/core/skills/context-os/rules.yaml +135 -0
- package/.agents/core/skills/context-os/skill.yaml +10 -0
- package/.agents/core/skills/database/EXAMPLES.md +74 -0
- package/.agents/core/skills/database/SKILL.md +101 -0
- package/.agents/core/skills/database/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/database/VALIDATION.json +11 -0
- package/.agents/core/skills/database/skill.yaml +25 -0
- package/.agents/core/skills/ddd/EXAMPLES.md +42 -0
- package/.agents/core/skills/ddd/SKILL.md +247 -0
- package/.agents/core/skills/ddd/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ddd/VALIDATION.json +12 -0
- package/.agents/core/skills/ddd/ddd.md +178 -0
- package/.agents/core/skills/ddd/skill.yaml +10 -0
- package/.agents/core/skills/decisions/EXAMPLES.md +35 -0
- package/.agents/core/skills/decisions/SKILL.md +90 -0
- package/.agents/core/skills/decisions/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/decisions/VALIDATION.json +12 -0
- package/.agents/core/skills/decisions/skill.yaml +10 -0
- package/.agents/core/skills/docker/EXAMPLES.md +56 -0
- package/.agents/core/skills/docker/SKILL.md +63 -0
- package/.agents/core/skills/docker/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/docker/VALIDATION.json +11 -0
- package/.agents/core/skills/docker/skill.yaml +23 -0
- package/.agents/core/skills/engineering-workflow/EXAMPLES.md +57 -0
- package/.agents/core/skills/engineering-workflow/SKILL.md +343 -0
- package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/engineering-workflow/VALIDATION.json +12 -0
- package/.agents/core/skills/engineering-workflow/skill.yaml +13 -0
- package/.agents/core/skills/fastapi/EXAMPLES.md +36 -0
- package/.agents/core/skills/fastapi/SKILL.md +148 -0
- package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/fastapi/VALIDATION.json +12 -0
- package/.agents/core/skills/fastapi/fastapi.md +112 -0
- package/.agents/core/skills/fastapi/skill.yaml +10 -0
- package/.agents/core/skills/gemini-precision/SKILL.md +169 -0
- package/.agents/core/skills/gemini-precision/VALIDATION.json +12 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +9 -0
- package/.agents/core/skills/generators/EXAMPLES.md +19 -0
- package/.agents/core/skills/generators/SKILL.md +112 -0
- package/.agents/core/skills/generators/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/generators/VALIDATION.json +12 -0
- package/.agents/core/skills/generators/skill.yaml +10 -0
- package/.agents/core/skills/generators/templates/API.md +77 -0
- package/.agents/core/skills/generators/templates/ARCHITECTURE.md +70 -0
- package/.agents/core/skills/generators/templates/DATABASE.md +42 -0
- package/.agents/core/skills/generators/templates/DECISION.md +46 -0
- package/.agents/core/skills/generators/templates/PRD.md +67 -0
- package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +56 -0
- package/.agents/core/skills/generators/templates/ROADMAP.md +51 -0
- package/.agents/core/skills/generators/templates/TASKS.md +43 -0
- package/.agents/core/skills/generators/templates/UI.md +73 -0
- package/.agents/core/skills/graphify/EXAMPLES.md +73 -0
- package/.agents/core/skills/graphify/SKILL.md +130 -0
- package/.agents/core/skills/graphify/VALIDATION.json +12 -0
- package/.agents/core/skills/graphify/skill.yaml +13 -0
- package/.agents/core/skills/gstack-roles/EXAMPLES.md +23 -0
- package/.agents/core/skills/gstack-roles/SKILL.md +152 -0
- package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/gstack-roles/VALIDATION.json +12 -0
- package/.agents/core/skills/gstack-roles/skill.yaml +12 -0
- package/.agents/core/skills/impeccable-design/EXAMPLES.md +26 -0
- package/.agents/core/skills/impeccable-design/SKILL.md +201 -0
- package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/impeccable-design/VALIDATION.json +12 -0
- package/.agents/core/skills/impeccable-design/skill.yaml +14 -0
- package/.agents/core/skills/interview-me/SKILL.md +97 -0
- package/.agents/core/skills/interview-me/VALIDATION.json +12 -0
- package/.agents/core/skills/interview-me/skill.yaml +8 -0
- package/.agents/core/skills/microservices/EXAMPLES.md +38 -0
- package/.agents/core/skills/microservices/SKILL.md +164 -0
- package/.agents/core/skills/microservices/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/microservices/VALIDATION.json +12 -0
- package/.agents/core/skills/microservices/microservices.md +119 -0
- package/.agents/core/skills/microservices/skill.yaml +10 -0
- package/.agents/core/skills/minimalist-design/SKILL.md +113 -0
- package/.agents/core/skills/minimalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/minimalist-design/skill.yaml +8 -0
- package/.agents/core/skills/nestjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nestjs/SKILL.md +139 -0
- package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nestjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nestjs/nestjs.md +103 -0
- package/.agents/core/skills/nestjs/skill.yaml +10 -0
- package/.agents/core/skills/nextjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nextjs/SKILL.md +163 -0
- package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nextjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nextjs/nextjs.md +67 -0
- package/.agents/core/skills/nextjs/skill.yaml +10 -0
- package/.agents/core/skills/node/EXAMPLES.md +80 -0
- package/.agents/core/skills/node/SKILL.md +128 -0
- package/.agents/core/skills/node/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/node/VALIDATION.json +12 -0
- package/.agents/core/skills/node/node.md +87 -0
- package/.agents/core/skills/node/skill.yaml +10 -0
- package/.agents/core/skills/performance/EXAMPLES.md +30 -0
- package/.agents/core/skills/performance/SKILL.md +75 -0
- package/.agents/core/skills/performance/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/performance/VALIDATION.json +12 -0
- package/.agents/core/skills/performance/performance.md +52 -0
- package/.agents/core/skills/performance/skill.yaml +10 -0
- package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +45 -0
- package/.agents/core/skills/ponytail-mindset/SKILL.md +193 -0
- package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ponytail-mindset/VALIDATION.json +12 -0
- package/.agents/core/skills/ponytail-mindset/skill.yaml +14 -0
- package/.agents/core/skills/react/EXAMPLES.md +79 -0
- package/.agents/core/skills/react/SKILL.md +132 -0
- package/.agents/core/skills/react/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/react/VALIDATION.json +12 -0
- package/.agents/core/skills/react/react.md +93 -0
- package/.agents/core/skills/react/skill.yaml +10 -0
- package/.agents/core/skills/react-best-practices/SKILL.md +155 -0
- package/.agents/core/skills/react-best-practices/VALIDATION.json +12 -0
- package/.agents/core/skills/react-best-practices/skill.yaml +10 -0
- package/.agents/core/skills/redesign-audit/SKILL.md +117 -0
- package/.agents/core/skills/redesign-audit/VALIDATION.json +12 -0
- package/.agents/core/skills/redesign-audit/skill.yaml +8 -0
- package/.agents/core/skills/security/EXAMPLES.md +64 -0
- package/.agents/core/skills/security/SKILL.md +158 -0
- package/.agents/core/skills/security/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/security/VALIDATION.json +12 -0
- package/.agents/core/skills/security/security.md +106 -0
- package/.agents/core/skills/security/skill.yaml +10 -0
- package/.agents/core/skills/soft-design/SKILL.md +108 -0
- package/.agents/core/skills/soft-design/VALIDATION.json +12 -0
- package/.agents/core/skills/soft-design/skill.yaml +8 -0
- package/.agents/core/skills/state-management/EXAMPLES.md +56 -0
- package/.agents/core/skills/state-management/SKILL.md +48 -0
- package/.agents/core/skills/state-management/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/state-management/VALIDATION.json +11 -0
- package/.agents/core/skills/state-management/skill.yaml +22 -0
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +100 -0
- package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +12 -0
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +8 -0
- package/.agents/core/skills/system-design/EXAMPLES.md +75 -0
- package/.agents/core/skills/system-design/SKILL.md +419 -0
- package/.agents/core/skills/system-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/system-design/VALIDATION.json +12 -0
- package/.agents/core/skills/system-design/skill.yaml +13 -0
- package/.agents/core/skills/system-design/system-design.md +112 -0
- package/.agents/core/skills/testing/EXAMPLES.md +71 -0
- package/.agents/core/skills/testing/SKILL.md +70 -0
- package/.agents/core/skills/testing/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/testing/VALIDATION.json +11 -0
- package/.agents/core/skills/testing/skill.yaml +26 -0
- package/.agents/core/skills/typescript/EXAMPLES.md +64 -0
- package/.agents/core/skills/typescript/SKILL.md +112 -0
- package/.agents/core/skills/typescript/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/typescript/VALIDATION.json +12 -0
- package/.agents/core/skills/typescript/skill.yaml +10 -0
- package/.agents/core/skills/typescript/typescript.md +71 -0
- package/.agents/core/skills/ui-design/EXAMPLES.md +21 -0
- package/.agents/core/skills/ui-design/SKILL.md +124 -0
- package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-design/skill.yaml +10 -0
- package/.agents/core/skills/ui-design/ui.md +88 -0
- package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +62 -0
- package/.agents/core/skills/ui-ux-pro/SKILL.md +375 -0
- package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-ux-pro/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-ux-pro/skill.yaml +13 -0
- package/.agents/core/skills/ux-design/EXAMPLES.md +36 -0
- package/.agents/core/skills/ux-design/SKILL.md +116 -0
- package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ux-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ux-design/skill.yaml +10 -0
- package/.agents/core/skills/ux-design/ux.md +80 -0
- package/.agents/core/skills/vercel-optimize/SKILL.md +83 -0
- package/.agents/core/skills/vercel-optimize/VALIDATION.json +12 -0
- package/.agents/core/skills/vercel-optimize/skill.yaml +10 -0
- package/.agents/core/skills/web-accessibility/EXAMPLES.md +39 -0
- package/.agents/core/skills/web-accessibility/SKILL.md +170 -0
- package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/web-accessibility/VALIDATION.json +12 -0
- package/.agents/core/skills/web-accessibility/accessibility.md +63 -0
- package/.agents/core/skills/web-accessibility/skill.yaml +10 -0
- package/.agents/ctx.js +370 -0
- package/.agents/generated/claude/skills/adapters/SKILL.md +126 -0
- package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +101 -0
- package/.agents/generated/claude/skills/brutalist-design/SKILL.md +145 -0
- package/.agents/generated/claude/skills/context-manager/SKILL.md +147 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +191 -0
- package/.agents/generated/claude/skills/database/SKILL.md +191 -0
- package/.agents/generated/claude/skills/ddd/SKILL.md +305 -0
- package/.agents/generated/claude/skills/decisions/SKILL.md +134 -0
- package/.agents/generated/claude/skills/docker/SKILL.md +135 -0
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +414 -0
- package/.agents/generated/claude/skills/fastapi/SKILL.md +200 -0
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +161 -0
- package/.agents/generated/claude/skills/generators/SKILL.md +133 -0
- package/.agents/generated/claude/skills/graphify/SKILL.md +198 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +184 -0
- package/.agents/generated/claude/skills/impeccable-design/SKILL.md +241 -0
- package/.agents/generated/claude/skills/interview-me/SKILL.md +90 -0
- package/.agents/generated/claude/skills/microservices/SKILL.md +218 -0
- package/.agents/generated/claude/skills/minimalist-design/SKILL.md +108 -0
- package/.agents/generated/claude/skills/nestjs/SKILL.md +195 -0
- package/.agents/generated/claude/skills/nextjs/SKILL.md +219 -0
- package/.agents/generated/claude/skills/node/SKILL.md +224 -0
- package/.agents/generated/claude/skills/performance/SKILL.md +121 -0
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +252 -0
- package/.agents/generated/claude/skills/react/SKILL.md +227 -0
- package/.agents/generated/claude/skills/react-best-practices/SKILL.md +146 -0
- package/.agents/generated/claude/skills/redesign-audit/SKILL.md +112 -0
- package/.agents/generated/claude/skills/security/SKILL.md +237 -0
- package/.agents/generated/claude/skills/soft-design/SKILL.md +103 -0
- package/.agents/generated/claude/skills/state-management/SKILL.md +120 -0
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +93 -0
- package/.agents/generated/claude/skills/system-design/SKILL.md +507 -0
- package/.agents/generated/claude/skills/testing/SKILL.md +157 -0
- package/.agents/generated/claude/skills/typescript/SKILL.md +192 -0
- package/.agents/generated/claude/skills/ui-design/SKILL.md +161 -0
- package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +451 -0
- package/.agents/generated/claude/skills/ux-design/SKILL.md +168 -0
- package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +76 -0
- package/.agents/generated/claude/skills/web-accessibility/SKILL.md +225 -0
- package/.agents/generated/gemini/skills/adapters/SKILL.md +135 -0
- package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +107 -0
- package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +151 -0
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +156 -0
- package/.agents/generated/gemini/skills/context-os/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/database/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/ddd/SKILL.md +314 -0
- package/.agents/generated/gemini/skills/decisions/SKILL.md +143 -0
- package/.agents/generated/gemini/skills/docker/SKILL.md +144 -0
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +423 -0
- package/.agents/generated/gemini/skills/fastapi/SKILL.md +209 -0
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +167 -0
- package/.agents/generated/gemini/skills/generators/SKILL.md +142 -0
- package/.agents/generated/gemini/skills/graphify/SKILL.md +205 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +193 -0
- package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +250 -0
- package/.agents/generated/gemini/skills/interview-me/SKILL.md +96 -0
- package/.agents/generated/gemini/skills/microservices/SKILL.md +227 -0
- package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +114 -0
- package/.agents/generated/gemini/skills/nestjs/SKILL.md +204 -0
- package/.agents/generated/gemini/skills/nextjs/SKILL.md +298 -0
- package/.agents/generated/gemini/skills/node/SKILL.md +323 -0
- package/.agents/generated/gemini/skills/performance/SKILL.md +185 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +261 -0
- package/.agents/generated/gemini/skills/react/SKILL.md +332 -0
- package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +152 -0
- package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +118 -0
- package/.agents/generated/gemini/skills/security/SKILL.md +355 -0
- package/.agents/generated/gemini/skills/soft-design/SKILL.md +109 -0
- package/.agents/generated/gemini/skills/state-management/SKILL.md +129 -0
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +99 -0
- package/.agents/generated/gemini/skills/system-design/SKILL.md +631 -0
- package/.agents/generated/gemini/skills/testing/SKILL.md +166 -0
- package/.agents/generated/gemini/skills/typescript/SKILL.md +275 -0
- package/.agents/generated/gemini/skills/ui-design/SKILL.md +170 -0
- package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +460 -0
- package/.agents/generated/gemini/skills/ux-design/SKILL.md +177 -0
- package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +82 -0
- package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +300 -0
- package/.agents/mcp/runtime.py +454 -0
- package/.agents/mcp/server.mjs +189373 -0
- package/.agents/plugins.js +574 -0
- package/.agents/profiles.js +267 -0
- package/.agents/resolver.js +336 -0
- package/.agents/skills-index.json +200 -0
- package/.agents/skills.json +6 -0
- package/.agents/validate.js +500 -0
- package/LICENSE +21 -0
- package/README.md +415 -0
- package/benchmarks/gemini-issues.js +533 -0
- package/bin/index.js +458 -0
- package/package.json +70 -0
- package/registry.json +53 -0
- package/registry.schema.json +32 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing
|
|
3
|
+
description: >
|
|
4
|
+
Vitest, React Testing Library, and Playwright testing standards. Enforces TDD/BDD, test pyramid, zero brittle mocks, and complete assertion coverage.
|
|
5
|
+
---
|
|
6
|
+
# Testing
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Testing strategy across unit, component, integration, and end-to-end testing suites using Vitest, React Testing Library, and Playwright.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate for any task involving unit tests, integration tests, E2E testing, TDD/BDD workflows, or fixing regression bugs.
|
|
15
|
+
|
|
16
|
+
## Rules & Patterns
|
|
17
|
+
|
|
18
|
+
### ️ The ContextOS Testing Pyramid
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/\
|
|
22
|
+
/E2E\ 10% — Playwright (Critical user journeys, auth, checkout)
|
|
23
|
+
/-----\
|
|
24
|
+
/ Integ \ 20% — API & Component Integration (RTL + MSW / Supertest)
|
|
25
|
+
/---------\
|
|
26
|
+
/ Unit \ 70% — Pure functions, Domain Entities, Utils (Vitest)
|
|
27
|
+
/-------------\
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Negative Constraints (What NOT to Do)
|
|
31
|
+
|
|
32
|
+
1. **NEVER mock internal implementation details**: Mock ONLY external I/O boundaries (HTTP network requests via MSW, Database via test containers or in-memory DB).
|
|
33
|
+
2. **NEVER test implementation details**: In React Testing Library, query by user-facing roles (`getByRole`, `getByLabelText`), NEVER by CSS selectors or internal component state.
|
|
34
|
+
3. **NEVER write assertions without an expected failure mode**: Each test must test a single logical behavior and fail if that behavior breaks.
|
|
35
|
+
4. **NEVER leave flaky tests or arbitrary sleep (`await delay(1000)`)**: Always use `waitFor()` or explicit event triggers with timeouts.
|
|
36
|
+
5. **NEVER share mutable state between tests**: Every test must have isolated state via `beforeEach()` setup and clean reset.
|
|
37
|
+
|
|
38
|
+
### AAA Standard Pattern
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
describe('Feature / Unit', () => {
|
|
42
|
+
it('should achieve expected outcome when given specific condition', async () => {
|
|
43
|
+
// 1. ARRANGE
|
|
44
|
+
const user = createTestUser({ role: 'admin' });
|
|
45
|
+
// 2. ACT
|
|
46
|
+
const result = await processOrder(user, sampleCart);
|
|
47
|
+
// 3. ASSERT
|
|
48
|
+
expect(result.status).toBe('confirmed');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Code Examples
|
|
54
|
+
|
|
55
|
+
See `EXAMPLES.md` for detailed anti-patterns and production testing code.
|
|
56
|
+
|
|
57
|
+
## Validation Checklist
|
|
58
|
+
|
|
59
|
+
- [ ] Tests follow Arrange-Act-Assert (AAA) structure
|
|
60
|
+
- [ ] No brittle CSS selectors or private state inspections
|
|
61
|
+
- [ ] Mocks isolated strictly to network/IO boundaries (MSW)
|
|
62
|
+
- [ ] Fast execution (< 5s for unit suite) with zero flaky sleeps
|
|
63
|
+
|
|
64
|
+
## Common Mistakes
|
|
65
|
+
|
|
66
|
+
- Over-mocking modules instead of running real pure logic. See `TROUBLESHOOTING.md`.
|
|
67
|
+
|
|
68
|
+
## Integration Notes
|
|
69
|
+
|
|
70
|
+
Interacts directly with `engineering-workflow` (Verify phase), `react`, and `typescript`.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<!-- Source: EXAMPLES.md -->
|
|
74
|
+
|
|
75
|
+
# Testing Examples — Anti-patterns vs ContextOS Standard
|
|
76
|
+
|
|
77
|
+
## Example 1: React Component Testing
|
|
78
|
+
|
|
79
|
+
### Anti-pattern: Anti-pattern (Brittle query & implementation coupling)
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// BAD: querying by CSS class or test-id and testing internal state
|
|
83
|
+
test('submits form', async () => {
|
|
84
|
+
const wrapper = render(<LoginForm />);
|
|
85
|
+
const input = wrapper.container.querySelector('.email-input');
|
|
86
|
+
fireEvent.change(input, { target: { value: 'user@test.com' } });
|
|
87
|
+
fireEvent.click(wrapper.container.querySelector('#submit-btn'));
|
|
88
|
+
expect(wrapper.state().isSubmitted).toBe(true); // Brittle!
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Best practice: ContextOS Standard (User-centric role queries & userEvent)
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// GOOD: user-facing roles, userEvent, async wait
|
|
96
|
+
import { render, screen } from '@testing-library/react';
|
|
97
|
+
import userEvent from '@testing-library/user-event';
|
|
98
|
+
import { LoginForm } from './LoginForm';
|
|
99
|
+
|
|
100
|
+
test('submits form with valid user credentials', async () => {
|
|
101
|
+
const user = userEvent.setup();
|
|
102
|
+
const onSubmit = vi.fn();
|
|
103
|
+
render(<LoginForm onSubmit={onSubmit} />);
|
|
104
|
+
|
|
105
|
+
await user.type(screen.getByLabelText(/email address/i), 'user@test.com');
|
|
106
|
+
await user.type(screen.getByLabelText(/password/i), 'SecureP@ss123!');
|
|
107
|
+
await user.click(screen.getByRole('button', { name: /sign in/i }));
|
|
108
|
+
|
|
109
|
+
expect(onSubmit).toHaveBeenCalledWith({
|
|
110
|
+
email: 'user@test.com',
|
|
111
|
+
password: 'SecureP@ss123!'
|
|
112
|
+
});
|
|
113
|
+
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Example 2: API Mocking with MSW (Mock Service Worker)
|
|
120
|
+
|
|
121
|
+
### Anti-pattern: Anti-pattern (Hardcoded global fetch monkey-patching)
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// BAD: globally overwriting fetch breaks other tests and hides actual contract
|
|
125
|
+
global.fetch = vi.fn().mockResolvedValue({
|
|
126
|
+
json: () => Promise.resolve({ data: 'ok' })
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Best practice: ContextOS Standard (Network boundary mocking)
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// GOOD: declarative MSW network handler
|
|
134
|
+
import { http, HttpResponse } from 'msw';
|
|
135
|
+
import { setupServer } from 'msw/node';
|
|
136
|
+
|
|
137
|
+
export const server = setupServer(
|
|
138
|
+
http.get('/api/users/:id', ({ params }) => {
|
|
139
|
+
if (params.id === '404') {
|
|
140
|
+
return new HttpResponse(null, { status: 404 });
|
|
141
|
+
}
|
|
142
|
+
return HttpResponse.json({ id: params.id, name: 'Alice Smith' });
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
<!-- Source: TROUBLESHOOTING.md -->
|
|
148
|
+
|
|
149
|
+
# Testing Troubleshooting Guide
|
|
150
|
+
|
|
151
|
+
## Common Issues & Fixes
|
|
152
|
+
|
|
153
|
+
### 1. `act(...)` warning in React Testing Library
|
|
154
|
+
|
|
155
|
+
- **Cause**: An asynchronous state update triggered after the test completed.
|
|
156
|
+
- **Fix**: Ensure all async operations are awaited using `await waitFor(() => ...)` or `await screen.findByRole(...)`.
|
|
157
|
+
|
|
158
|
+
### 2. Tests pass in isolation but fail in concurrent test runs
|
|
159
|
+
|
|
160
|
+
- **Cause**: Shared in-memory state or un-reset singleton.
|
|
161
|
+
- **Fix**: Reset all mocks and in-memory databases in `beforeEach(() => vi.clearAllMocks())` and `afterEach(() => cleanup())`.
|
|
162
|
+
|
|
163
|
+
### 3. Playwright timeout waiting for selector
|
|
164
|
+
|
|
165
|
+
- **Cause**: Element is animating or blocked behind a modal/overlay.
|
|
166
|
+
- **Fix**: Use web-first assertions like `await expect(page.getByRole('button')).toBeVisible()` which automatically retry until timeout.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TypeScript
|
|
3
|
+
description: >
|
|
4
|
+
ContextOS skill for TypeScript
|
|
5
|
+
---
|
|
6
|
+
# TypeScript
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Strict TypeScript engineering standard. Enforces noImplicitAny, discriminated unions, branded types, immutability, exhaustive switch checks, and zero unsafe any or as unknown as T casts.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate on all TypeScript and JavaScript codebases to ensure compile-time type safety, robust domain modeling, and foolproof function contracts.
|
|
15
|
+
|
|
16
|
+
## Negative Constraints (What NOT to Do)
|
|
17
|
+
|
|
18
|
+
1. **NEVER use `any`**: Use `unknown` with type guards, discriminated unions, or Zod schemas.
|
|
19
|
+
2. **NEVER use type assertions (`as Type` or `as unknown as Type`) to bypass safety**: Fix the underlying type signature or use runtime narrowing (`instanceof`, `typeof`, `in`).
|
|
20
|
+
3. **NEVER use non-null assertions (`foo!.bar`)**: Handle `null` and `undefined` with optional chaining (`?.`) or explicit error guards.
|
|
21
|
+
4. **NEVER export mutable global arrays or object constants**: Always mark constant objects and arrays with `as const` and `readonly`.
|
|
22
|
+
5. **NEVER omit explicit return types on exported functions**: Exported public APIs must declare explicit return types to protect consumers.
|
|
23
|
+
|
|
24
|
+
## Rules & Patterns
|
|
25
|
+
|
|
26
|
+
## Strict Mode
|
|
27
|
+
|
|
28
|
+
Always use strict TypeScript configuration:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"compilerOptions": {
|
|
33
|
+
"strict": true,
|
|
34
|
+
"noUncheckedIndexedAccess": true,
|
|
35
|
+
"noImplicitReturns": true,
|
|
36
|
+
"noFallthroughCasesInSwitch": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Types
|
|
42
|
+
|
|
43
|
+
- **Prefer `interface`** for object shapes, `type` for unions/intersections
|
|
44
|
+
- **No `any`** — use `unknown` if type is truly unknown, then narrow
|
|
45
|
+
- **Explicit return types** for exported functions
|
|
46
|
+
- **Const assertions** — `as const` for literal types
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Good
|
|
50
|
+
interface User {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
role: 'admin' | 'user';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Unions
|
|
57
|
+
type Result<T> = { ok: true; data: T } | { ok: false; error: string };
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Utility Types
|
|
61
|
+
|
|
62
|
+
- `Partial<T>` — all properties optional
|
|
63
|
+
- `Required<T>` — all properties required
|
|
64
|
+
- `Pick<T, K>` — select specific properties
|
|
65
|
+
- `Omit<T, K>` — remove specific properties
|
|
66
|
+
- `Record<K, V>` — key-value map
|
|
67
|
+
|
|
68
|
+
## Type Guards
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
function isUser(value: unknown): value is User {
|
|
72
|
+
return typeof value === 'object' && value !== null && 'id' in value;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Generic Patterns
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Repository pattern
|
|
80
|
+
interface Repository<T extends { id: string }> {
|
|
81
|
+
findById(id: string): Promise<T | null>;
|
|
82
|
+
create(data: Omit<T, 'id'>): Promise<T>;
|
|
83
|
+
update(id: string, data: Partial<T>): Promise<T>;
|
|
84
|
+
delete(id: string): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Anti-Patterns
|
|
89
|
+
|
|
90
|
+
- [FAIL] `any` — use `unknown` + type guards
|
|
91
|
+
- [FAIL] Type assertions (`as`) — prefer type guards
|
|
92
|
+
- [FAIL] Non-null assertions (`!`) — handle null explicitly
|
|
93
|
+
- [FAIL] Enums — prefer union types or `as const` objects
|
|
94
|
+
- [FAIL] Complex generics without JSDoc — document intent
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## Code Examples
|
|
98
|
+
|
|
99
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
100
|
+
|
|
101
|
+
## Validation Checklist
|
|
102
|
+
|
|
103
|
+
What to verify during the review phase before completing the task.
|
|
104
|
+
|
|
105
|
+
## Common Mistakes
|
|
106
|
+
|
|
107
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
108
|
+
|
|
109
|
+
## Integration Notes
|
|
110
|
+
|
|
111
|
+
How this skill interacts with other skills.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<!-- Source: typescript.md -->
|
|
115
|
+
|
|
116
|
+
# TypeScript — Best Practices
|
|
117
|
+
|
|
118
|
+
## Strict Mode
|
|
119
|
+
|
|
120
|
+
Always use strict TypeScript configuration:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"compilerOptions": {
|
|
125
|
+
"strict": true,
|
|
126
|
+
"noUncheckedIndexedAccess": true,
|
|
127
|
+
"noImplicitReturns": true,
|
|
128
|
+
"noFallthroughCasesInSwitch": true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Types
|
|
134
|
+
|
|
135
|
+
- **Prefer `interface`** for object shapes, `type` for unions/intersections
|
|
136
|
+
- **No `any`** — use `unknown` if type is truly unknown, then narrow
|
|
137
|
+
- **Explicit return types** for exported functions
|
|
138
|
+
- **Const assertions** — `as const` for literal types
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Good
|
|
142
|
+
interface User {
|
|
143
|
+
id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
role: 'admin' | 'user';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Unions
|
|
149
|
+
type Result<T> = { ok: true; data: T } | { ok: false; error: string };
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Utility Types
|
|
153
|
+
|
|
154
|
+
- `Partial<T>` — all properties optional
|
|
155
|
+
- `Required<T>` — all properties required
|
|
156
|
+
- `Pick<T, K>` — select specific properties
|
|
157
|
+
- `Omit<T, K>` — remove specific properties
|
|
158
|
+
- `Record<K, V>` — key-value map
|
|
159
|
+
|
|
160
|
+
## Type Guards
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
function isUser(value: unknown): value is User {
|
|
164
|
+
return typeof value === 'object' && value !== null && 'id' in value;
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Generic Patterns
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
// Repository pattern
|
|
172
|
+
interface Repository<T extends { id: string }> {
|
|
173
|
+
findById(id: string): Promise<T | null>;
|
|
174
|
+
create(data: Omit<T, 'id'>): Promise<T>;
|
|
175
|
+
update(id: string, data: Partial<T>): Promise<T>;
|
|
176
|
+
delete(id: string): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Anti-Patterns
|
|
181
|
+
|
|
182
|
+
- [FAIL] `any` — use `unknown` + type guards
|
|
183
|
+
- [FAIL] Type assertions (`as`) — prefer type guards
|
|
184
|
+
- [FAIL] Non-null assertions (`!`) — handle null explicitly
|
|
185
|
+
- [FAIL] Enums — prefer union types or `as const` objects
|
|
186
|
+
- [FAIL] Complex generics without JSDoc — document intent
|
|
187
|
+
|
|
188
|
+
<!-- Source: EXAMPLES.md -->
|
|
189
|
+
|
|
190
|
+
# TypeScript Examples — Anti-patterns vs ContextOS Standard
|
|
191
|
+
|
|
192
|
+
## Example 1: Type-Safe Parsing with Zod (No `any`)
|
|
193
|
+
|
|
194
|
+
### Anti-pattern: Anti-pattern (Blind type assertion with `as`)
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// BAD: using 'as User' bypasses runtime validation completely
|
|
198
|
+
async function fetchUser(id: string): Promise<User> {
|
|
199
|
+
const res = await fetch(`/api/users/${id}`);
|
|
200
|
+
const data = await res.json();
|
|
201
|
+
return data as User; // Runtime crash if payload changes!
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Best practice: ContextOS Standard (Runtime schema validation with Zod)
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
// GOOD: guaranteed runtime and compile-time type safety
|
|
209
|
+
import { z } from 'zod';
|
|
210
|
+
|
|
211
|
+
export const UserSchema = z.object({
|
|
212
|
+
id: z.string().uuid(),
|
|
213
|
+
name: z.string().min(1),
|
|
214
|
+
email: z.string().email(),
|
|
215
|
+
role: z.enum(['admin', 'member', 'guest']),
|
|
216
|
+
createdAt: z.string().datetime(),
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
export type User = z.infer<typeof UserSchema>;
|
|
220
|
+
|
|
221
|
+
export async function fetchUser(id: string): Promise<User> {
|
|
222
|
+
const res = await fetch(`/api/users/${id}`);
|
|
223
|
+
if (!res.ok) throw new Error(`Fetch failed with status ${res.status}`);
|
|
224
|
+
const raw: unknown = await res.json();
|
|
225
|
+
return UserSchema.parse(raw);
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Example 2: Discriminated Unions for State Handling
|
|
232
|
+
|
|
233
|
+
### Anti-pattern: Anti-pattern (Optional soup with boolean flags)
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
// BAD: impossible states can be represented (e.g. isLoading: true AND error: 'Failed')
|
|
237
|
+
interface AsyncState<T> {
|
|
238
|
+
data?: T;
|
|
239
|
+
isLoading: boolean;
|
|
240
|
+
error?: string;
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Best practice: ContextOS Standard (Discriminated Union)
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
// GOOD: impossible states are impossible at compile-time
|
|
248
|
+
export type AsyncState<T> =
|
|
249
|
+
| { readonly status: 'idle' }
|
|
250
|
+
| { readonly status: 'loading' }
|
|
251
|
+
| { readonly status: 'success'; readonly data: T }
|
|
252
|
+
| { readonly status: 'error'; readonly error: Error };
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
<!-- Source: TROUBLESHOOTING.md -->
|
|
256
|
+
|
|
257
|
+
# typescript Troubleshooting & Common Mistakes
|
|
258
|
+
|
|
259
|
+
## 1. Excessive Use of `any` or `as unknown as T`
|
|
260
|
+
|
|
261
|
+
- **Symptom**: Runtime `TypeError: Cannot read properties of undefined` in supposedly typed TypeScript code.
|
|
262
|
+
- **Root Cause**: Bypassing type checking with `any` or forceful type assertions.
|
|
263
|
+
- **Fix**: Use `unknown` with type guards, Zod schemas, or discriminated unions.
|
|
264
|
+
|
|
265
|
+
## 2. Non-Exhaustive Switch on Unions
|
|
266
|
+
|
|
267
|
+
- **Symptom**: New union member added but some switch statements fail to handle it, producing bugs.
|
|
268
|
+
- **Root Cause**: Missing exhaustive type checking in `default:` case.
|
|
269
|
+
- **Fix**: Add `default: const _exhaustive: never = action; throw new Error(_exhaustive);` to let the compiler catch missing branches.
|
|
270
|
+
|
|
271
|
+
## 3. Inaccurate Generics Constraints
|
|
272
|
+
|
|
273
|
+
- **Symptom**: Generic functions that lose type inference and resolve to `unknown`.
|
|
274
|
+
- **Root Cause**: Over-specifying generics or missing `extends` constraints.
|
|
275
|
+
- **Fix**: Constrain generics narrowly: `function get<T, K extends keyof T>(obj: T, key: K): T[K]`.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: UI Design
|
|
3
|
+
description: >
|
|
4
|
+
ContextOS skill for UI Design
|
|
5
|
+
---
|
|
6
|
+
# UI Design
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Modern component library and design system engineering. Enforces design token hierarchies (spacing, radii, elevation), accessible component primitives (shadcn/ui, Radix), and responsive layout constraints.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate when designing design systems, reusable UI component libraries, navigation bars, modals, data tables, and interactive dashboards.
|
|
15
|
+
|
|
16
|
+
## Rules & Patterns
|
|
17
|
+
<!-- Source: ui.md -->
|
|
18
|
+
|
|
19
|
+
## UI Design — Best Practices
|
|
20
|
+
|
|
21
|
+
## Design System Foundations
|
|
22
|
+
|
|
23
|
+
### Color
|
|
24
|
+
|
|
25
|
+
- **Never use generic colors** — curate a harmonious palette
|
|
26
|
+
- **Always tint** — no pure black (#000), no pure gray. Add a subtle warm or cool tint
|
|
27
|
+
- **Color roles**: primary (action), secondary (accent), neutral (text, borders), semantic (error, success, warning, info)
|
|
28
|
+
- **Dark mode**: design intentionally, not just invert. Surface hierarchy: background < surface < elevated
|
|
29
|
+
- **Contrast**: 4.5:1 minimum for body text, 3:1 for large text
|
|
30
|
+
|
|
31
|
+
### Typography
|
|
32
|
+
|
|
33
|
+
- **Never use browser defaults** — choose a curated font (Inter, Outfit, Geist, Sora)
|
|
34
|
+
- **Type scale**: use a modular scale (1.25 ratio) — 12, 14, 16, 20, 24, 32, 40, 48
|
|
35
|
+
- **Font weights**: Regular (400), Medium (500), Semibold (600), Bold (700). Don't use all of them — pick 2-3
|
|
36
|
+
- **Line height**: 1.5 for body, 1.2 for headings, 1.6 for long-form text
|
|
37
|
+
- **Max line width**: 65-75 characters for readability
|
|
38
|
+
|
|
39
|
+
### Spacing
|
|
40
|
+
|
|
41
|
+
- **Use a 4px grid** — all spacing should be multiples of 4
|
|
42
|
+
- **Spacing scale**: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96
|
|
43
|
+
- **Consistency** — same spacing between similar elements
|
|
44
|
+
- **Whitespace is design** — don't fill every pixel
|
|
45
|
+
|
|
46
|
+
### Layout
|
|
47
|
+
|
|
48
|
+
- **Grid system**: 12-column grid for desktop, 4-column for mobile
|
|
49
|
+
- **Visual hierarchy**: size, weight, color, spacing, position
|
|
50
|
+
- **F-pattern/Z-pattern** — for content-heavy pages
|
|
51
|
+
- **Group related items** — use proximity and boundaries
|
|
52
|
+
|
|
53
|
+
## Component Patterns
|
|
54
|
+
|
|
55
|
+
### Buttons
|
|
56
|
+
|
|
57
|
+
- Clear hierarchy: Primary > Secondary > Ghost/Text
|
|
58
|
+
- Consistent sizing: sm (32px), md (40px), lg (48px)
|
|
59
|
+
- States: default, hover, active, disabled, loading
|
|
60
|
+
- Always accessible: sufficient contrast, focus indicator
|
|
61
|
+
|
|
62
|
+
### Forms
|
|
63
|
+
|
|
64
|
+
- Labels above inputs (not floating labels for critical forms)
|
|
65
|
+
- Clear error states with inline messages
|
|
66
|
+
- Logical tab order
|
|
67
|
+
- Progressive disclosure — don't show all fields at once
|
|
68
|
+
|
|
69
|
+
### Cards
|
|
70
|
+
|
|
71
|
+
- Don't nest cards inside cards
|
|
72
|
+
- Clear visual hierarchy within the card
|
|
73
|
+
- Consistent padding and spacing
|
|
74
|
+
- Interactive cards need hover state
|
|
75
|
+
|
|
76
|
+
### Navigation
|
|
77
|
+
|
|
78
|
+
- Maximum 7±2 items in primary nav
|
|
79
|
+
- Clear active state
|
|
80
|
+
- Mobile: bottom nav or hamburger (not both)
|
|
81
|
+
- Breadcrumbs for deep hierarchies
|
|
82
|
+
|
|
83
|
+
## Animation Principles
|
|
84
|
+
|
|
85
|
+
- **Purpose**: guide attention, show relationships, provide feedback
|
|
86
|
+
- **Duration**: 150-300ms for micro-interactions, 300-500ms for transitions
|
|
87
|
+
- **Easing**: `ease-out` for entrances, `ease-in` for exits. Never `bounce` or `elastic`
|
|
88
|
+
- **Reduce motion**: respect `prefers-reduced-motion`
|
|
89
|
+
|
|
90
|
+
## Anti-Patterns (from Impeccable)
|
|
91
|
+
|
|
92
|
+
- [FAIL] Gray text on colored backgrounds — destroys readability
|
|
93
|
+
- [FAIL] Pure black text on white (#000 on #fff) — too harsh, tint the black
|
|
94
|
+
- [FAIL] Cards nested inside cards — visual noise
|
|
95
|
+
- [FAIL] Bounce/elastic easing — feels dated
|
|
96
|
+
- [FAIL] Icon tile above every heading — SaaS template tell
|
|
97
|
+
- [FAIL] Purple-to-blue gradient on everything — overused
|
|
98
|
+
- [FAIL] Using Inter for everything — pick a font that matches your brand
|
|
99
|
+
- [FAIL] Rounded-square icons everywhere — lack of visual variety
|
|
100
|
+
|
|
101
|
+
## Dark Mode
|
|
102
|
+
|
|
103
|
+
- Surface elevation through subtle lightening (not colored backgrounds)
|
|
104
|
+
- Reduce white contrast — use #E0E0E0, not #FFFFFF
|
|
105
|
+
- Shadows become less visible — use subtle borders or elevation changes
|
|
106
|
+
- Test all states in both modes
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## Code Examples
|
|
110
|
+
|
|
111
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
112
|
+
|
|
113
|
+
## Validation Checklist
|
|
114
|
+
|
|
115
|
+
What to verify during the review phase before completing the task.
|
|
116
|
+
|
|
117
|
+
## Common Mistakes
|
|
118
|
+
|
|
119
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
120
|
+
|
|
121
|
+
## Integration Notes
|
|
122
|
+
|
|
123
|
+
How this skill interacts with other skills.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<!-- Source: EXAMPLES.md -->
|
|
127
|
+
|
|
128
|
+
# ui-design Examples — Anti-patterns vs ContextOS Standard
|
|
129
|
+
|
|
130
|
+
## Example 1: Component Token Consistency
|
|
131
|
+
|
|
132
|
+
### Anti-pattern: Hardcoded Arbitrary Tailwind Utilities
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
// BAD: Inconsistent spacing, arbitrary colors, unmaintainable styling
|
|
136
|
+
<div className="p-[13px] bg-[#1a1b2e] rounded-[7px] text-[#99aab5] border border-[#2b2d42]">
|
|
137
|
+
<button className="px-[15px] py-[7px] bg-[#5865f2] hover:bg-[#4752c4]">Action</button>
|
|
138
|
+
</div>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Best practice: ContextOS Standard (Semantic Theme Tokens)
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
// GOOD: Consistent scale utilities driven by Tailwind v4 @theme design tokens
|
|
145
|
+
<div className="p-4 bg-card rounded-lg text-muted-foreground border border-border">
|
|
146
|
+
<Button variant="primary" size="md">Action</Button>
|
|
147
|
+
</div>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
<!-- Source: TROUBLESHOOTING.md -->
|
|
151
|
+
|
|
152
|
+
# ui-design Troubleshooting & Common Mistakes
|
|
153
|
+
|
|
154
|
+
## 1. Z-Index Chaos
|
|
155
|
+
|
|
156
|
+
- **Symptom**: Tooltips rendered underneath dialog overlays, or dropdowns hidden behind sticky headers.
|
|
157
|
+
- **Root Cause**: Ad-hoc hardcoded values (z-50, z-[999], z-[9999]).
|
|
158
|
+
- **Fix**: Use Radix / shadcn Portals for floating elements so they render at root DOM level, or declare strict z-index tokens.
|
|
159
|
+
|
|
160
|
+
## 2. Inconsistent Component States
|
|
161
|
+
|
|
162
|
+
- **Symptom**: Buttons have hover states but lack focus-visible rings or disabled states.
|
|
163
|
+
- **Root Cause**: Styling only the default and hover states.
|
|
164
|
+
- **Fix**: Standardize state matrices for every interactive element: default, hover, focus-visible, active, disabled, loading.
|
|
165
|
+
|
|
166
|
+
## 3. Ignoring Empty and Error Component States
|
|
167
|
+
|
|
168
|
+
- **Symptom**: Tables or list views show a blank white box when there are 0 records.
|
|
169
|
+
- **Root Cause**: Developers only design for the "ideal data" case.
|
|
170
|
+
- **Fix**: Every data component must explicitly render designed EmptyState and ErrorState fallbacks.
|