@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
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
````markdown
|
|
2
|
+
---
|
|
3
|
+
inclusion: manual
|
|
4
|
+
name: frontend-code-review
|
|
5
|
+
description: Review frontend code for accessibility, performance, state management, rendering efficiency, and design system compliance.
|
|
6
|
+
license: Apache-2.0
|
|
7
|
+
metadata:
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Frontend Code Review
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Perform structured code reviews of frontend code, evaluating accessibility, performance, state management, rendering cost, and design system compliance. Produces actionable findings ranked by severity.
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
- Reviewing a pull request that touches frontend components, styles, or layout
|
|
22
|
+
- Auditing an existing page or component for quality issues
|
|
23
|
+
- Checking that new code follows team conventions and standards
|
|
24
|
+
- Pre-launch review of a feature or page
|
|
25
|
+
- When asked to "review", "audit", or "check" frontend code
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
### Step 1 — Scope the Review
|
|
30
|
+
|
|
31
|
+
Identify what's being reviewed:
|
|
32
|
+
|
|
33
|
+
- **Single component**: focus on API, accessibility, and rendering
|
|
34
|
+
- **Page/feature**: focus on layout, loading states, and user flow
|
|
35
|
+
- **Styles/CSS**: focus on token usage, responsiveness, and specificity
|
|
36
|
+
- **Full audit**: run all checks below
|
|
37
|
+
|
|
38
|
+
### Step 2 — Accessibility Review
|
|
39
|
+
|
|
40
|
+
Check each item. Mark as pass (✓), fail (✗), or not-applicable (—):
|
|
41
|
+
|
|
42
|
+
| Check | Details |
|
|
43
|
+
| ------------------- | ------------------------------------------------------------------------------- |
|
|
44
|
+
| Semantic HTML | Correct elements (button, nav, main — not div for everything) |
|
|
45
|
+
| Heading hierarchy | h1 → h2 → h3, no skipped levels |
|
|
46
|
+
| Keyboard navigation | All interactive elements reachable via Tab, operable via Enter/Space |
|
|
47
|
+
| Focus management | Visible focus indicator, focus trapped in modals, restored after close |
|
|
48
|
+
| ARIA attributes | Used only when native semantics insufficient, correct roles/states |
|
|
49
|
+
| Color contrast | Text ≥ 4.5:1 (normal), ≥ 3:1 (large), UI components ≥ 3:1 |
|
|
50
|
+
| Alt text | Images have meaningful alt (or empty alt for decorative) |
|
|
51
|
+
| Form labels | Every input has visible label or aria-label, errors linked via aria-describedby |
|
|
52
|
+
| Motion | Animations respect prefers-reduced-motion |
|
|
53
|
+
|
|
54
|
+
### Step 3 — Performance Review
|
|
55
|
+
|
|
56
|
+
| Check | Details |
|
|
57
|
+
| ------------------ | --------------------------------------------------------------------------------- |
|
|
58
|
+
| Bundle impact | New dependencies justified? Tree-shakeable? Could use native API instead? |
|
|
59
|
+
| Render cost | Unnecessary re-renders? Missing memoization on expensive computations? |
|
|
60
|
+
| Layout shifts | Images/embeds have dimensions? Dynamic content reserves space? |
|
|
61
|
+
| Loading strategy | Lazy-loaded below fold? Code-split at route level? |
|
|
62
|
+
| Animation cost | Compositor-only properties (transform, opacity)? No layout-triggering animations? |
|
|
63
|
+
| Asset optimization | Images in modern format (WebP/AVIF)? Fonts preloaded? CSS critical path? |
|
|
64
|
+
|
|
65
|
+
### Step 4 — State Management Review
|
|
66
|
+
|
|
67
|
+
| Check | Details |
|
|
68
|
+
| -------------------- | -------------------------------------------------------------------- |
|
|
69
|
+
| State location | State lives at the right level? Not lifted too high or duplicated? |
|
|
70
|
+
| Derived state | Computed from source state, not stored separately? |
|
|
71
|
+
| Side effects | Cleanup on unmount? Race conditions handled? Abort controllers used? |
|
|
72
|
+
| Loading/error states | All async operations handle loading, success, and error? |
|
|
73
|
+
| Form state | Controlled vs uncontrolled appropriate? Validation on blur/submit? |
|
|
74
|
+
|
|
75
|
+
### Step 5 — Design System Compliance
|
|
76
|
+
|
|
77
|
+
| Check | Details |
|
|
78
|
+
| ------------------- | --------------------------------------------------------------- |
|
|
79
|
+
| Token usage | Colors, spacing, typography, radius, shadows use design tokens? |
|
|
80
|
+
| Component usage | Using system components vs. custom implementations? |
|
|
81
|
+
| Naming conventions | Class names, component names follow team patterns? |
|
|
82
|
+
| Responsive behavior | Mobile-first? Breakpoints consistent with system? |
|
|
83
|
+
| Consistency | Visual style matches existing pages/components? |
|
|
84
|
+
|
|
85
|
+
### Step 6 — Code Quality
|
|
86
|
+
|
|
87
|
+
| Check | Details |
|
|
88
|
+
| ------------------- | ----------------------------------------------------------- |
|
|
89
|
+
| TypeScript | Proper types (no `any`), discriminated unions for variants? |
|
|
90
|
+
| Component structure | Single responsibility? Reasonable size (< 200 lines)? |
|
|
91
|
+
| Error boundaries | Errors caught at appropriate levels? Fallback UI provided? |
|
|
92
|
+
| Testing | Key interactions tested? Visual regression coverage? |
|
|
93
|
+
| Documentation | Complex logic commented? Props documented? |
|
|
94
|
+
|
|
95
|
+
## Output Format
|
|
96
|
+
|
|
97
|
+
Structure every review as:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
## Review Summary
|
|
101
|
+
[1-2 sentence overview of overall quality]
|
|
102
|
+
|
|
103
|
+
## Critical (must fix before merge)
|
|
104
|
+
- **[Category]**: [issue] → [fix]
|
|
105
|
+
|
|
106
|
+
## Important (should fix)
|
|
107
|
+
- **[Category]**: [issue] → [fix]
|
|
108
|
+
|
|
109
|
+
## Suggestions (nice to have)
|
|
110
|
+
- **[Category]**: [suggestion]
|
|
111
|
+
|
|
112
|
+
## Passing
|
|
113
|
+
- ✓ [what's done well — always include positives]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Severity definitions:
|
|
117
|
+
|
|
118
|
+
- **Critical**: Accessibility violations, security issues, data loss risks, broken functionality
|
|
119
|
+
- **Important**: Performance problems, missing error handling, design system violations
|
|
120
|
+
- **Suggestion**: Code style, minor optimizations, documentation gaps
|
|
121
|
+
|
|
122
|
+
## References
|
|
123
|
+
|
|
124
|
+
- [references/review-checklists.md](references/review-checklists.md) — quick-reference checklists for common review scenarios
|
|
125
|
+
- [references/common-antipatterns.md](references/common-antipatterns.md) — frequently seen frontend antipatterns with fixes
|
|
126
|
+
- [references/performance-budgets.md](references/performance-budgets.md) — performance targets and measurement guidance
|
|
127
|
+
|
|
128
|
+
## Examples
|
|
129
|
+
|
|
130
|
+
**User**: "Review this React component" (pastes a Card component)
|
|
131
|
+
|
|
132
|
+
**Response approach**: Run all 5 review steps. Check semantic HTML (is it using button/a vs div for interactive cards?), token usage (are colors hardcoded?), component API (boolean flags vs variants?), rendering (is it re-rendering unnecessarily?). Output findings in severity-ranked format.
|
|
133
|
+
|
|
134
|
+
**User**: "Check this PR for accessibility issues"
|
|
135
|
+
|
|
136
|
+
**Response approach**: Focus on Step 2 (Accessibility Review). Run through the full accessibility checklist. Report findings with WCAG criterion references and specific code fixes.
|
|
137
|
+
````
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-code-review
|
|
3
|
+
description: Review frontend code for accessibility, performance, state management, rendering efficiency, and design system compliance.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: cubis-foundry
|
|
7
|
+
version: "3.0"
|
|
8
|
+
compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Frontend Code Review
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Perform structured code reviews of frontend code, evaluating accessibility, performance, state management, rendering cost, and design system compliance. Produces actionable findings ranked by severity.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- Reviewing a pull request that touches frontend components, styles, or layout
|
|
20
|
+
- Auditing an existing page or component for quality issues
|
|
21
|
+
- Checking that new code follows team conventions and standards
|
|
22
|
+
- Pre-launch review of a feature or page
|
|
23
|
+
- When asked to "review", "audit", or "check" frontend code
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
### Step 1 — Scope the Review
|
|
28
|
+
|
|
29
|
+
Identify what's being reviewed:
|
|
30
|
+
|
|
31
|
+
- **Single component**: focus on API, accessibility, and rendering
|
|
32
|
+
- **Page/feature**: focus on layout, loading states, and user flow
|
|
33
|
+
- **Styles/CSS**: focus on token usage, responsiveness, and specificity
|
|
34
|
+
- **Full audit**: run all checks below
|
|
35
|
+
|
|
36
|
+
### Step 2 — Accessibility Review
|
|
37
|
+
|
|
38
|
+
Check each item. Mark as pass (✓), fail (✗), or not-applicable (—):
|
|
39
|
+
|
|
40
|
+
| Check | Details |
|
|
41
|
+
| ------------------- | ------------------------------------------------------------------------------- |
|
|
42
|
+
| Semantic HTML | Correct elements (button, nav, main — not div for everything) |
|
|
43
|
+
| Heading hierarchy | h1 → h2 → h3, no skipped levels |
|
|
44
|
+
| Keyboard navigation | All interactive elements reachable via Tab, operable via Enter/Space |
|
|
45
|
+
| Focus management | Visible focus indicator, focus trapped in modals, restored after close |
|
|
46
|
+
| ARIA attributes | Used only when native semantics insufficient, correct roles/states |
|
|
47
|
+
| Color contrast | Text ≥ 4.5:1 (normal), ≥ 3:1 (large), UI components ≥ 3:1 |
|
|
48
|
+
| Alt text | Images have meaningful alt (or empty alt for decorative) |
|
|
49
|
+
| Form labels | Every input has visible label or aria-label, errors linked via aria-describedby |
|
|
50
|
+
| Motion | Animations respect prefers-reduced-motion |
|
|
51
|
+
|
|
52
|
+
### Step 3 — Performance Review
|
|
53
|
+
|
|
54
|
+
| Check | Details |
|
|
55
|
+
| ------------------ | --------------------------------------------------------------------------------- |
|
|
56
|
+
| Bundle impact | New dependencies justified? Tree-shakeable? Could use native API instead? |
|
|
57
|
+
| Render cost | Unnecessary re-renders? Missing memoization on expensive computations? |
|
|
58
|
+
| Layout shifts | Images/embeds have dimensions? Dynamic content reserves space? |
|
|
59
|
+
| Loading strategy | Lazy-loaded below fold? Code-split at route level? |
|
|
60
|
+
| Animation cost | Compositor-only properties (transform, opacity)? No layout-triggering animations? |
|
|
61
|
+
| Asset optimization | Images in modern format (WebP/AVIF)? Fonts preloaded? CSS critical path? |
|
|
62
|
+
|
|
63
|
+
### Step 4 — State Management Review
|
|
64
|
+
|
|
65
|
+
| Check | Details |
|
|
66
|
+
| -------------------- | -------------------------------------------------------------------- |
|
|
67
|
+
| State location | State lives at the right level? Not lifted too high or duplicated? |
|
|
68
|
+
| Derived state | Computed from source state, not stored separately? |
|
|
69
|
+
| Side effects | Cleanup on unmount? Race conditions handled? Abort controllers used? |
|
|
70
|
+
| Loading/error states | All async operations handle loading, success, and error? |
|
|
71
|
+
| Form state | Controlled vs uncontrolled appropriate? Validation on blur/submit? |
|
|
72
|
+
|
|
73
|
+
### Step 5 — Design System Compliance
|
|
74
|
+
|
|
75
|
+
| Check | Details |
|
|
76
|
+
| ------------------- | --------------------------------------------------------------- |
|
|
77
|
+
| Token usage | Colors, spacing, typography, radius, shadows use design tokens? |
|
|
78
|
+
| Component usage | Using system components vs. custom implementations? |
|
|
79
|
+
| Naming conventions | Class names, component names follow team patterns? |
|
|
80
|
+
| Responsive behavior | Mobile-first? Breakpoints consistent with system? |
|
|
81
|
+
| Consistency | Visual style matches existing pages/components? |
|
|
82
|
+
|
|
83
|
+
### Step 6 — Code Quality
|
|
84
|
+
|
|
85
|
+
| Check | Details |
|
|
86
|
+
| ------------------- | ----------------------------------------------------------- |
|
|
87
|
+
| TypeScript | Proper types (no `any`), discriminated unions for variants? |
|
|
88
|
+
| Component structure | Single responsibility? Reasonable size (< 200 lines)? |
|
|
89
|
+
| Error boundaries | Errors caught at appropriate levels? Fallback UI provided? |
|
|
90
|
+
| Testing | Key interactions tested? Visual regression coverage? |
|
|
91
|
+
| Documentation | Complex logic commented? Props documented? |
|
|
92
|
+
|
|
93
|
+
## Output Format
|
|
94
|
+
|
|
95
|
+
Structure every review as:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
## Review Summary
|
|
99
|
+
[1-2 sentence overview of overall quality]
|
|
100
|
+
|
|
101
|
+
## Critical (must fix before merge)
|
|
102
|
+
- **[Category]**: [issue] → [fix]
|
|
103
|
+
|
|
104
|
+
## Important (should fix)
|
|
105
|
+
- **[Category]**: [issue] → [fix]
|
|
106
|
+
|
|
107
|
+
## Suggestions (nice to have)
|
|
108
|
+
- **[Category]**: [suggestion]
|
|
109
|
+
|
|
110
|
+
## Passing
|
|
111
|
+
- ✓ [what's done well — always include positives]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Severity definitions:
|
|
115
|
+
|
|
116
|
+
- **Critical**: Accessibility violations, security issues, data loss risks, broken functionality
|
|
117
|
+
- **Important**: Performance problems, missing error handling, design system violations
|
|
118
|
+
- **Suggestion**: Code style, minor optimizations, documentation gaps
|
|
119
|
+
|
|
120
|
+
## References
|
|
121
|
+
|
|
122
|
+
- [references/review-checklists.md](references/review-checklists.md) — quick-reference checklists for common review scenarios
|
|
123
|
+
- [references/common-antipatterns.md](references/common-antipatterns.md) — frequently seen frontend antipatterns with fixes
|
|
124
|
+
- [references/performance-budgets.md](references/performance-budgets.md) — performance targets and measurement guidance
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
**User**: "Review this React component" (pastes a Card component)
|
|
129
|
+
|
|
130
|
+
**Response approach**: Run all 5 review steps. Check semantic HTML (is it using button/a vs div for interactive cards?), token usage (are colors hardcoded?), component API (boolean flags vs variants?), rendering (is it re-rendering unnecessarily?). Output findings in severity-ranked format.
|
|
131
|
+
|
|
132
|
+
**User**: "Check this PR for accessibility issues"
|
|
133
|
+
|
|
134
|
+
**Response approach**: Focus on Step 2 (Accessibility Review). Run through the full accessibility checklist. Report findings with WCAG criterion references and specific code fixes.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Common Frontend Antipatterns
|
|
2
|
+
|
|
3
|
+
## Accessibility
|
|
4
|
+
|
|
5
|
+
### div-as-button
|
|
6
|
+
|
|
7
|
+
**Problem**: `<div onClick={...}>Click me</div>`
|
|
8
|
+
**Fix**: Use `<button>` — gets keyboard events, focus, and ARIA role for free.
|
|
9
|
+
|
|
10
|
+
### Missing form labels
|
|
11
|
+
|
|
12
|
+
**Problem**: `<input placeholder="Email" />` with no label
|
|
13
|
+
**Fix**: `<label htmlFor="email">Email</label><input id="email" />` — placeholder is not a label.
|
|
14
|
+
|
|
15
|
+
### Color-only state indication
|
|
16
|
+
|
|
17
|
+
**Problem**: Error field only turns red, no text or icon
|
|
18
|
+
**Fix**: Add error message text + icon alongside the color change.
|
|
19
|
+
|
|
20
|
+
## Performance
|
|
21
|
+
|
|
22
|
+
### Inline object/array props
|
|
23
|
+
|
|
24
|
+
**Problem**: `<Component style={{ color: 'red' }} items={[1,2,3]} />`
|
|
25
|
+
**Fix**: Move to module-level constants or useMemo — inline objects create new references every render.
|
|
26
|
+
|
|
27
|
+
### Missing keys or index-as-key
|
|
28
|
+
|
|
29
|
+
**Problem**: `list.map((item, i) => <Item key={i} />)`
|
|
30
|
+
**Fix**: Use stable unique IDs as keys — index breaks when list is reordered/filtered.
|
|
31
|
+
|
|
32
|
+
### Unoptimized images
|
|
33
|
+
|
|
34
|
+
**Problem**: 2MB PNG for a 200px thumbnail
|
|
35
|
+
**Fix**: Use WebP/AVIF, responsive `srcset`, and `loading="lazy"` for below-fold images.
|
|
36
|
+
|
|
37
|
+
### useEffect for derived state
|
|
38
|
+
|
|
39
|
+
**Problem**: `useEffect(() => setFullName(first + ' ' + last), [first, last])`
|
|
40
|
+
**Fix**: `const fullName = first + ' ' + last` — compute during render, no effect needed.
|
|
41
|
+
|
|
42
|
+
## State Management
|
|
43
|
+
|
|
44
|
+
### Prop drilling through 4+ levels
|
|
45
|
+
|
|
46
|
+
**Problem**: Passing props through intermediate components that don't use them
|
|
47
|
+
**Fix**: Use context, composition (children), or state management library.
|
|
48
|
+
|
|
49
|
+
### Storing server state in local state
|
|
50
|
+
|
|
51
|
+
**Problem**: `const [users, setUsers] = useState([]); useEffect(() => fetch...)`
|
|
52
|
+
**Fix**: Use a data-fetching library (SWR, TanStack Query) — handles caching, revalidation, race conditions.
|
|
53
|
+
|
|
54
|
+
### Missing cleanup in effects
|
|
55
|
+
|
|
56
|
+
**Problem**: `useEffect(() => { const id = setInterval(...) }, [])` with no return
|
|
57
|
+
**Fix**: Return cleanup function: `return () => clearInterval(id)`
|
|
58
|
+
|
|
59
|
+
## Design System
|
|
60
|
+
|
|
61
|
+
### Hardcoded magic numbers
|
|
62
|
+
|
|
63
|
+
**Problem**: `padding: 13px; margin-top: 7px; color: #3b82f6;`
|
|
64
|
+
**Fix**: Use design tokens: `padding: var(--spacing-3); color: var(--color-interactive-primary)`
|
|
65
|
+
|
|
66
|
+
### Boolean prop explosion
|
|
67
|
+
|
|
68
|
+
**Problem**: `<Button primary large outlined rounded disabled />`
|
|
69
|
+
**Fix**: `<Button variant="primary" size="lg" disabled />` — use constrained variant props.
|
|
70
|
+
|
|
71
|
+
### CSS specificity wars
|
|
72
|
+
|
|
73
|
+
**Problem**: `.container .card .header .title { ... }` or `!important` everywhere
|
|
74
|
+
**Fix**: Use flat selectors, utility classes, or CSS Modules for scoping.
|
|
75
|
+
|
|
76
|
+
## Component Design
|
|
77
|
+
|
|
78
|
+
### God component
|
|
79
|
+
|
|
80
|
+
**Problem**: Single component file > 500 lines handling multiple concerns
|
|
81
|
+
**Fix**: Extract subcomponents, custom hooks, and utility functions.
|
|
82
|
+
|
|
83
|
+
### Premature abstraction
|
|
84
|
+
|
|
85
|
+
**Problem**: Creating a reusable component from a single use case
|
|
86
|
+
**Fix**: Wait for 2+ real use cases before extracting — inline is fine for now.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Performance Budgets
|
|
2
|
+
|
|
3
|
+
## Core Web Vitals Targets
|
|
4
|
+
|
|
5
|
+
| Metric | Good | Needs Improvement | Poor |
|
|
6
|
+
| ------------------------------- | ------- | ----------------- | ------- |
|
|
7
|
+
| LCP (Largest Contentful Paint) | < 2.5s | 2.5–4.0s | > 4.0s |
|
|
8
|
+
| INP (Interaction to Next Paint) | < 200ms | 200–500ms | > 500ms |
|
|
9
|
+
| CLS (Cumulative Layout Shift) | < 0.1 | 0.1–0.25 | > 0.25 |
|
|
10
|
+
|
|
11
|
+
## Bundle Size Budgets
|
|
12
|
+
|
|
13
|
+
| Resource | Budget | Measurement |
|
|
14
|
+
| ------------------------ | -------------- | ------------------------------------- |
|
|
15
|
+
| Initial JS (compressed) | < 150 KB | gzip/brotli size of critical-path JS |
|
|
16
|
+
| Initial CSS (compressed) | < 50 KB | gzip/brotli size of critical-path CSS |
|
|
17
|
+
| Per-route JS chunk | < 50 KB | code-split chunk per route |
|
|
18
|
+
| Single component | < 10 KB | component + its direct dependencies |
|
|
19
|
+
| New dependency | Justify > 5 KB | check bundlephobia before adding |
|
|
20
|
+
|
|
21
|
+
## Rendering Budgets
|
|
22
|
+
|
|
23
|
+
| Check | Target |
|
|
24
|
+
| -------------------- | --------------------------------- |
|
|
25
|
+
| Component re-renders | ≤ 1 per user interaction |
|
|
26
|
+
| DOM nodes per page | < 1500 total |
|
|
27
|
+
| DOM depth | < 15 levels |
|
|
28
|
+
| Event listeners | No duplicates, cleanup on unmount |
|
|
29
|
+
| Third-party scripts | ≤ 3 per page, all async/defer |
|
|
30
|
+
|
|
31
|
+
## Image Budgets
|
|
32
|
+
|
|
33
|
+
| Image Type | Format | Max Size |
|
|
34
|
+
| ------------- | ------------ | -------- |
|
|
35
|
+
| Hero/banner | WebP/AVIF | < 200 KB |
|
|
36
|
+
| Content image | WebP/AVIF | < 100 KB |
|
|
37
|
+
| Thumbnail | WebP | < 30 KB |
|
|
38
|
+
| Icon | SVG (inline) | < 3 KB |
|
|
39
|
+
| Avatar | WebP | < 15 KB |
|
|
40
|
+
|
|
41
|
+
## Font Budgets
|
|
42
|
+
|
|
43
|
+
| Check | Target |
|
|
44
|
+
| ------------------- | ------------------------------------------------ |
|
|
45
|
+
| Total web fonts | ≤ 2 families |
|
|
46
|
+
| Font file size | < 50 KB per weight (WOFF2) |
|
|
47
|
+
| Font weights loaded | ≤ 3 per family |
|
|
48
|
+
| Font display | `font-display: swap` with size-adjusted fallback |
|
|
49
|
+
|
|
50
|
+
## How to Measure
|
|
51
|
+
|
|
52
|
+
- **Lighthouse**: Overall performance score, CWV metrics
|
|
53
|
+
- **WebPageTest**: Real connection testing, filmstrip
|
|
54
|
+
- **Bundle analyzer**: webpack-bundle-analyzer, source-map-explorer
|
|
55
|
+
- **React DevTools Profiler**: Component render counts and timing
|
|
56
|
+
- **Performance API**: `performance.mark()` / `performance.measure()` for custom timings
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Review Checklists
|
|
2
|
+
|
|
3
|
+
## Quick Component Review (5 min)
|
|
4
|
+
|
|
5
|
+
- [ ] Correct semantic HTML element
|
|
6
|
+
- [ ] Keyboard accessible (Tab, Enter, Escape)
|
|
7
|
+
- [ ] Visible focus indicator
|
|
8
|
+
- [ ] Design tokens used (no hardcoded colors/spacing)
|
|
9
|
+
- [ ] Loading and error states handled
|
|
10
|
+
- [ ] TypeScript types (no `any`)
|
|
11
|
+
|
|
12
|
+
## PR Review (15 min)
|
|
13
|
+
|
|
14
|
+
Everything in Quick Review, plus:
|
|
15
|
+
|
|
16
|
+
- [ ] No accessibility regressions (heading hierarchy, ARIA)
|
|
17
|
+
- [ ] Images have alt text and dimensions
|
|
18
|
+
- [ ] New dependencies justified and tree-shakeable
|
|
19
|
+
- [ ] No unnecessary re-renders
|
|
20
|
+
- [ ] Responsive behavior works (mobile-first)
|
|
21
|
+
- [ ] Error boundaries at appropriate levels
|
|
22
|
+
- [ ] Tests cover key interactions
|
|
23
|
+
|
|
24
|
+
## Full Audit (30+ min)
|
|
25
|
+
|
|
26
|
+
Everything in PR Review, plus:
|
|
27
|
+
|
|
28
|
+
- [ ] Color contrast passes WCAG AA (4.5:1 text, 3:1 UI)
|
|
29
|
+
- [ ] Screen reader experience tested
|
|
30
|
+
- [ ] Animation respects prefers-reduced-motion
|
|
31
|
+
- [ ] Layout shifts measured (CLS target < 0.1)
|
|
32
|
+
- [ ] Bundle size impact analyzed
|
|
33
|
+
- [ ] Forms: labels, validation, error association
|
|
34
|
+
- [ ] State management: correct level, cleanup, race conditions
|
|
35
|
+
- [ ] Component API: consistent with design system patterns
|
|
36
|
+
- [ ] Documentation: props, usage examples, a11y notes
|
|
37
|
+
|
|
38
|
+
## CSS/Styles Review
|
|
39
|
+
|
|
40
|
+
- [ ] Uses design tokens, not hardcoded values
|
|
41
|
+
- [ ] Mobile-first media queries
|
|
42
|
+
- [ ] No `!important` (except utility overrides)
|
|
43
|
+
- [ ] No overly specific selectors (max 2-3 levels)
|
|
44
|
+
- [ ] Dark mode tested
|
|
45
|
+
- [ ] Container queries used where component-level responsiveness needed
|
|
46
|
+
- [ ] Animations use transform/opacity only
|
|
47
|
+
- [ ] No layout-triggering properties in animations
|