connore 0.1.0 → 0.2.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/README.md +58 -46
- package/package.json +36 -33
- package/packs/CONTRIBUTING.md +32 -0
- package/packs/base/catalog/README.md +24 -0
- package/packs/base/catalog/api.md +46 -0
- package/packs/base/catalog/auth.md +46 -0
- package/packs/base/catalog/backend.md +46 -0
- package/packs/base/catalog/blueprints.md +46 -0
- package/packs/base/catalog/components.md +46 -0
- package/packs/base/catalog/database.md +46 -0
- package/packs/base/catalog/docs.md +46 -0
- package/packs/base/catalog/github.md +46 -0
- package/packs/base/catalog/golden.md +46 -0
- package/packs/base/catalog/motion.md +46 -0
- package/packs/base/catalog/plan.md +46 -0
- package/packs/base/catalog/screenshots.md +46 -0
- package/packs/base/catalog/skills.md +46 -0
- package/packs/base/catalog/tokens.md +47 -0
- package/packs/base/planning/START.md +29 -0
- package/packs/base/planning/blueprint-template.md +46 -0
- package/packs/base/planning/plan-template.md +46 -0
- package/packs/base/rules/anti-patterns.md +46 -0
- package/packs/base/rules/code-style.md +46 -0
- package/packs/base/rules/definition-of-done.md +47 -0
- package/packs/base/rules/dependency-policy.md +46 -0
- package/packs/base/rules/error-handling.md +46 -0
- package/packs/base/rules/security-audit.md +47 -0
- package/packs/base/rules/security-baseline.md +46 -0
- package/packs/base/templates/bug-report.md +46 -0
- package/packs/base/templates/feature-spec.md +46 -0
- package/packs/base/templates/handoff.md +46 -0
- package/packs/base/templates/project-brief.md +46 -0
- package/packs/base/workflow/build-loop.md +48 -0
- package/packs/base/workflow/code-review.md +46 -0
- package/packs/base/workflow/debugging.md +47 -0
- package/packs/base/workflow/git-and-commits.md +46 -0
- package/packs/base/workflow/idea-to-spec.md +46 -0
- package/packs/base/workflow/session-handoff.md +46 -0
- package/packs/base/workflow/spec-to-plan.md +46 -0
- package/packs/knowledge/backend/api/conventions.md +21 -0
- package/packs/knowledge/backend/architecture/local-sqlite.md +20 -0
- package/packs/knowledge/backend/authentication/session-and-engine.md +24 -0
- package/packs/knowledge/backend/database/schema.md +21 -0
- package/packs/knowledge/components/custom/ambient-background.md +26 -0
- package/packs/knowledge/components/custom/ambient-background.tsx +12 -0
- package/packs/knowledge/components/custom/corner-frame.md +26 -0
- package/packs/knowledge/components/custom/corner-frame.tsx +48 -0
- package/packs/knowledge/components/custom/cta-button.md +26 -0
- package/packs/knowledge/components/custom/cta-button.tsx +10 -0
- package/packs/knowledge/components/custom/page-transition.md +26 -0
- package/packs/knowledge/components/custom/page-transition.tsx +10 -0
- package/packs/knowledge/components/custom/smooth-scroll.md +26 -0
- package/packs/knowledge/components/custom/smooth-scroll.tsx +32 -0
- package/packs/knowledge/components/motion-effects/README.md +30 -0
- package/packs/knowledge/components/ui-primitives/LICENSE +21 -0
- package/packs/knowledge/components/ui-primitives/README.md +22 -0
- package/packs/knowledge/components/ui-primitives/badge.md +26 -0
- package/packs/knowledge/components/ui-primitives/badge.tsx +48 -0
- package/packs/knowledge/components/ui-primitives/button.md +27 -0
- package/packs/knowledge/components/ui-primitives/button.tsx +66 -0
- package/packs/knowledge/components/ui-primitives/card.md +26 -0
- package/packs/knowledge/components/ui-primitives/card.tsx +102 -0
- package/packs/knowledge/components/ui-primitives/checkbox.md +26 -0
- package/packs/knowledge/components/ui-primitives/checkbox.tsx +32 -0
- package/packs/knowledge/components/ui-primitives/dialog.md +26 -0
- package/packs/knowledge/components/ui-primitives/dialog.tsx +168 -0
- package/packs/knowledge/components/ui-primitives/dropdown-menu.md +26 -0
- package/packs/knowledge/components/ui-primitives/dropdown-menu.tsx +268 -0
- package/packs/knowledge/components/ui-primitives/input.md +27 -0
- package/packs/knowledge/components/ui-primitives/input.tsx +18 -0
- package/packs/knowledge/components/ui-primitives/label.md +26 -0
- package/packs/knowledge/components/ui-primitives/label.tsx +23 -0
- package/packs/knowledge/components/ui-primitives/progress.md +26 -0
- package/packs/knowledge/components/ui-primitives/progress.tsx +30 -0
- package/packs/knowledge/components/ui-primitives/scroll-area.md +26 -0
- package/packs/knowledge/components/ui-primitives/scroll-area.tsx +54 -0
- package/packs/knowledge/components/ui-primitives/select.md +26 -0
- package/packs/knowledge/components/ui-primitives/select.tsx +191 -0
- package/packs/knowledge/components/ui-primitives/separator.md +26 -0
- package/packs/knowledge/components/ui-primitives/separator.tsx +27 -0
- package/packs/knowledge/components/ui-primitives/sonner.md +26 -0
- package/packs/knowledge/components/ui-primitives/sonner.tsx +49 -0
- package/packs/knowledge/components/ui-primitives/switch.md +26 -0
- package/packs/knowledge/components/ui-primitives/switch.tsx +32 -0
- package/packs/knowledge/components/ui-primitives/tabs.md +26 -0
- package/packs/knowledge/components/ui-primitives/tabs.tsx +89 -0
- package/packs/knowledge/components/ui-primitives/textarea.md +26 -0
- package/packs/knowledge/components/ui-primitives/textarea.tsx +17 -0
- package/packs/knowledge/components/ui-primitives/tooltip.md +26 -0
- package/packs/knowledge/components/ui-primitives/tooltip.tsx +56 -0
- package/packs/knowledge/design/aesthetics/app-shell.md +41 -0
- package/packs/knowledge/design/aesthetics/code-neutral.md +40 -0
- package/packs/knowledge/design/aesthetics/match.md +46 -0
- package/packs/knowledge/design/aesthetics/ruled-outline.md +40 -0
- package/packs/knowledge/design/aesthetics/solid-accent.md +43 -0
- package/packs/knowledge/design/animations/motion.md +40 -0
- package/packs/knowledge/design/project-style.md +50 -0
- package/packs/knowledge/design/references/benefit-card-grid.md +27 -0
- package/packs/knowledge/design/references/benefit-card-grid.png +0 -0
- package/packs/knowledge/design/references/cta-centered.md +27 -0
- package/packs/knowledge/design/references/cta-centered.png +0 -0
- package/packs/knowledge/design/references/cta-split-media.md +27 -0
- package/packs/knowledge/design/references/cta-split-media.png +0 -0
- package/packs/knowledge/design/references/dashboard-overview.md +31 -0
- package/packs/knowledge/design/references/dashboard-overview.png +0 -0
- package/packs/knowledge/design/references/faq-split-accordion.md +27 -0
- package/packs/knowledge/design/references/faq-split-accordion.png +0 -0
- package/packs/knowledge/design/references/feature-split-checklist.md +27 -0
- package/packs/knowledge/design/references/feature-split-checklist.png +0 -0
- package/packs/knowledge/design/references/footer-four-column.md +27 -0
- package/packs/knowledge/design/references/footer-four-column.png +0 -0
- package/packs/knowledge/design/references/footer-two-column.md +27 -0
- package/packs/knowledge/design/references/footer-two-column.png +0 -0
- package/packs/knowledge/design/references/hero-accent-curtain.md +27 -0
- package/packs/knowledge/design/references/hero-accent-curtain.png +0 -0
- package/packs/knowledge/design/references/hero-split-media.md +27 -0
- package/packs/knowledge/design/references/hero-split-media.png +0 -0
- package/packs/knowledge/design/references/logo-cloud-grid.md +27 -0
- package/packs/knowledge/design/references/logo-cloud-grid.png +0 -0
- package/packs/knowledge/design/references/logo-row-ruled.md +27 -0
- package/packs/knowledge/design/references/logo-row-ruled.png +0 -0
- package/packs/knowledge/design/references/pricing-three-card.md +27 -0
- package/packs/knowledge/design/references/pricing-three-card.png +0 -0
- package/packs/knowledge/design/references/steps-ruled-grid.md +27 -0
- package/packs/knowledge/design/references/steps-ruled-grid.png +0 -0
- package/packs/knowledge/design/rules.md +35 -0
- package/packs/knowledge/design/token-structure.md +46 -0
- package/packs/knowledge/design/tokens.md +55 -0
- package/packs/knowledge/frontend/README.md +50 -0
- package/packs/knowledge/frontend/SOURCES.md +40 -0
- package/packs/knowledge/frontend/accessibility/focus-and-dialogs.md +47 -0
- package/packs/knowledge/frontend/accessibility/semantics-and-keyboard.md +45 -0
- package/packs/knowledge/frontend/accessibility/wcag-targets.md +43 -0
- package/packs/knowledge/frontend/architecture/agent-context-files.md +43 -0
- package/packs/knowledge/frontend/architecture/app-foundations.md +43 -0
- package/packs/knowledge/frontend/architecture/error-handling.md +47 -0
- package/packs/knowledge/frontend/architecture/feature-modules.md +49 -0
- package/packs/knowledge/frontend/architecture/import-boundaries.md +44 -0
- package/packs/knowledge/frontend/architecture/naming.md +43 -0
- package/packs/knowledge/frontend/architecture/project-structure.md +48 -0
- package/packs/knowledge/frontend/architecture/routing.md +45 -0
- package/packs/knowledge/frontend/architecture/security.md +44 -0
- package/packs/knowledge/frontend/architecture/typescript.md +44 -0
- package/packs/knowledge/frontend/components/composition.md +45 -0
- package/packs/knowledge/frontend/components/data-display.md +47 -0
- package/packs/knowledge/frontend/components/library-choice.md +45 -0
- package/packs/knowledge/frontend/components/variants.md +44 -0
- package/packs/knowledge/frontend/forms/form-architecture.md +49 -0
- package/packs/knowledge/frontend/forms/multi-step.md +43 -0
- package/packs/knowledge/frontend/forms/validation.md +47 -0
- package/packs/knowledge/frontend/layout/responsive.md +41 -0
- package/packs/knowledge/frontend/page-blueprints/app-shell.md +16 -0
- package/packs/knowledge/frontend/page-blueprints/faq-footer.md +22 -0
- package/packs/knowledge/frontend/page-blueprints/feature-grid.md +22 -0
- package/packs/knowledge/frontend/page-blueprints/pricing.md +16 -0
- package/packs/knowledge/frontend/page-blueprints/saas-hero.md +24 -0
- package/packs/knowledge/frontend/patterns/dark-marketing.md +18 -0
- package/packs/knowledge/frontend/patterns/status-pill.md +19 -0
- package/packs/knowledge/frontend/performance/code-splitting.md +47 -0
- package/packs/knowledge/frontend/performance/images-and-vitals.md +44 -0
- package/packs/knowledge/frontend/performance/rendering.md +40 -0
- package/packs/knowledge/frontend/rendering/server-and-client.md +50 -0
- package/packs/knowledge/frontend/state/api-layer.md +49 -0
- package/packs/knowledge/frontend/state/async-ui-states.md +43 -0
- package/packs/knowledge/frontend/state/client-store.md +46 -0
- package/packs/knowledge/frontend/state/server-cache.md +42 -0
- package/packs/knowledge/frontend/state/state-categories.md +50 -0
- package/packs/knowledge/frontend/testing/component-tests.md +44 -0
- package/packs/knowledge/frontend/testing/strategy.md +46 -0
- package/packs/knowledge/inbox/README.md +14 -0
- package/packs/knowledge/workflows/authentication.md +18 -0
- package/packs/knowledge/workflows/crud.md +20 -0
- package/packs/knowledge/workflows/dashboard.md +22 -0
- package/packs/nextjs-fullstack/backend/api-conventions.md +48 -0
- package/packs/nextjs-fullstack/backend/auth-and-roles.md +46 -0
- package/packs/nextjs-fullstack/backend/background-jobs.md +46 -0
- package/packs/nextjs-fullstack/backend/caching.md +46 -0
- package/packs/nextjs-fullstack/backend/database.md +46 -0
- package/packs/nextjs-fullstack/backend/file-uploads.md +46 -0
- package/packs/nextjs-fullstack/backend/logging.md +46 -0
- package/packs/nextjs-fullstack/backend/migrations.md +46 -0
- package/packs/nextjs-fullstack/backend/rate-limiting.md +46 -0
- package/packs/nextjs-fullstack/backend/secrets-and-env.md +46 -0
- package/packs/nextjs-fullstack/backend/validation.md +46 -0
- package/packs/nextjs-fullstack/blueprints/ai-app.md +84 -0
- package/packs/nextjs-fullstack/blueprints/internal-tool.md +83 -0
- package/packs/nextjs-fullstack/blueprints/saas-app.md +83 -0
- package/packs/nextjs-fullstack/build-deploy/ci.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/deploy.md +46 -0
- package/packs/nextjs-fullstack/build-deploy/monitoring.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/performance.md +46 -0
- package/packs/nextjs-fullstack/build-deploy/project-structure.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/release-checklist.md +47 -0
- package/packs/nextjs-fullstack/build-deploy/testing.md +46 -0
- package/packs/nextjs-fullstack/evals/README.md +46 -0
- package/packs/nextjs-fullstack/examples/golden-app/README.md +45 -0
- package/packs/nextjs-fullstack/frontend/accessibility.md +46 -0
- package/packs/nextjs-fullstack/frontend/components.md +46 -0
- package/packs/nextjs-fullstack/frontend/copy.md +46 -0
- package/packs/nextjs-fullstack/frontend/data-fetching.md +46 -0
- package/packs/nextjs-fullstack/frontend/forms.md +46 -0
- package/packs/nextjs-fullstack/frontend/layout.md +46 -0
- package/packs/nextjs-fullstack/frontend/loading-empty-error.md +46 -0
- package/packs/nextjs-fullstack/frontend/motion.md +46 -0
- package/packs/nextjs-fullstack/frontend/responsive.md +46 -0
- package/packs/nextjs-fullstack/frontend/seo.md +47 -0
- package/packs/nextjs-fullstack/frontend/tables.md +46 -0
- package/packs/nextjs-fullstack/frontend/tokens.md +45 -0
- package/packs/nextjs-fullstack/integrations/analytics.md +46 -0
- package/packs/nextjs-fullstack/integrations/email.md +46 -0
- package/packs/nextjs-fullstack/integrations/llm-apis.md +46 -0
- package/packs/nextjs-fullstack/integrations/oauth.md +46 -0
- package/packs/nextjs-fullstack/integrations/object-storage.md +46 -0
- package/packs/nextjs-fullstack/integrations/payments.md +46 -0
- package/packs/nextjs-fullstack/integrations/queues.md +46 -0
- package/packs/nextjs-fullstack/integrations/search.md +46 -0
- package/packs/nextjs-fullstack/integrations/webhooks.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-ai-feature.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-auth.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-billing.md +50 -0
- package/packs/nextjs-fullstack/playbooks/add-crud.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-email.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-file-upload.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-webhook.md +46 -0
- package/packs/nextjs-fullstack/playbooks/ship-to-prod.md +47 -0
- package/plugins/connore/.claude-plugin/plugin.json +10 -0
- package/plugins/connore/hooks/hooks.json +16 -0
- package/plugins/connore/skills/connore-backend/SKILL.md +32 -0
- package/plugins/connore/skills/connore-handoff/SKILL.md +15 -0
- package/plugins/connore/skills/connore-routes/SKILL.md +16 -0
- package/plugins/connore/skills/connore-validate/SKILL.md +15 -0
- package/src/cli.js +377 -90
- package/src/commands/add.js +61 -57
- package/src/commands/catalog.js +21 -0
- package/src/commands/doctor.js +44 -0
- package/src/commands/edit.js +88 -0
- package/src/commands/graph.js +20 -0
- package/src/commands/handoff.js +45 -0
- package/src/commands/hook.js +67 -50
- package/src/commands/init.js +74 -55
- package/src/commands/learn.js +39 -0
- package/src/commands/lint.js +13 -0
- package/src/commands/list.js +10 -10
- package/src/commands/log.js +49 -0
- package/src/commands/memory.js +14 -0
- package/src/commands/packs.js +21 -0
- package/src/commands/plan.js +41 -0
- package/src/commands/reindex.js +8 -8
- package/src/commands/review.js +31 -0
- package/src/commands/routes.js +13 -0
- package/src/commands/search.js +26 -0
- package/src/commands/stats.js +35 -0
- package/src/commands/undo.js +7 -0
- package/src/commands/update.js +20 -14
- package/src/lib/catalog.js +32 -0
- package/src/lib/config.js +67 -0
- package/src/lib/fs-safe.js +36 -11
- package/src/lib/gitlog.js +75 -0
- package/src/lib/graph.js +96 -0
- package/src/lib/ignore.js +47 -0
- package/src/lib/index.js +88 -57
- package/src/lib/lessons.js +173 -0
- package/src/lib/lint.js +185 -0
- package/src/lib/lock.js +47 -0
- package/src/lib/memory.js +49 -0
- package/src/lib/mutate.js +26 -0
- package/src/lib/packs.js +25 -0
- package/src/lib/paths.js +6 -2
- package/src/lib/plan.js +156 -0
- package/src/lib/pointers.js +3 -3
- package/src/lib/prompts.js +66 -0
- package/src/lib/provider.js +27 -0
- package/src/lib/report.js +41 -17
- package/src/lib/routes.js +59 -0
- package/src/lib/run.js +116 -0
- package/src/lib/search.js +64 -0
- package/src/lib/secrets.js +25 -0
- package/src/lib/signals.js +55 -0
- package/src/lib/sync.js +20 -12
- package/src/lib/tokens.js +8 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: FAQ and footer
|
|
3
|
+
type: blueprint
|
|
4
|
+
tags: [faq, footer]
|
|
5
|
+
updated: 2026-11-19
|
|
6
|
+
description: Closing sections for the solid-accent and ruled reference sets.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# FAQ and footer
|
|
11
|
+
|
|
12
|
+
## FAQ
|
|
13
|
+
|
|
14
|
+
Spec: `faq-split-accordion.md`. Left column is the `[ FAQ ]` label and headline. Right column is six collapsed rows, question left, plus right. Do not open a row unless the user asks.
|
|
15
|
+
|
|
16
|
+
## Footer
|
|
17
|
+
|
|
18
|
+
Solid-accent set (`footer-two-column.md`): brand and socials on the left, two link columns on the right.
|
|
19
|
+
|
|
20
|
+
Ruled set (`footer-four-column.md`): brand cell, then four columns with small-caps labels. Hairline rules, not cards.
|
|
21
|
+
|
|
22
|
+
Closing CTA sits above the footer. The solid-accent set centers a filled button (`cta-centered.md`). The ruled set uses two bracket buttons beside an image (`cta-split-media.md`).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Feature grid
|
|
3
|
+
type: blueprint
|
|
4
|
+
tags: [features, cards, grid, steps]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Benefit cards, the feature split, and the ruled step grid.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Feature grid
|
|
11
|
+
|
|
12
|
+
## Benefit cards
|
|
13
|
+
|
|
14
|
+
Spec: `benefit-card-grid.md`. Label `[ BENEFITS ]`. 3 columns, 2 rows. Each card: one line icon, one title, two gray lines. Same padding in every cell. No buttons inside the cards.
|
|
15
|
+
|
|
16
|
+
## Feature split
|
|
17
|
+
|
|
18
|
+
Spec: `feature-split-checklist.md`. Line tabs, then a 50/50 card: checklist on the left, a product mock on the right. One filled button under the checklist.
|
|
19
|
+
|
|
20
|
+
## Ruled steps
|
|
21
|
+
|
|
22
|
+
Spec: `steps-ruled-grid.md`. A ruled 2×2 grid, not floating cards. Three numbered cells and one image cell. Numbers are 01, 02, 03.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Pricing
|
|
3
|
+
type: blueprint
|
|
4
|
+
tags: [pricing, cards, landing]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Three-column pricing row from the solid-accent reference set.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Pricing
|
|
11
|
+
|
|
12
|
+
Spec: `design/references/pricing-three-card.md`.
|
|
13
|
+
|
|
14
|
+
Section label `[ PRICING ]` in the accent green, then a two-line headline (second line gray). A monthly/yearly switch sits left, with a small "20% OFF" outline pill.
|
|
15
|
+
|
|
16
|
+
Three equal cards. Each has name, price, one sentence, one action, a Features label, and check rows. Only the middle card gets a "Popular" pill and a filled button. The other actions are text links. Do not fill all three buttons.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SaaS hero
|
|
3
|
+
type: blueprint
|
|
4
|
+
tags: [hero, landing, accent, outline]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: How to build the two hero layouts in the reference set.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# SaaS hero
|
|
11
|
+
|
|
12
|
+
Read `design/references/hero-accent-curtain.md` or `hero-split-media.md` before drawing.
|
|
13
|
+
|
|
14
|
+
## Accent curtain
|
|
15
|
+
|
|
16
|
+
Left copy, right accent curtain. Order: wordmark header, two-line headline, one sentence, one filled button (`#06e27a`), then a console card. Header links stay text. One filled button in the header, one in the hero.
|
|
17
|
+
|
|
18
|
+
## Split media
|
|
19
|
+
|
|
20
|
+
Two columns split by a vertical rule. Left: three tiny meta pills, one headline, one gray sentence (`#707070`), two corner-bracket buttons. Right: one image. No filled accent button.
|
|
21
|
+
|
|
22
|
+
## Shared
|
|
23
|
+
|
|
24
|
+
Page field `#080808`. Headline near white. Do not mix the two button styles on one hero.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dark marketing
|
|
3
|
+
type: pattern
|
|
4
|
+
tags: [landing, color, type]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Section order for the two dark landing profiles. Load only after match.md picks one.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Dark marketing
|
|
11
|
+
|
|
12
|
+
Load only after `design/aesthetics/match.md` picks `solid-accent.md` or `ruled-outline.md`. Page field and accent come from that profile, not from this file.
|
|
13
|
+
|
|
14
|
+
Sections stack in this order in the solid-accent set: hero, logos, features, use cases, benefits, pricing, FAQ, CTA, footer. In the ruled set: hero, logos, what it does, how it works, CTA, footer. Skip a section rather than inventing one.
|
|
15
|
+
|
|
16
|
+
Header is sticky: wordmark, text links, one action. Content width is wide. Exact max-width: TODO.
|
|
17
|
+
|
|
18
|
+
Labels are either `[ WORD ]` in green (solid-accent set) or a green square plus a short phrase (ruled set).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Status pill
|
|
3
|
+
type: pattern
|
|
4
|
+
tags: [badge, status]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Small status labels as they appear in the reference layouts.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Status pill
|
|
11
|
+
|
|
12
|
+
Use a pill for a live state, not for a section title.
|
|
13
|
+
|
|
14
|
+
- Console log header: a running state in green text on a dark green chip.
|
|
15
|
+
- Pricing: an emphasis pill in green, on the middle card only.
|
|
16
|
+
- Dashboard repo card: a green dot plus a one-word index state.
|
|
17
|
+
- Hero meta row: dark chips with a green dot and a short compliance word.
|
|
18
|
+
|
|
19
|
+
Code equivalent: `components/ui-primitives/badge.md`, variant outline or a custom class. Do not invent a second green. Use the accent already chosen for that screen.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Code splitting
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [performance, code-splitting, lazy, bundle, routes]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when deciding what to lazy-load or why the bundle is large.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Code splitting
|
|
11
|
+
|
|
12
|
+
Split the production bundle so a visitor downloads the code for the page they opened, not the whole app.
|
|
13
|
+
|
|
14
|
+
## Where to split
|
|
15
|
+
|
|
16
|
+
- At the route level first. This is the highest-value boundary and usually the only one needed.
|
|
17
|
+
- Around a heavy component that most sessions never open: a chart library, a rich text editor, a map.
|
|
18
|
+
- Behind an interaction, such as a dialog whose body is only built when opened.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- Do not split everything. Each chunk is a request, and many small chunks are slower than a few right-sized ones.
|
|
23
|
+
- Give every lazy boundary a fallback that holds the layout, so the page does not jump when the chunk lands.
|
|
24
|
+
- Keep shared dependencies out of the split so two routes do not each ship their own copy.
|
|
25
|
+
- Prefetch the next likely chunk on hover or intent rather than on click.
|
|
26
|
+
|
|
27
|
+
## When to avoid
|
|
28
|
+
|
|
29
|
+
Do not split a component that is on the first screen. Deferring something the user sees immediately makes the page slower, not faster.
|
|
30
|
+
|
|
31
|
+
## Verifying
|
|
32
|
+
|
|
33
|
+
Check the built bundle, not the source. A lazy import that is also imported statically somewhere else collapses back into the main chunk, and nothing in the code shows it.
|
|
34
|
+
|
|
35
|
+
## Common mistakes
|
|
36
|
+
|
|
37
|
+
- Splitting the component that renders above the fold.
|
|
38
|
+
- Lazy routes with no fallback, so navigation flashes an empty page.
|
|
39
|
+
- Assuming the split worked because the `import()` is there.
|
|
40
|
+
|
|
41
|
+
## Related
|
|
42
|
+
|
|
43
|
+
`frontend/performance/images-and-vitals.md` for what the user actually measures.
|
|
44
|
+
|
|
45
|
+
## Source
|
|
46
|
+
|
|
47
|
+
Bulletproof React `docs/performance.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Images and web vitals
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [performance, images, web-vitals, lcp, loading]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when adding images or checking a page against performance metrics.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Images and web vitals
|
|
11
|
+
|
|
12
|
+
Images are usually the largest thing on a page, so they decide the headline metric.
|
|
13
|
+
|
|
14
|
+
## Images
|
|
15
|
+
|
|
16
|
+
- Lazy-load anything below the fold. Load the hero image eagerly; lazy-loading it delays the metric it defines.
|
|
17
|
+
- Serve a modern format such as WebP.
|
|
18
|
+
- Provide `srcset` so the browser picks the right file for the screen instead of downloading the desktop asset on a phone.
|
|
19
|
+
- Always set width and height, or an aspect ratio. Without them the page reflows when the image arrives.
|
|
20
|
+
- Give every meaningful image real alt text, and an empty `alt` when it is decoration.
|
|
21
|
+
|
|
22
|
+
## Vitals
|
|
23
|
+
|
|
24
|
+
Core Web Vitals affect how a page is indexed, so they are worth watching:
|
|
25
|
+
|
|
26
|
+
- Largest Contentful Paint, how long until the main content appears. Usually the hero image or headline.
|
|
27
|
+
- Interaction to Next Paint, how quickly the page responds to input.
|
|
28
|
+
- Cumulative Layout Shift, how much the content moves while loading.
|
|
29
|
+
|
|
30
|
+
Measure with Lighthouse or PageSpeed Insights.
|
|
31
|
+
|
|
32
|
+
## Honest note
|
|
33
|
+
|
|
34
|
+
No measurement has been taken for this project. These are the metrics to check, not results. Record real numbers when a page is measured, rather than asserting a score.
|
|
35
|
+
|
|
36
|
+
## Common mistakes
|
|
37
|
+
|
|
38
|
+
- Lazy-loading the hero, which delays Largest Contentful Paint.
|
|
39
|
+
- A sized container whose image has no dimensions, so the shift is simply moved.
|
|
40
|
+
- Treating a local Lighthouse run as a field measurement; it reflects your machine and network.
|
|
41
|
+
|
|
42
|
+
## Source
|
|
43
|
+
|
|
44
|
+
Bulletproof React `docs/performance.md`, MIT, and the web.dev performance overview, which is a navigation page rather than detailed guidance. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Render performance
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [performance, rendering, state, react, context]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when a view re-renders too often or feels slow to type in.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Render performance
|
|
11
|
+
|
|
12
|
+
Most render problems are state placement problems. Fix where state lives before reaching for memo.
|
|
13
|
+
|
|
14
|
+
## Always
|
|
15
|
+
|
|
16
|
+
1. Keep state as close as possible to where it is read. A value held three levels above its only consumer re-renders everything between.
|
|
17
|
+
2. Split a large store into several stores by usage. One object that everything subscribes to re-renders the tree on any change.
|
|
18
|
+
3. Pass isolated subtrees as `children`, so a parent's state change cannot re-render them.
|
|
19
|
+
4. Use the lazy initialiser form when the initial value is expensive: `useState(() => expensive())` runs once, while `useState(expensive())` runs on every render.
|
|
20
|
+
5. Measure before and after. A profiler run is the evidence; a hunch is not.
|
|
21
|
+
|
|
22
|
+
## Context
|
|
23
|
+
|
|
24
|
+
Context suits low-frequency data: theme, locale, the signed-in user. Every consumer re-renders when the value changes, so it is a poor fit for values that change on each keystroke or frame. For those, use a store with selectors, or `use-context-selector`.
|
|
25
|
+
|
|
26
|
+
Before adding context at all, consider lifting state up or recomposing the components. Context is often used to avoid prop drilling when composition would solve it.
|
|
27
|
+
|
|
28
|
+
## Styling
|
|
29
|
+
|
|
30
|
+
Runtime styling libraries generate styles during render. On a view that updates frequently, moving to a build-time approach such as Tailwind, CSS modules or vanilla-extract removes that work from the render path.
|
|
31
|
+
|
|
32
|
+
## Common mistakes
|
|
33
|
+
|
|
34
|
+
- Wrapping components in memo while the offending state stays at the top of the tree.
|
|
35
|
+
- A context value rebuilt inline on each render, so every consumer updates regardless of memo.
|
|
36
|
+
- Tracking many items in one state object when atomic updates were needed.
|
|
37
|
+
|
|
38
|
+
## Source
|
|
39
|
+
|
|
40
|
+
Bulletproof React `docs/performance.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Server and client components
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [nextjs, server-components, use-client, rendering]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when choosing where a Next.js App Router component runs.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Server and client components
|
|
11
|
+
|
|
12
|
+
Next.js App Router only. Nothing here applies to a React SPA or the Pages Router.
|
|
13
|
+
|
|
14
|
+
Components are server components by default. `'use client'` marks the boundary where client code starts, and everything imported below it becomes client code too.
|
|
15
|
+
|
|
16
|
+
## Use a client component when you need
|
|
17
|
+
|
|
18
|
+
- State and event handlers, such as `onClick` or `onChange`.
|
|
19
|
+
- Lifecycle effects, such as `useEffect`.
|
|
20
|
+
- Browser-only APIs: `localStorage`, `window`, `navigator`.
|
|
21
|
+
- Custom hooks that rely on any of the above.
|
|
22
|
+
|
|
23
|
+
## Use a server component when you need
|
|
24
|
+
|
|
25
|
+
- To fetch data close to the source, from a database or API.
|
|
26
|
+
- To use API keys and tokens without exposing them to the browser.
|
|
27
|
+
- To send less JavaScript to the client.
|
|
28
|
+
- To improve First Contentful Paint and stream content progressively.
|
|
29
|
+
|
|
30
|
+
## Rules
|
|
31
|
+
|
|
32
|
+
- Push `'use client'` as far down the tree as it will go. Marking a layout client-side pulls the whole page with it.
|
|
33
|
+
- Fetch in the server component and pass the result as props to the interactive child.
|
|
34
|
+
- Keep props passed across the boundary serialisable. Functions and class instances do not cross.
|
|
35
|
+
- Error boundaries must be client components.
|
|
36
|
+
- Server components require a zero-runtime styling solution. See `frontend/components/library-choice.md`.
|
|
37
|
+
|
|
38
|
+
## Common mistakes
|
|
39
|
+
|
|
40
|
+
- A `'use client'` at the top of a page because one button needs a handler.
|
|
41
|
+
- Reading a secret in a component that is, or later becomes, client-side.
|
|
42
|
+
- Fetching in a client child with an effect when the parent could have fetched on the server.
|
|
43
|
+
|
|
44
|
+
## Version note
|
|
45
|
+
|
|
46
|
+
Describes the App Router as documented in the Next.js docs snapshot in the raw set, dated 2026-05-13 in its own frontmatter. Confirm against the installed version.
|
|
47
|
+
|
|
48
|
+
## Source
|
|
49
|
+
|
|
50
|
+
Next.js documentation, "When to use Server and Client Components?". Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API layer
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [api, data-fetching, types, architecture]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load before writing a fetch call or adding a request to a feature.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# API layer
|
|
11
|
+
|
|
12
|
+
One configured client, and request declarations that are defined once and exported.
|
|
13
|
+
|
|
14
|
+
## The client
|
|
15
|
+
|
|
16
|
+
Create a single pre-configured instance and reuse it everywhere: base URL, credentials, default headers, and one place to handle auth and errors. The native `fetch`, axios, `graphql-request` or Apollo all work. Put it in `lib/api-client`.
|
|
17
|
+
|
|
18
|
+
## A request declaration
|
|
19
|
+
|
|
20
|
+
Each request is declared next to the feature that owns it, in `features/<name>/api/`, and has three parts:
|
|
21
|
+
|
|
22
|
+
1. Types and a validation schema for the request and the response.
|
|
23
|
+
2. A fetcher function that calls one endpoint through the shared client.
|
|
24
|
+
3. A hook that wraps the fetcher with the data-fetching library, so caching lives in one place.
|
|
25
|
+
|
|
26
|
+
Infer response types from the schema and pass them down, so a shape change surfaces at compile time rather than in the UI.
|
|
27
|
+
|
|
28
|
+
## When
|
|
29
|
+
|
|
30
|
+
Use for every endpoint the app calls, including one-off requests. The cost of declaring it is one file.
|
|
31
|
+
|
|
32
|
+
## Never
|
|
33
|
+
|
|
34
|
+
1. Never build a request inline inside a component.
|
|
35
|
+
2. Never create a second client instance with its own headers.
|
|
36
|
+
3. Never return `any` from a fetcher. The types stop being load-bearing.
|
|
37
|
+
|
|
38
|
+
## Common mistakes
|
|
39
|
+
|
|
40
|
+
- Declaring the fetcher but calling it directly, so each caller invents its own caching.
|
|
41
|
+
- Putting every request in a shared `api/` folder when only one feature uses it. Share only what is shared.
|
|
42
|
+
|
|
43
|
+
## Related
|
|
44
|
+
|
|
45
|
+
`frontend/state/server-cache.md` for keys, invalidation and mutations. `backend/api/conventions.md` for the response shape this project returns.
|
|
46
|
+
|
|
47
|
+
## Source
|
|
48
|
+
|
|
49
|
+
Bulletproof React `docs/api-layer.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Loading, error and empty states
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [state, loading, errors, empty, ux]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when rendering anything that depends on a request.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Loading, error and empty states
|
|
11
|
+
|
|
12
|
+
Every screen that reads server data has four states, not one. Build all four or the screen is unfinished.
|
|
13
|
+
|
|
14
|
+
1. **Loading** the request is in flight.
|
|
15
|
+
2. **Error** the request failed.
|
|
16
|
+
3. **Empty** the request succeeded and returned nothing.
|
|
17
|
+
4. **Loaded** there is data to show.
|
|
18
|
+
|
|
19
|
+
## Always
|
|
20
|
+
|
|
21
|
+
1. Render the empty state as a deliberate design, with a sentence and usually one action. It is a normal result, not a bug.
|
|
22
|
+
2. Distinguish first load from a background refetch. A spinner over existing data loses the user's place.
|
|
23
|
+
3. Give the error state a retry, and say what failed in plain language.
|
|
24
|
+
4. Reserve the layout space the loaded state will need, so content does not jump when it arrives.
|
|
25
|
+
|
|
26
|
+
## Never
|
|
27
|
+
|
|
28
|
+
1. Never show an empty table with no explanation and call it done.
|
|
29
|
+
2. Never treat an error as empty. "No results" when the request failed is a lie the user cannot act on.
|
|
30
|
+
3. Never block a whole page on one slow panel when the rest of the data has arrived.
|
|
31
|
+
|
|
32
|
+
## Skeletons
|
|
33
|
+
|
|
34
|
+
Use a skeleton when you know the shape of what is coming. Use a spinner when you do not. A skeleton that does not match the final layout is worse than a spinner.
|
|
35
|
+
|
|
36
|
+
## Common mistakes
|
|
37
|
+
|
|
38
|
+
- Checking only `isLoading`, so the error path renders the loaded branch with undefined data.
|
|
39
|
+
- An empty state that appears for a frame before data arrives, because loading was not checked first.
|
|
40
|
+
|
|
41
|
+
## Source
|
|
42
|
+
|
|
43
|
+
Bulletproof React `docs/state-management.md` and `docs/error-handling.md`, MIT, plus the rules in `design/rules.md`. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Client store
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [state, store, selectors, client-state]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when a dedicated client store holds application state.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Client store
|
|
11
|
+
|
|
12
|
+
Library-specific. Only load this if Zustand is already a dependency. The rules in `frontend/state/state-categories.md` decide whether global state is the right answer at all.
|
|
13
|
+
|
|
14
|
+
## API surface
|
|
15
|
+
|
|
16
|
+
- `create` makes a store bound to React through a hook.
|
|
17
|
+
- `createStore` makes a standalone store with no React dependency, for logic that must run outside components.
|
|
18
|
+
- `useStore` reads from a standalone store inside a component.
|
|
19
|
+
- `createWithEqualityFn` and `useStoreWithEqualityFn` take a custom equality function.
|
|
20
|
+
- `shallow` compares objects and arrays one level deep.
|
|
21
|
+
- `useShallow` wraps a selector so a derived object keeps a stable reference.
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- Select the narrowest slice a component needs. Subscribing to the whole store re-renders on every change.
|
|
26
|
+
- When a selector returns a new object or array, wrap it in `useShallow`, or the new reference re-renders on every update.
|
|
27
|
+
- Keep server data out of the store. See `frontend/state/server-cache.md`.
|
|
28
|
+
- Split unrelated concerns into separate stores instead of nesting them in one.
|
|
29
|
+
|
|
30
|
+
## Middleware
|
|
31
|
+
|
|
32
|
+
- `persist` saves and rehydrates state through `localStorage` or a custom storage engine. Never persist tokens or anything from a vault.
|
|
33
|
+
- `devtools` connects a store to Redux DevTools. Keep it out of production builds.
|
|
34
|
+
|
|
35
|
+
## Common mistakes
|
|
36
|
+
|
|
37
|
+
- Returning an inline object from a selector with no shallow comparison, which causes a render loop in effect-heavy trees.
|
|
38
|
+
- Persisting the entire store, including transient flags, so a refresh restores an open modal.
|
|
39
|
+
|
|
40
|
+
## Version note
|
|
41
|
+
|
|
42
|
+
The source is a reference index with no version recorded. Check the installed major version before relying on these names.
|
|
43
|
+
|
|
44
|
+
## Source
|
|
45
|
+
|
|
46
|
+
Zustand reference index. Links were not fetched. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Server cache and mutations
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [server-state, caching, mutations, tanstack-query]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when fetching, caching, mutating or invalidating server data.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Server cache and mutations
|
|
11
|
+
|
|
12
|
+
Library-specific: this describes TanStack Query. SWR, RTK Query and urql solve the same problem with different names, so do not quote these APIs in a project that uses one of those.
|
|
13
|
+
|
|
14
|
+
## Queries
|
|
15
|
+
|
|
16
|
+
- Give every query a key that fully describes what it fetches, including the parameters. Two different results must never share a key.
|
|
17
|
+
- Treat the cache as shared state. Any component asking for the same key gets the same data.
|
|
18
|
+
- Prefetch with `queryClient.prefetchQuery` when the next page is predictable, such as on hover or after the current step. This removes the fetch wait on navigation.
|
|
19
|
+
|
|
20
|
+
## Mutations
|
|
21
|
+
|
|
22
|
+
- A mutation changes server data; it does not own UI state.
|
|
23
|
+
- After it succeeds, invalidate the keys whose data is now wrong. Invalidate the narrowest key that covers the change, not the whole cache.
|
|
24
|
+
- Decide deliberately whether to invalidate, write the response into the cache, or do both. Writing avoids a refetch but can leave stale related data.
|
|
25
|
+
|
|
26
|
+
## When to avoid
|
|
27
|
+
|
|
28
|
+
Do not use a server cache library for values that never come from the server. Theme, a selected tab and an open dialog belong in component or application state.
|
|
29
|
+
|
|
30
|
+
## Common mistakes
|
|
31
|
+
|
|
32
|
+
- Copying fetched data into a global store, so there are two sources of truth and one goes stale.
|
|
33
|
+
- Keys built from an object whose property order varies, which silently creates two cache entries.
|
|
34
|
+
- Invalidating everything after each mutation, which turns one write into a wave of refetches.
|
|
35
|
+
|
|
36
|
+
## Version note
|
|
37
|
+
|
|
38
|
+
The raw source names `@tanstack/react-query` and the `prefetchQuery` method but records no version. Confirm the installed major version before relying on any other API name.
|
|
39
|
+
|
|
40
|
+
## Source
|
|
41
|
+
|
|
42
|
+
Bulletproof React `docs/state-management.md` and `docs/performance.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: State categories
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [state, react, architecture, server-state]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load before adding state, to pick the right kind and the right place.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# State categories
|
|
11
|
+
|
|
12
|
+
Four kinds of state. Keep them separate. Most state bugs come from storing one kind in another kind's container.
|
|
13
|
+
|
|
14
|
+
## Component state
|
|
15
|
+
|
|
16
|
+
Lives in one component and its children. Start here for every piece of state.
|
|
17
|
+
|
|
18
|
+
- `useState` for independent values.
|
|
19
|
+
- `useReducer` when one action has to update several values together.
|
|
20
|
+
|
|
21
|
+
Lift it only when another part of the tree needs it.
|
|
22
|
+
|
|
23
|
+
## Application state
|
|
24
|
+
|
|
25
|
+
Global UI concerns: theme, open modal, notification queue. Keep it as close to its consumers as possible.
|
|
26
|
+
|
|
27
|
+
Options: React context with hooks, Zustand, Jotai, Redux Toolkit, MobX, XState. Context suits low-frequency data such as theme or user. For frequently changing values, use a store with selectors.
|
|
28
|
+
|
|
29
|
+
## Server cache state
|
|
30
|
+
|
|
31
|
+
Data fetched from an API and kept on the client for reuse. This is a cache, not application state. Use a library built for it: TanStack Query, SWR, RTK Query, Apollo or urql.
|
|
32
|
+
|
|
33
|
+
## Form state
|
|
34
|
+
|
|
35
|
+
Field values, dirty and touched flags, validation errors, submission status. Use a form library rather than a global store. See `frontend/forms/form-architecture.md`.
|
|
36
|
+
|
|
37
|
+
## Always
|
|
38
|
+
|
|
39
|
+
1. Keep server state out of the global store.
|
|
40
|
+
2. Keep transient UI state out of the server cache.
|
|
41
|
+
3. Default to local state and promote only on evidence.
|
|
42
|
+
|
|
43
|
+
## Never
|
|
44
|
+
|
|
45
|
+
1. Never put every value in one global store, which re-renders half the tree on each change.
|
|
46
|
+
2. Never globalise state at the start "in case" it is needed.
|
|
47
|
+
|
|
48
|
+
## Source
|
|
49
|
+
|
|
50
|
+
Bulletproof React `docs/state-management.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Component tests
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [testing, components, queries, accessibility]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when writing a test that renders a component.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Component tests
|
|
11
|
+
|
|
12
|
+
Test the component the way a user meets it. Assert on what renders, not on how it got there.
|
|
13
|
+
|
|
14
|
+
## Always
|
|
15
|
+
|
|
16
|
+
1. Query the way a user would find the element: by role and accessible name first, then label text, then visible text. Reach for a test id only when nothing else identifies it.
|
|
17
|
+
2. Drive the component with real interactions, typing and clicking, rather than calling handlers directly.
|
|
18
|
+
3. Await anything asynchronous. A missing await produces a test that passes locally and fails in CI.
|
|
19
|
+
4. Assert one behaviour per test, with a name that states it.
|
|
20
|
+
5. Cover the error and empty paths, not only the happy one. See `frontend/state/async-ui-states.md`.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
|
|
24
|
+
1. Never assert on internal state, a hook's return value, or render counts. Refactoring the state library should not break a single test.
|
|
25
|
+
2. Never snapshot a whole component as the only assertion. A diff that nobody reads is not a test.
|
|
26
|
+
3. Never share mutable state between tests. Each test sets up and tears down its own.
|
|
27
|
+
|
|
28
|
+
## A useful side effect
|
|
29
|
+
|
|
30
|
+
Role-based queries only work when the markup is accessible. A test that cannot find a button by its role is telling you the control is a `div`, or the icon button has no name. Treat that failure as a real finding, not as a reason to switch to a test id. See `frontend/accessibility/semantics-and-keyboard.md`.
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
Render through a helper that wraps the component in the providers it needs: router, query client, theme. Repeating that in every test guarantees they drift apart.
|
|
35
|
+
|
|
36
|
+
## Common mistakes
|
|
37
|
+
|
|
38
|
+
- Testing a presentational component through the container that fetches for it, which makes the test about the request.
|
|
39
|
+
- A query that matches two elements, passing until a second button appears.
|
|
40
|
+
- Asserting a loading spinner disappeared without asserting what replaced it.
|
|
41
|
+
|
|
42
|
+
## Source
|
|
43
|
+
|
|
44
|
+
Bulletproof React `docs/testing.md`, MIT, and the Testing Library philosophy of testing user-visible output. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Testing strategy
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [testing, integration, e2e, tooling]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load before writing tests, to pick the right kind for what you are checking.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Testing strategy
|
|
11
|
+
|
|
12
|
+
Confidence comes mostly from integration tests. Unit tests check that a part works; they cannot tell you the parts are wired together correctly.
|
|
13
|
+
|
|
14
|
+
## Three kinds
|
|
15
|
+
|
|
16
|
+
**Unit tests** cover the smallest pieces in isolation: shared components, utilities, and genuinely complex logic inside one component. Fast to write, fast to run, narrow in what they prove.
|
|
17
|
+
|
|
18
|
+
**Integration tests** cover several parts working together, and this is where most effort belongs. They catch the failures that matter: the request fires with the wrong argument, the form submits but the list never refreshes.
|
|
19
|
+
|
|
20
|
+
**End-to-end tests** drive the whole application, frontend and backend, the way a user would. Expensive, so keep them to the few flows that must never break: sign-in, checkout, the core action.
|
|
21
|
+
|
|
22
|
+
## Tooling
|
|
23
|
+
|
|
24
|
+
- Vitest as the runner.
|
|
25
|
+
- Testing Library for rendering and queries.
|
|
26
|
+
- Playwright for end-to-end, in headed mode locally and headless in CI.
|
|
27
|
+
- Mock Service Worker to intercept HTTP and return defined responses.
|
|
28
|
+
|
|
29
|
+
## Mocking the API
|
|
30
|
+
|
|
31
|
+
Intercepting requests at the network layer beats mocking `fetch`. The application makes real HTTP calls and the handlers answer them, so the code under test is the code that ships. It also unblocks frontend work when an endpoint does not exist yet, without hard-coding response data in components.
|
|
32
|
+
|
|
33
|
+
## What not to test
|
|
34
|
+
|
|
35
|
+
- Implementation details: internal state values, whether a particular hook ran, how many renders happened.
|
|
36
|
+
- Third-party library behaviour. Test your use of it, not it.
|
|
37
|
+
- Styling, beyond what the user can perceive, such as a disabled control.
|
|
38
|
+
|
|
39
|
+
## Common mistakes
|
|
40
|
+
|
|
41
|
+
- A wall of unit tests on a fully passing suite that still ships a broken feature, because nothing tested the join.
|
|
42
|
+
- End-to-end tests for every edge case, until the suite is too slow to run and gets skipped.
|
|
43
|
+
|
|
44
|
+
## Source
|
|
45
|
+
|
|
46
|
+
Bulletproof React `docs/testing.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inbox
|
|
3
|
+
type: process
|
|
4
|
+
tags: [inbox]
|
|
5
|
+
updated: 2026-11-19
|
|
6
|
+
description: Drop raw screenshots, components, and notes here, then ask an agent to process the inbox.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Inbox
|
|
11
|
+
|
|
12
|
+
Drop files here. Leave them untouched until you say `Process the .ctx/inbox`.
|
|
13
|
+
|
|
14
|
+
The agent follows `PROCESS.md`: it classifies each file, writes a short markdown note, files the result in the matching folder, and updates `INDEX.md`.
|