claude-code-superkit 0.0.0-stage → 1.5.3
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/LICENSE +21 -0
- package/README.md +374 -2
- package/bin/cli.js +153 -0
- package/bin/inject-tokens.js +224 -0
- package/bin/measure-tokens.js +17 -0
- package/bin/superkit-counts-verify.sh +30 -0
- package/lib/codex.js +246 -0
- package/lib/docs-scaffold.js +147 -0
- package/lib/installer.js +499 -0
- package/lib/prompts.js +51 -0
- package/lib/settings-builder.js +51 -0
- package/lib/superpowers.js +99 -0
- package/lib/utils.js +117 -0
- package/lib/validator.js +84 -0
- package/package.json +49 -4
- package/packages/codex/AGENTS.md +396 -0
- package/packages/codex/INSTALL.md +342 -0
- package/packages/codex/config.toml +22 -0
- package/packages/codex/hooks/superkit.mjs +203 -0
- package/packages/codex/hooks.json +30 -0
- package/packages/codex/legacy-baseline.json +88 -0
- package/packages/codex/native-skills.txt +65 -0
- package/packages/codex/rules/default.rules +565 -0
- package/packages/codex/skills/ai-slop-cleaner/SKILL.md +44 -0
- package/packages/codex/skills/api-contract-sync/SKILL.md +96 -0
- package/packages/codex/skills/architect/SKILL.md +49 -0
- package/packages/codex/skills/audit-backend/SKILL.md +80 -0
- package/packages/codex/skills/audit-frontend/SKILL.md +82 -0
- package/packages/codex/skills/audit-infra/SKILL.md +87 -0
- package/packages/codex/skills/audit-orchestrator/SKILL.md +114 -0
- package/packages/codex/skills/behavioral-nudge-engine/SKILL.md +110 -0
- package/packages/codex/skills/benchmark/SKILL.md +49 -0
- package/packages/codex/skills/bot-reviewer/SKILL.md +94 -0
- package/packages/codex/skills/code-reviewer/SKILL.md +67 -0
- package/packages/codex/skills/codebase-onboarding-engineer/SKILL.md +46 -0
- package/packages/codex/skills/comment-rot-analyzer/SKILL.md +75 -0
- package/packages/codex/skills/commit-helper/SKILL.md +101 -0
- package/packages/codex/skills/critic/SKILL.md +56 -0
- package/packages/codex/skills/database-reviewer/SKILL.md +79 -0
- package/packages/codex/skills/debug-observer/SKILL.md +107 -0
- package/packages/codex/skills/dependency-checker/SKILL.md +69 -0
- package/packages/codex/skills/design-system-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/dev-orchestrator/SKILL.md +304 -0
- package/packages/codex/skills/docs-reviewer/SKILL.md +86 -0
- package/packages/codex/skills/drizzle-orm-expert/SKILL.md +246 -0
- package/packages/codex/skills/e2e-test-generator/SKILL.md +95 -0
- package/packages/codex/skills/evaluator/SKILL.md +63 -0
- package/packages/codex/skills/frontend-perf-reviewer/SKILL.md +95 -0
- package/packages/codex/skills/frontend-ui-color-reviewer/SKILL.md +68 -0
- package/packages/codex/skills/frontend-ui-design-critic/SKILL.md +99 -0
- package/packages/codex/skills/frontend-ui-interaction-reviewer/SKILL.md +102 -0
- package/packages/codex/skills/frontend-ui-motion-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/frontend-ui-reviewer/SKILL.md +81 -0
- package/packages/codex/skills/frontend-ui-typography-reviewer/SKILL.md +62 -0
- package/packages/codex/skills/gltf-debugging/SKILL.md +128 -0
- package/packages/codex/skills/go-benchmark/SKILL.md +217 -0
- package/packages/codex/skills/go-concurrency-reviewer/SKILL.md +113 -0
- package/packages/codex/skills/go-error-reviewer/SKILL.md +107 -0
- package/packages/codex/skills/go-grpc-patterns/SKILL.md +285 -0
- package/packages/codex/skills/go-modernizer/SKILL.md +111 -0
- package/packages/codex/skills/go-observability-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/go-performance-reviewer/SKILL.md +112 -0
- package/packages/codex/skills/go-reviewer/SKILL.md +109 -0
- package/packages/codex/skills/go-samber-do/SKILL.md +158 -0
- package/packages/codex/skills/go-samber-lo/SKILL.md +178 -0
- package/packages/codex/skills/go-samber-oops/SKILL.md +174 -0
- package/packages/codex/skills/goal-verifier/SKILL.md +53 -0
- package/packages/codex/skills/health-checker/SKILL.md +109 -0
- package/packages/codex/skills/html-to-3d-texture/SKILL.md +153 -0
- package/packages/codex/skills/impeccable-craft/SKILL.md +101 -0
- package/packages/codex/skills/lint-runner/SKILL.md +85 -0
- package/packages/codex/skills/migrate/SKILL.md +60 -0
- package/packages/codex/skills/migration-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/minimal-change-engineer/SKILL.md +44 -0
- package/packages/codex/skills/new-migration/SKILL.md +59 -0
- package/packages/codex/skills/nextjs-supabase-auth/SKILL.md +227 -0
- package/packages/codex/skills/output-enforcement/SKILL.md +71 -0
- package/packages/codex/skills/plan-checker/SKILL.md +53 -0
- package/packages/codex/skills/postgresql-optimization/SKILL.md +159 -0
- package/packages/codex/skills/pre-deploy-validator/SKILL.md +111 -0
- package/packages/codex/skills/presentation-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/product-3d-lighting/SKILL.md +137 -0
- package/packages/codex/skills/project-architecture/SKILL.md +52 -0
- package/packages/codex/skills/py-reviewer/SKILL.md +100 -0
- package/packages/codex/skills/r3f-scene-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/r3f-scroll-driven-3d/SKILL.md +162 -0
- package/packages/codex/skills/reality-checker/SKILL.md +61 -0
- package/packages/codex/skills/redis-patterns/SKILL.md +260 -0
- package/packages/codex/skills/review-orchestrator/SKILL.md +151 -0
- package/packages/codex/skills/rs-reviewer/SKILL.md +98 -0
- package/packages/codex/skills/ru-text/SKILL.md +132 -0
- package/packages/codex/skills/scaffold-endpoint/SKILL.md +44 -0
- package/packages/codex/skills/security-scanner/SKILL.md +94 -0
- package/packages/codex/skills/silent-failure-hunter/SKILL.md +176 -0
- package/packages/codex/skills/telegram-bot-builder/SKILL.md +120 -0
- package/packages/codex/skills/test-generator/SKILL.md +79 -0
- package/packages/codex/skills/test-runner/SKILL.md +101 -0
- package/packages/codex/skills/threejs-color-management/SKILL.md +97 -0
- package/packages/codex/skills/tree-generator/SKILL.md +63 -0
- package/packages/codex/skills/ts-reviewer/SKILL.md +90 -0
- package/packages/codex/skills/ui-design-reviewer/SKILL.md +89 -0
- package/packages/codex/skills/ui-reviewer/SKILL.md +103 -0
- package/packages/codex/skills/visual-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/writing-agents/SKILL.md +165 -0
- package/packages/codex/skills/writing-commands/SKILL.md +173 -0
- package/packages/core/CLAUDE.md +118 -0
- package/packages/core/INTERNAL-FILES +16 -0
- package/packages/core/agents/ai-slop-cleaner.md +187 -0
- package/packages/core/agents/api-contract-sync.md +127 -0
- package/packages/core/agents/architect.md +205 -0
- package/packages/core/agents/audit-backend.md +137 -0
- package/packages/core/agents/audit-frontend.md +129 -0
- package/packages/core/agents/audit-infra.md +182 -0
- package/packages/core/agents/behavioral-nudge-engine.md +170 -0
- package/packages/core/agents/code-reviewer.md +195 -0
- package/packages/core/agents/codebase-onboarding-engineer.md +172 -0
- package/packages/core/agents/comment-rot-analyzer.md +115 -0
- package/packages/core/agents/critic.md +172 -0
- package/packages/core/agents/database-reviewer.md +201 -0
- package/packages/core/agents/debug-observer.md +261 -0
- package/packages/core/agents/dependency-checker.md +199 -0
- package/packages/core/agents/docs-reviewer.md +206 -0
- package/packages/core/agents/e2e-test-generator.md +261 -0
- package/packages/core/agents/evaluator.md +141 -0
- package/packages/core/agents/goal-verifier.md +130 -0
- package/packages/core/agents/health-checker.md +194 -0
- package/packages/core/agents/migration-reviewer.md +161 -0
- package/packages/core/agents/minimal-change-engineer.md +219 -0
- package/packages/core/agents/plan-checker.md +139 -0
- package/packages/core/agents/pre-deploy-validator.md +189 -0
- package/packages/core/agents/reality-checker.md +175 -0
- package/packages/core/agents/scaffold-endpoint.md +162 -0
- package/packages/core/agents/security-scanner.md +236 -0
- package/packages/core/agents/silent-failure-hunter.md +276 -0
- package/packages/core/agents/test-generator.md +146 -0
- package/packages/core/agents/tree-generator.md +141 -0
- package/packages/core/agents/ui-reviewer.md +172 -0
- package/packages/core/agents/visual-reviewer.md +211 -0
- package/packages/core/commands/audit.md +166 -0
- package/packages/core/commands/benchmark.md +130 -0
- package/packages/core/commands/commit.md +148 -0
- package/packages/core/commands/dev.md +302 -0
- package/packages/core/commands/docs-init.md +75 -0
- package/packages/core/commands/lint.md +137 -0
- package/packages/core/commands/migrate.md +146 -0
- package/packages/core/commands/new-migration.md +182 -0
- package/packages/core/commands/pair.md +209 -0
- package/packages/core/commands/review.md +195 -0
- package/packages/core/commands/security-scan.md +142 -0
- package/packages/core/commands/superkit-evolve.md +231 -0
- package/packages/core/commands/superkit-init.md +274 -0
- package/packages/core/commands/test.md +108 -0
- package/packages/core/commands/workflow.md +150 -0
- package/packages/core/docs/guide/01-getting-started.md +41 -0
- package/packages/core/docs-templates/README.md +33 -0
- package/packages/core/docs-templates/adr-template.md +62 -0
- package/packages/core/docs-templates/architecture/api-contracts.md +26 -0
- package/packages/core/docs-templates/architecture/api-reference.md +48 -0
- package/packages/core/docs-templates/architecture/auth-and-sessions.md +38 -0
- package/packages/core/docs-templates/architecture/backend-layers.md +42 -0
- package/packages/core/docs-templates/architecture/data-flow.md +26 -0
- package/packages/core/docs-templates/architecture/database-schema.md +51 -0
- package/packages/core/docs-templates/architecture/deployment.md +41 -0
- package/packages/core/docs-templates/architecture/frontend-state.md +46 -0
- package/packages/core/helpers/statusline.cjs +370 -0
- package/packages/core/hooks/CHAIN-SEMANTICS.md +84 -0
- package/packages/core/hooks/audit-settings-source.sh +98 -0
- package/packages/core/hooks/audit-trail.sh +120 -0
- package/packages/core/hooks/block-dangerous-git.sh +189 -0
- package/packages/core/hooks/bundle-import-check.sh +64 -0
- package/packages/core/hooks/compact-state-inject.sh +84 -0
- package/packages/core/hooks/config-protection.sh +68 -0
- package/packages/core/hooks/console-log-warning.sh +28 -0
- package/packages/core/hooks/context-monitor.sh +35 -0
- package/packages/core/hooks/dev-edit-counter.sh +59 -0
- package/packages/core/hooks/dev-marker-set.sh +55 -0
- package/packages/core/hooks/dev-required-on-commit.sh +426 -0
- package/packages/core/hooks/doc-check-on-commit.sh +396 -0
- package/packages/core/hooks/edit-streak-check.sh +63 -0
- package/packages/core/hooks/evolve-check.sh +78 -0
- package/packages/core/hooks/gateguard-pre-edit.sh +154 -0
- package/packages/core/hooks/gateguard-record-facts.sh +37 -0
- package/packages/core/hooks/intake-classifier.py +449 -0
- package/packages/core/hooks/lib/profile.sh +141 -0
- package/packages/core/hooks/loop-guard.sh +75 -0
- package/packages/core/hooks/migration-safety.sh +56 -0
- package/packages/core/hooks/plan-completion-gate.sh +61 -0
- package/packages/core/hooks/pre-compact-save.sh +89 -0
- package/packages/core/hooks/security-patterns.sh +119 -0
- package/packages/core/hooks/session-context-restore.sh +76 -0
- package/packages/core/hooks/subagent-stop-validate.sh +73 -0
- package/packages/core/hooks/superkit-counts-verify.sh +346 -0
- package/packages/core/hooks/superkit-update.sh +367 -0
- package/packages/core/hooks/tests/README.md +42 -0
- package/packages/core/hooks/tests/audit-trail-chain_test.sh +62 -0
- package/packages/core/hooks/tests/block-dangerous-git_test.sh +144 -0
- package/packages/core/hooks/tests/chain-semantics/h1.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/h2.sh +9 -0
- package/packages/core/hooks/tests/chain-semantics/h3.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/run-experiment.sh +65 -0
- package/packages/core/hooks/tests/chain-semantics/settings-experiment.json +15 -0
- package/packages/core/hooks/tests/counts-verify_test.sh +118 -0
- package/packages/core/hooks/tests/dev-required-on-commit_test.sh +207 -0
- package/packages/core/hooks/tests/dev-required-wip-on-main_test.sh +20 -0
- package/packages/core/hooks/tests/doc-check-on-commit_test.sh +122 -0
- package/packages/core/hooks/tests/edit-streak-check_test.sh +106 -0
- package/packages/core/hooks/tests/internal-manifest_test.sh +130 -0
- package/packages/core/hooks/tests/json-path_test.sh +108 -0
- package/packages/core/hooks/tests/mirror-invariants_test.sh +139 -0
- package/packages/core/hooks/tests/nudge-throttle_test.sh +95 -0
- package/packages/core/hooks/tests/profile-helper_test.sh +21 -0
- package/packages/core/hooks/tests/run-all.sh +47 -0
- package/packages/core/hooks/tests/session-key-helper_test.sh +17 -0
- package/packages/core/hooks/tests/superkit-update_test.sh +311 -0
- package/packages/core/hooks/tests/warn-visibility_test.sh +59 -0
- package/packages/core/hooks/user-intent-detect.sh +44 -0
- package/packages/core/hooks/verify-hooks.sh +69 -0
- package/packages/core/rules/auto-commands.md +124 -0
- package/packages/core/rules/coding-style.md +68 -0
- package/packages/core/rules/dev-workflow.md +77 -0
- package/packages/core/rules/documentation.md +106 -0
- package/packages/core/rules/frontend-aesthetics.md +53 -0
- package/packages/core/rules/git-workflow.md +14 -0
- package/packages/core/rules/security.md +29 -0
- package/packages/core/rules/superkit-integrity.md +114 -0
- package/packages/core/settings.json +229 -0
- package/packages/core/skills/drizzle-orm-expert/SKILL.md +260 -0
- package/packages/core/skills/nextjs-supabase-auth/SKILL.md +259 -0
- package/packages/core/skills/postgresql-optimization/SKILL.md +150 -0
- package/packages/core/skills/project-architecture/SKILL.md +31 -0
- package/packages/core/skills/project-scanner/SKILL.md +132 -0
- package/packages/core/skills/redis-patterns/SKILL.md +261 -0
- package/packages/core/skills/ru-text/SKILL.md +156 -0
- package/packages/core/skills/telegram-bot-builder/SKILL.md +145 -0
- package/packages/core/skills/writing-agents/SKILL.md +220 -0
- package/packages/core/skills/writing-commands/SKILL.md +176 -0
- package/packages/core/skills/writing-hooks/SKILL.md +335 -0
- package/packages/extras/bot-reviewer.md +279 -0
- package/packages/extras/design-system-reviewer.md +234 -0
- package/packages/extras/red-blue-auditor/README.md +117 -0
- package/packages/extras/red-blue-auditor/agent.md +128 -0
- package/packages/extras/red-blue-auditor/patterns/agent-config.txt +4 -0
- package/packages/extras/red-blue-auditor/patterns/hook-injection.txt +8 -0
- package/packages/extras/red-blue-auditor/patterns/mcp-risk.txt +5 -0
- package/packages/extras/red-blue-auditor/patterns/permission-abuse.txt +6 -0
- package/packages/extras/red-blue-auditor/patterns/secrets.txt +17 -0
- package/packages/extras/red-blue-auditor/scan.sh +88 -0
- package/packages/extras/skillsmp-search/SKILL.md +134 -0
- package/packages/frontend-3d/README.md +62 -0
- package/packages/frontend-3d/agents/frontend-perf-reviewer.md +164 -0
- package/packages/frontend-3d/agents/presentation-reviewer.md +146 -0
- package/packages/frontend-3d/agents/r3f-scene-reviewer.md +128 -0
- package/packages/frontend-3d/agents/ui-design-reviewer.md +169 -0
- package/packages/frontend-3d/commands/capture-screen.md +166 -0
- package/packages/frontend-3d/hooks/bundle-size-warn.sh +93 -0
- package/packages/frontend-3d/hooks/gsap-pattern-check.sh +74 -0
- package/packages/frontend-3d/hooks/r3f-color-check.sh +76 -0
- package/packages/frontend-3d/hooks/tailwind-version-guard.sh +98 -0
- package/packages/frontend-3d/rules/frontend-aesthetics-3d.md +81 -0
- package/packages/frontend-3d/rules/gsap-conventions.md +129 -0
- package/packages/frontend-3d/rules/threejs-conventions.md +116 -0
- package/packages/frontend-3d/skills/gltf-debugging/SKILL.md +145 -0
- package/packages/frontend-3d/skills/html-to-3d-texture/SKILL.md +183 -0
- package/packages/frontend-3d/skills/output-enforcement/SKILL.md +79 -0
- package/packages/frontend-3d/skills/product-3d-lighting/SKILL.md +166 -0
- package/packages/frontend-3d/skills/r3f-scroll-driven-3d/SKILL.md +209 -0
- package/packages/frontend-3d/skills/threejs-color-management/SKILL.md +111 -0
- package/packages/frontend-ui/NOTICE.md +99 -0
- package/packages/frontend-ui/README.md +59 -0
- package/packages/frontend-ui/agents/ui-color-reviewer.md +174 -0
- package/packages/frontend-ui/agents/ui-design-critic.md +198 -0
- package/packages/frontend-ui/agents/ui-interaction-reviewer.md +259 -0
- package/packages/frontend-ui/agents/ui-motion-reviewer.md +266 -0
- package/packages/frontend-ui/agents/ui-reviewer.md +251 -0
- package/packages/frontend-ui/agents/ui-typography-reviewer.md +222 -0
- package/packages/frontend-ui/hooks/tests/ui-animation-easing-check_test.sh +78 -0
- package/packages/frontend-ui/hooks/tests/ui-banned-fonts-check_test.sh +77 -0
- package/packages/frontend-ui/hooks/tests/ui-color-check_test.sh +75 -0
- package/packages/frontend-ui/hooks/ui-animation-easing-check.sh +86 -0
- package/packages/frontend-ui/hooks/ui-banned-fonts-check.sh +90 -0
- package/packages/frontend-ui/hooks/ui-color-check.sh +102 -0
- package/packages/frontend-ui/rules/color-and-contrast.md +230 -0
- package/packages/frontend-ui/rules/frontend-design-aesthetics.md +124 -0
- package/packages/frontend-ui/rules/interaction-polish.md +335 -0
- package/packages/frontend-ui/rules/motion-and-animation.md +283 -0
- package/packages/frontend-ui/rules/spatial-and-layout.md +212 -0
- package/packages/frontend-ui/rules/typography-guidelines.md +185 -0
- package/packages/frontend-ui/rules/ui-anti-patterns.md +309 -0
- package/packages/frontend-ui/settings.json +24 -0
- package/packages/frontend-ui/skills/impeccable-craft/SKILL.md +187 -0
- package/packages/gan/README.md +232 -0
- package/packages/gan/agents/gan-evaluator.md +214 -0
- package/packages/gan/agents/gan-generator.md +171 -0
- package/packages/gan/agents/gan-planner.md +206 -0
- package/packages/gan/rubrics/functionality.md +66 -0
- package/packages/gan/rubrics/ui-quality.md +77 -0
- package/packages/gan/skills/gan-evaluator/SKILL.md +91 -0
- package/packages/gan/skills/gan-generator/SKILL.md +72 -0
- package/packages/gan/skills/gan-planner/SKILL.md +93 -0
- package/packages/stack-agents/go/go-concurrency-reviewer.md +210 -0
- package/packages/stack-agents/go/go-error-reviewer.md +187 -0
- package/packages/stack-agents/go/go-modernizer.md +160 -0
- package/packages/stack-agents/go/go-observability-reviewer.md +185 -0
- package/packages/stack-agents/go/go-performance-reviewer.md +160 -0
- package/packages/stack-agents/go/go-reviewer.md +277 -0
- package/packages/stack-agents/go/references/benchmark-methodology.md +280 -0
- package/packages/stack-agents/go/references/channel-patterns.md +384 -0
- package/packages/stack-agents/go/references/cli-cobra-viper.md +190 -0
- package/packages/stack-agents/go/references/code-style.md +262 -0
- package/packages/stack-agents/go/references/context-propagation.md +317 -0
- package/packages/stack-agents/go/references/data-structures.md +315 -0
- package/packages/stack-agents/go/references/database-patterns.md +334 -0
- package/packages/stack-agents/go/references/design-patterns.md +411 -0
- package/packages/stack-agents/go/references/di-frameworks.md +146 -0
- package/packages/stack-agents/go/references/error-creation.md +251 -0
- package/packages/stack-agents/go/references/error-inspection.md +348 -0
- package/packages/stack-agents/go/references/error-wrapping.md +230 -0
- package/packages/stack-agents/go/references/gopls-driving.md +62 -0
- package/packages/stack-agents/go/references/goroutine-lifecycle.md +351 -0
- package/packages/stack-agents/go/references/graphql-patterns.md +221 -0
- package/packages/stack-agents/go/references/grpc-patterns.md +373 -0
- package/packages/stack-agents/go/references/modernize-guide.md +522 -0
- package/packages/stack-agents/go/references/module-management.md +191 -0
- package/packages/stack-agents/go/references/naming-conventions.md +176 -0
- package/packages/stack-agents/go/references/observability-pipeline.md +352 -0
- package/packages/stack-agents/go/references/performance-profiling.md +250 -0
- package/packages/stack-agents/go/references/refactoring-mechanics.md +127 -0
- package/packages/stack-agents/go/references/rest-openapi-patterns.md +160 -0
- package/packages/stack-agents/go/references/samber-do.md +201 -0
- package/packages/stack-agents/go/references/samber-libraries.md +363 -0
- package/packages/stack-agents/go/references/samber-lo.md +260 -0
- package/packages/stack-agents/go/references/samber-oops.md +200 -0
- package/packages/stack-agents/go/references/security-checklist.md +441 -0
- package/packages/stack-agents/go/references/standard-stdlib-now.md +181 -0
- package/packages/stack-agents/go/references/stay-updated.md +147 -0
- package/packages/stack-agents/go/references/structs-interfaces.md +312 -0
- package/packages/stack-agents/go/references/sync-primitives.md +395 -0
- package/packages/stack-agents/go/references/testing-patterns.md +483 -0
- package/packages/stack-agents/go/references/troubleshooting.md +98 -0
- package/packages/stack-agents/python/py-reviewer.md +194 -0
- package/packages/stack-agents/rust/rs-reviewer.md +188 -0
- package/packages/stack-agents/typescript/ts-reviewer.md +135 -0
- package/packages/stack-hooks/go/go-context-check-on-edit.sh +56 -0
- package/packages/stack-hooks/go/go-error-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-format-on-edit.sh +32 -0
- package/packages/stack-hooks/go/go-safety-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-vet-on-edit.sh +61 -0
- package/packages/stack-hooks/go/golangci-lint-on-edit.sh +54 -0
- package/packages/stack-hooks/python/ruff-on-edit.sh +67 -0
- package/packages/stack-hooks/rust/cargo-check-on-edit.sh +64 -0
- package/packages/stack-hooks/typescript/typecheck-on-edit.sh +76 -0
- package/packages/stack-rules/go/go-conventions.md +44 -0
- package/packages/stack-rules/go/go-safety.md +35 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: motion-and-animation
|
|
3
|
+
description: "UI motion rules — the 4-question animation framework, easing curves, duration tables, springs, reduced motion. Auto-loaded when editing UI files."
|
|
4
|
+
tokens: 2655
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
applyWhenPaths:
|
|
7
|
+
- "**/*.tsx"
|
|
8
|
+
- "**/*.jsx"
|
|
9
|
+
- "**/*.ts"
|
|
10
|
+
- "**/*.css"
|
|
11
|
+
- "**/*.scss"
|
|
12
|
+
- "**/*.html"
|
|
13
|
+
- "**/*.vue"
|
|
14
|
+
- "**/tailwind.config.*"
|
|
15
|
+
- "**/*.tokens.*"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Motion & Animation
|
|
19
|
+
|
|
20
|
+
Correct motion in aggregate is why an interface feels "right"; animation
|
|
21
|
+
for its own sake is worse than none.
|
|
22
|
+
|
|
23
|
+
## Hard rules
|
|
24
|
+
|
|
25
|
+
1. Ask the 4 questions below, in order, before writing any animation.
|
|
26
|
+
2. **Scope:** this rule governs 2D UI element transitions.
|
|
27
|
+
3D/scroll-scrub contexts are governed by gsap-conventions
|
|
28
|
+
(frontend-3d package), which allows `power2.in` for viewport-exit
|
|
29
|
+
animations.
|
|
30
|
+
3. Easing in 2D UI: `ease-out` for enter/exit, `ease-in-out` for
|
|
31
|
+
on-screen morphing, `linear` for constant motion. No `ease-in` in
|
|
32
|
+
this scope (3D exception in rule 2).
|
|
33
|
+
4. Keep UI animations under 300ms unless genuinely explanatory.
|
|
34
|
+
5. Animate `transform` and `opacity` by default; never animate layout
|
|
35
|
+
properties (`width`, `height`, `top`, `left`, `margin`). Name exact
|
|
36
|
+
properties — never `transition: all`.
|
|
37
|
+
6. Honor `prefers-reduced-motion` (blocks below); skipping it is an
|
|
38
|
+
accessibility bug.
|
|
39
|
+
7. Bounce/elastic: none in standard UI transitions; a subtle bounce
|
|
40
|
+
(0.1–0.3) is allowed only for drag-release and playful gestures.
|
|
41
|
+
|
|
42
|
+
## The 4-question framework (ask in order, before writing any animation)
|
|
43
|
+
|
|
44
|
+
### Question 1 — Should this animate at all?
|
|
45
|
+
|
|
46
|
+
Decide by frequency of exposure:
|
|
47
|
+
|
|
48
|
+
| User exposure | Default |
|
|
49
|
+
|---------------|---------|
|
|
50
|
+
| 100+ times per day (keyboard shortcuts, command palette toggle, every list navigation) | **No animation.** |
|
|
51
|
+
| Tens of times per day (hover effects, tab switches, simple toggles) | Remove or drastically reduce — aim for ≤100ms or none. |
|
|
52
|
+
| Occasional (modals, drawers, toasts, navigating between sections) | Standard animation — the meat of UI motion. |
|
|
53
|
+
| Rare or first-time (onboarding, celebratory moments, form submission success) | Can be expressive and expansive. |
|
|
54
|
+
|
|
55
|
+
**Keyboard-initiated actions get no animation** (<kbd>⌘K</kbd> palette
|
|
56
|
+
open, shortcut navigation): power users trigger them hundreds of times
|
|
57
|
+
daily, and animation delays the exact moment they are trying to be
|
|
58
|
+
fast. Raycast's command palette opens with no animation by design.
|
|
59
|
+
|
|
60
|
+
An animation a user sees 50 times today has to earn its keep — if you
|
|
61
|
+
cannot state its purpose (Question 2), remove it.
|
|
62
|
+
|
|
63
|
+
### Question 2 — What is the purpose?
|
|
64
|
+
|
|
65
|
+
Every animation must answer "why does this animate?" with one of these
|
|
66
|
+
five purposes:
|
|
67
|
+
|
|
68
|
+
1. **Spatial consistency.** A toast slides in from the right; when the
|
|
69
|
+
user swipes it away to the right, they intuit where it went because
|
|
70
|
+
it entered from there. Entry direction = exit direction.
|
|
71
|
+
2. **State indication.** A button morphs shape to signal the state
|
|
72
|
+
change (idle → loading → success). Without motion, the state change
|
|
73
|
+
feels invisible.
|
|
74
|
+
3. **Explanation.** A marketing animation that demonstrates a feature's
|
|
75
|
+
workflow in 3 seconds.
|
|
76
|
+
4. **Feedback.** A button scales 0.97 on `:active`, confirming the
|
|
77
|
+
interface registered the press before the action completes.
|
|
78
|
+
5. **Preventing jarring change.** An element suddenly appearing or
|
|
79
|
+
disappearing without transition reads as a bug. Fade + slight
|
|
80
|
+
scale-from-0.95 avoids that.
|
|
81
|
+
|
|
82
|
+
If the answer is "it looks cool" and the user sees it often, remove the
|
|
83
|
+
animation.
|
|
84
|
+
|
|
85
|
+
### Question 3 — What easing should it use?
|
|
86
|
+
|
|
87
|
+
Decision flow:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Is the element entering or exiting the screen?
|
|
91
|
+
Yes → ease-out (starts fast; feels responsive; user sees immediate motion)
|
|
92
|
+
|
|
93
|
+
No →
|
|
94
|
+
Is it moving or morphing on-screen (not entering/exiting)?
|
|
95
|
+
Yes → ease-in-out (natural accel/decel; movement feels organic)
|
|
96
|
+
|
|
97
|
+
Is it a hover, color change, or opacity-only transition?
|
|
98
|
+
Yes → ease (gentle; the default cubic is fine here)
|
|
99
|
+
|
|
100
|
+
Is it constant motion (marquee, progress bar, spinner)?
|
|
101
|
+
Yes → linear
|
|
102
|
+
|
|
103
|
+
Default fallback → ease-out
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Entries and exits both use `ease-out` in 2D UI.** `ease-out` starts
|
|
107
|
+
fast, so the user sees immediate motion; `ease-in` starts slow, so a
|
|
108
|
+
300ms dropdown with `ease-in` feels more sluggish than the identical
|
|
109
|
+
dropdown with `ease-out`. Do not use `ease-in` for 2D UI element
|
|
110
|
+
transitions. 3D/scroll-scrub contexts are governed by gsap-conventions
|
|
111
|
+
(frontend-3d package), which allows `power2.in` for viewport-exit
|
|
112
|
+
animations — that exception never applies to the UI transitions covered
|
|
113
|
+
here.
|
|
114
|
+
|
|
115
|
+
#### Custom curves (stronger than the CSS defaults)
|
|
116
|
+
|
|
117
|
+
CSS's built-in `ease-out` / `ease-in-out` are too weak to feel
|
|
118
|
+
intentional. Use these four custom `cubic-bezier()` curves by default —
|
|
119
|
+
curves built from scratch are almost never better:
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
:root {
|
|
123
|
+
/* Strong ease-out for UI element entry */
|
|
124
|
+
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
125
|
+
|
|
126
|
+
/* Strong ease-in-out for on-screen morphing/moving */
|
|
127
|
+
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
|
|
128
|
+
|
|
129
|
+
/* iOS-style drawer curve */
|
|
130
|
+
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
|
|
131
|
+
|
|
132
|
+
/* Snappy / responsive — for tiny UI transitions (hovers, buttons) */
|
|
133
|
+
--ease-snappy: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Question 4 — How long should it take?
|
|
138
|
+
|
|
139
|
+
| Element | Duration |
|
|
140
|
+
|---------|----------|
|
|
141
|
+
| Button press feedback (`:active` scale) | 100–160ms |
|
|
142
|
+
| Tooltip / small popover open | 125–200ms |
|
|
143
|
+
| Dropdown / select open | 150–250ms |
|
|
144
|
+
| Tab / section transition | 180–300ms |
|
|
145
|
+
| Modal / drawer open-close | 200–500ms |
|
|
146
|
+
| Toast slide in-out | 200–350ms |
|
|
147
|
+
| Page transition (SPA) | 300–500ms |
|
|
148
|
+
| Marketing explainer / onboarding demo | Can be 500–2000ms+ |
|
|
149
|
+
|
|
150
|
+
**Keep UI animations under 300ms** unless they are genuinely
|
|
151
|
+
explanatory — a 180ms dropdown feels more responsive than a 400ms one.
|
|
152
|
+
Perceived-performance nuance: a faster-spinning spinner makes the app
|
|
153
|
+
feel faster even when actual load time is identical.
|
|
154
|
+
|
|
155
|
+
## Springs vs duration-based
|
|
156
|
+
|
|
157
|
+
Springs simulate physics — no fixed duration; they settle from
|
|
158
|
+
stiffness/damping/mass parameters. Use them for:
|
|
159
|
+
|
|
160
|
+
- **Drag-with-momentum gestures** — swipe-to-dismiss a sheet, flick a
|
|
161
|
+
card. Springs maintain velocity across release.
|
|
162
|
+
- **Decorative mouse-tracking interactions** — a subtle parallax on a
|
|
163
|
+
hero element. Binding visuals directly to mouse position (no spring)
|
|
164
|
+
feels artificial and computery; `useSpring` gives it life.
|
|
165
|
+
- **"Alive"-feeling UI elements** — Apple's Dynamic Island, responsive
|
|
166
|
+
icons that subtly settle.
|
|
167
|
+
- **Gestures interruptible mid-animation** — springs preserve velocity
|
|
168
|
+
when interrupted; CSS animations restart from zero.
|
|
169
|
+
|
|
170
|
+
Do not use springs for:
|
|
171
|
+
|
|
172
|
+
- Simple state transitions (open/close, in/out) — duration-based
|
|
173
|
+
`ease-out` is more predictable and easier to tune.
|
|
174
|
+
- Functional contexts where predictability matters more than
|
|
175
|
+
naturalness (trading interface, banking, medical).
|
|
176
|
+
|
|
177
|
+
### Spring configuration patterns
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
// Apple-style (easy to reason about):
|
|
181
|
+
{ type: "spring", duration: 0.5, bounce: 0.2 }
|
|
182
|
+
|
|
183
|
+
// Traditional physics:
|
|
184
|
+
{ type: "spring", mass: 1, stiffness: 100, damping: 10 }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Standard UI transitions use no bounce. When the interaction is a
|
|
188
|
+
drag-release or playful gesture (drag-to-dismiss, playful
|
|
189
|
+
notification), a subtle `bounce` of 0.1–0.3 is allowed — never higher.
|
|
190
|
+
|
|
191
|
+
### Mouse-tracking springs — example
|
|
192
|
+
|
|
193
|
+
```jsx
|
|
194
|
+
// Without spring — feels artificial, instant, computery
|
|
195
|
+
const rotation = mouseX * 0.1;
|
|
196
|
+
|
|
197
|
+
// With spring — feels natural, has settle
|
|
198
|
+
import { useSpring } from 'framer-motion'; // or 'motion/react'
|
|
199
|
+
const rotation = useSpring(mouseX * 0.1, {
|
|
200
|
+
stiffness: 100,
|
|
201
|
+
damping: 10,
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Reduced motion — required, not optional
|
|
206
|
+
|
|
207
|
+
```css
|
|
208
|
+
@media (prefers-reduced-motion: reduce) {
|
|
209
|
+
*, *::before, *::after {
|
|
210
|
+
animation-duration: 0.01ms !important;
|
|
211
|
+
animation-iteration-count: 1 !important;
|
|
212
|
+
transition-duration: 0.01ms !important;
|
|
213
|
+
scroll-behavior: auto !important;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This blanket rule is the safe default. For JS-driven motion, check
|
|
219
|
+
`window.matchMedia('(prefers-reduced-motion: reduce)')` and
|
|
220
|
+
short-circuit the animation. Users with vestibular disorders need this;
|
|
221
|
+
skipping it is an accessibility bug.
|
|
222
|
+
|
|
223
|
+
## Motion rules of execution
|
|
224
|
+
|
|
225
|
+
**DO:**
|
|
226
|
+
- Ask the 4 questions in order before writing any animation.
|
|
227
|
+
- Use the four custom `cubic-bezier` curves above (stronger than CSS
|
|
228
|
+
defaults).
|
|
229
|
+
- Use `ease-out` for entry/exit, `ease-in-out` for on-screen morph.
|
|
230
|
+
- Keep UI animations under 300ms by default.
|
|
231
|
+
- Specify exact properties in transitions (`transition: transform
|
|
232
|
+
200ms ease-out`).
|
|
233
|
+
- Animate `transform` and `opacity` — they're compositor-accelerated.
|
|
234
|
+
Other properties trigger layout/paint and can stutter.
|
|
235
|
+
- Use springs for drag/momentum/interruptible gestures.
|
|
236
|
+
- Honor `prefers-reduced-motion`.
|
|
237
|
+
- Scale `from 0.95` and fade for entry, not `from 0`. Nothing in the
|
|
238
|
+
real world appears from true zero size.
|
|
239
|
+
|
|
240
|
+
**DO NOT:**
|
|
241
|
+
- Animate keyboard-initiated actions (⌘K open, etc.).
|
|
242
|
+
- Use `ease-in` for 2D UI transitions (3D/scroll-scrub viewport exits
|
|
243
|
+
follow gsap-conventions, which allows `power2.in`).
|
|
244
|
+
- Use `transition: all` — name exact properties.
|
|
245
|
+
- Ship bounce/elastic in standard UI transitions — a subtle bounce
|
|
246
|
+
(0.1–0.3) is allowed only for drag-release/playful gestures.
|
|
247
|
+
- Animate for decoration alone if the user sees it 50×/day.
|
|
248
|
+
- Animate `width`, `height`, `top`, `left`, `margin` — use `transform`.
|
|
249
|
+
- Skip reduced motion.
|
|
250
|
+
- Use `scale(0)` as entry — `scale(0.95)` reads as natural.
|
|
251
|
+
- Use the same duration everywhere. Duration is a property, not a
|
|
252
|
+
constant.
|
|
253
|
+
|
|
254
|
+
## Output format for motion review
|
|
255
|
+
|
|
256
|
+
When reviewing UI motion code, output exactly this markdown table — one
|
|
257
|
+
row per issue found, the "Why" column carrying the reasoning. Bulleted
|
|
258
|
+
lists with "Before:" and "After:" on separate lines are not accepted.
|
|
259
|
+
|
|
260
|
+
```markdown
|
|
261
|
+
| Before | After | Why |
|
|
262
|
+
| --- | --- | --- |
|
|
263
|
+
| `<offending code>` | `<replacement code>` | <one-line reason> |
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Filled example:
|
|
267
|
+
|
|
268
|
+
| Before | After | Why |
|
|
269
|
+
| --- | --- | --- |
|
|
270
|
+
| `transition: all 300ms` | `transition: transform 200ms ease-out` | Specify exact properties; `all` animates layout props that cause stutter. |
|
|
271
|
+
| `transform: scale(0)` | `transform: scale(0.95); opacity: 0` | Nothing appears from true zero. |
|
|
272
|
+
| `ease-in` on dropdown | `ease-out` with `--ease-snappy` | `ease-in` delays the initial motion, making it feel sluggish. |
|
|
273
|
+
| No `:active` state on button | `transform: scale(0.97)` for 100ms | Buttons must confirm the press. |
|
|
274
|
+
| `transform-origin: center` on popover | `transform-origin: var(--radix-popover-content-transform-origin)` | Popovers should scale from their trigger point (modals stay centered). |
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
Attribution: duration tables, easing `cubic-bezier` constants, spring
|
|
279
|
+
configurations, and the 4-question framework structure are adapted from
|
|
280
|
+
Emil Kowalski's design-engineering skill (https://emilkowal.ski/skill).
|
|
281
|
+
Prose has been written independently for this package. Remaining
|
|
282
|
+
material draws from Impeccable's `reference/motion-design.md` (Apache-
|
|
283
|
+
2.0). See `../NOTICE.md`.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spatial-and-layout
|
|
3
|
+
description: "Spacing, layout, grids, responsive design — 4pt scale, rhythm over uniformity, container queries for components, viewport queries for pages. Auto-loaded when editing UI files."
|
|
4
|
+
tokens: 1717
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
applyWhenPaths:
|
|
7
|
+
- "**/*.tsx"
|
|
8
|
+
- "**/*.jsx"
|
|
9
|
+
- "**/*.ts"
|
|
10
|
+
- "**/*.css"
|
|
11
|
+
- "**/*.scss"
|
|
12
|
+
- "**/*.html"
|
|
13
|
+
- "**/*.vue"
|
|
14
|
+
- "**/tailwind.config.*"
|
|
15
|
+
- "**/*.tokens.*"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Spatial Design & Layout
|
|
19
|
+
|
|
20
|
+
## Hard rules (always apply)
|
|
21
|
+
|
|
22
|
+
1. **Use the canonical spacing scale with semantic token names.** Canonical
|
|
23
|
+
steps in px: **2, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128** — 4pt multiples
|
|
24
|
+
plus a single 2px hairline step (`--space-3xs`, for hairline gaps and icon
|
|
25
|
+
nudges). This list and the token block below are the SAME set — use no
|
|
26
|
+
spacing value outside it. Name tokens by size role (`--space-xs`,
|
|
27
|
+
`--space-md`), never by pixel value (`--spacing-8`, `--p-12`) — pixel names
|
|
28
|
+
break the moment the scale changes. 8pt-only is too coarse; 12px between
|
|
29
|
+
two values is common.
|
|
30
|
+
2. **Use `gap`, not margins, for sibling spacing** inside flex/grid
|
|
31
|
+
containers — `gap` cannot margin-collapse. Reserve margins for the outside
|
|
32
|
+
of a component.
|
|
33
|
+
3. **Vary spacing to create hierarchy.** Different relationships get
|
|
34
|
+
different values — use the mapping in "Visual rhythm" below. A heading
|
|
35
|
+
with extra space above it reads as more important.
|
|
36
|
+
4. **Self-adjusting grids over media queries for card content.**
|
|
37
|
+
`grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))` reflows
|
|
38
|
+
without breakpoints. Add media queries only when the layout must genuinely
|
|
39
|
+
rearrange, not when a grid needs to reflow.
|
|
40
|
+
5. **Container queries for components, viewport queries for pages.** A card
|
|
41
|
+
inside a sidebar reacts to the sidebar's width via `@container`; use
|
|
42
|
+
`@media` for page-level layout changes only.
|
|
43
|
+
|
|
44
|
+
## The spacing scale (canonical)
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
:root {
|
|
48
|
+
--space-3xs: 0.125rem; /* 2px */
|
|
49
|
+
--space-2xs: 0.25rem; /* 4px */
|
|
50
|
+
--space-xs: 0.5rem; /* 8px */
|
|
51
|
+
--space-sm: 0.75rem; /* 12px */
|
|
52
|
+
--space-md: 1rem; /* 16px */
|
|
53
|
+
--space-lg: 1.5rem; /* 24px */
|
|
54
|
+
--space-xl: 2rem; /* 32px */
|
|
55
|
+
--space-2xl: 3rem; /* 48px */
|
|
56
|
+
--space-3xl: 4rem; /* 64px */
|
|
57
|
+
--space-4xl: 6rem; /* 96px */
|
|
58
|
+
--space-5xl: 8rem; /* 128px */
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Fluid spacing variants for responsive marketing pages:
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
--space-section: clamp(3rem, 8vw, 8rem);
|
|
66
|
+
--space-gutter: clamp(1rem, 4vw, 3rem);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Rule of thumb: **fluid spacing for sections, fixed spacing inside
|
|
70
|
+
components.** A `Card` gets predictable `--space-md` padding; the gap between
|
|
71
|
+
one `Card` and the next can breathe with the viewport.
|
|
72
|
+
|
|
73
|
+
## Visual rhythm
|
|
74
|
+
|
|
75
|
+
Rhythm comes from VARIATION, not from uniform application of a single value.
|
|
76
|
+
Relationship → token:
|
|
77
|
+
|
|
78
|
+
- Tight groupings (related items) → `--space-xs` to `--space-sm`
|
|
79
|
+
- Heading-to-body gap (related) → `--space-sm`
|
|
80
|
+
- Body-to-next-heading gap (transitional) → `--space-xl`
|
|
81
|
+
- Section separation → `--space-xl` or `--space-2xl`
|
|
82
|
+
- Major breaks → `--space-3xl` or fluid `clamp()` values
|
|
83
|
+
|
|
84
|
+
## Grid patterns
|
|
85
|
+
|
|
86
|
+
### The breakpoint-free card grid
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
.card-grid {
|
|
90
|
+
display: grid;
|
|
91
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
92
|
+
gap: var(--space-md);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reflows from 4 columns at desktop to 1 at mobile with zero media queries.
|
|
97
|
+
Use for homogeneous card collections.
|
|
98
|
+
|
|
99
|
+
### The broken grid (for emphasis)
|
|
100
|
+
|
|
101
|
+
Intentionally break the grid for hero content, featured items, or visual
|
|
102
|
+
punctuation:
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
.feature-grid {
|
|
106
|
+
display: grid;
|
|
107
|
+
grid-template-columns: 2fr 1fr 1fr;
|
|
108
|
+
grid-auto-rows: auto;
|
|
109
|
+
gap: var(--space-lg);
|
|
110
|
+
}
|
|
111
|
+
.feature-grid > :first-child {
|
|
112
|
+
grid-row: span 2; /* The first cell takes double height */
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Uniform 3-up card grids feel templated; a 2-1-1 pattern with one spanning
|
|
117
|
+
cell feels designed.
|
|
118
|
+
|
|
119
|
+
### The asymmetric hero
|
|
120
|
+
|
|
121
|
+
Left-aligned text + asymmetric image placement reads as "designed". Centered
|
|
122
|
+
text + centered image reads as "template". Default to asymmetric unless
|
|
123
|
+
there is a specific reason not to.
|
|
124
|
+
|
|
125
|
+
## Container queries
|
|
126
|
+
|
|
127
|
+
For components that appear in multiple layouts (sidebar, main, modal):
|
|
128
|
+
|
|
129
|
+
```css
|
|
130
|
+
.card {
|
|
131
|
+
container-type: inline-size;
|
|
132
|
+
container-name: card;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@container card (min-width: 320px) {
|
|
136
|
+
.card .header { flex-direction: row; }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@container card (min-width: 480px) {
|
|
140
|
+
.card .header { font-size: var(--text-lg); }
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The card adapts to its container's width, not the viewport's: a 320px card
|
|
145
|
+
in a narrow sidebar stays stacked even on a 1920px viewport.
|
|
146
|
+
|
|
147
|
+
## Fluid vs fixed — when to choose which
|
|
148
|
+
|
|
149
|
+
| Context | Strategy |
|
|
150
|
+
|---------|----------|
|
|
151
|
+
| Marketing page sections | Fluid (`clamp()`) |
|
|
152
|
+
| App shell (header, sidebar, footer) | Fixed — predictable interactions |
|
|
153
|
+
| Card / component internals | Fixed — consistency matters |
|
|
154
|
+
| Text sizes on marketing | Fluid headings, fixed body |
|
|
155
|
+
| Text sizes in product UI | Fixed throughout (see `typography-guidelines.md`) |
|
|
156
|
+
| Column widths in dashboards | Fixed with `minmax()` and explicit breakpoints |
|
|
157
|
+
|
|
158
|
+
Rule of thumb: **fluid where the content naturally expands, fixed where
|
|
159
|
+
users expect repeatable hit targets and interaction patterns.**
|
|
160
|
+
|
|
161
|
+
## Breakpoints (when you must use media queries)
|
|
162
|
+
|
|
163
|
+
Default set — mobile-first:
|
|
164
|
+
|
|
165
|
+
```css
|
|
166
|
+
/* Default: <640px (mobile) */
|
|
167
|
+
|
|
168
|
+
@media (min-width: 640px) { /* small tablet */ }
|
|
169
|
+
@media (min-width: 768px) { /* tablet / small laptop */ }
|
|
170
|
+
@media (min-width: 1024px) { /* desktop */ }
|
|
171
|
+
@media (min-width: 1280px) { /* wide desktop */ }
|
|
172
|
+
@media (min-width: 1536px) { /* max-out */ }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Prefer **`min-width`** (mobile-first) over `max-width` (desktop-first): each
|
|
176
|
+
breakpoint adds features rather than removing them.
|
|
177
|
+
|
|
178
|
+
## Spatial rules of execution
|
|
179
|
+
|
|
180
|
+
**DO:**
|
|
181
|
+
- Use the canonical spacing scale (2px hairline + 4pt steps) with semantic
|
|
182
|
+
token names.
|
|
183
|
+
- Use `gap` for sibling spacing inside flex/grid containers.
|
|
184
|
+
- Vary spacing for hierarchy — different values between different
|
|
185
|
+
relationships.
|
|
186
|
+
- Use `repeat(auto-fit, minmax(X, 1fr))` for breakpoint-free card grids.
|
|
187
|
+
- Use container queries for component-level responsiveness.
|
|
188
|
+
- Use viewport queries for page-level layout changes only.
|
|
189
|
+
- Use fluid `clamp()` spacing on marketing page sections.
|
|
190
|
+
- Break the grid intentionally for hero or featured content.
|
|
191
|
+
- Cap body text blocks at `max-width: 65ch`–`75ch` — the same 65–75ch limit
|
|
192
|
+
as `typography-guidelines.md`.
|
|
193
|
+
|
|
194
|
+
**DO NOT:**
|
|
195
|
+
- Wrap everything in cards. Not every section needs a container.
|
|
196
|
+
- Nest cards inside cards. Visual noise; flatten.
|
|
197
|
+
- Ship the "3 identical cards with icon + heading + body" template. Use a
|
|
198
|
+
broken grid, a single hero card, or a list with visual hierarchy — do
|
|
199
|
+
something more considered.
|
|
200
|
+
- Ship the "big number / small label / stat row / gradient accent"
|
|
201
|
+
hero-metrics template. It is the default for AI dashboards. Break it.
|
|
202
|
+
- Use identical spacing between every element. Monotony — nothing is
|
|
203
|
+
emphasised when everything sits at the same weight.
|
|
204
|
+
- Center everything. Asymmetric left-aligned typically feels more designed.
|
|
205
|
+
- Use fluid typography/spacing inside dense product UI. Predictability >
|
|
206
|
+
fluidity when users repeat the same action 100× a day.
|
|
207
|
+
- Let body text run wider than 75ch (see the DO cap above).
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
Attribution: adapted from Impeccable's `reference/spatial-design.md` and
|
|
212
|
+
`reference/responsive-design.md` (Apache-2.0). See `../NOTICE.md`.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typography-guidelines
|
|
3
|
+
description: "Typography rules — modular scales, fluid sizing, pairing, line-height, tracking, font-selection procedure, and the reflex_fonts_to_reject list. Auto-loaded when editing UI files."
|
|
4
|
+
tokens: 1775
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
applyWhenPaths:
|
|
7
|
+
- "**/*.tsx"
|
|
8
|
+
- "**/*.jsx"
|
|
9
|
+
- "**/*.ts"
|
|
10
|
+
- "**/*.css"
|
|
11
|
+
- "**/*.scss"
|
|
12
|
+
- "**/*.html"
|
|
13
|
+
- "**/*.vue"
|
|
14
|
+
- "**/tailwind.config.*"
|
|
15
|
+
- "**/*.tokens.*"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Typography Guidelines
|
|
19
|
+
|
|
20
|
+
## Principles (hard rules — apply to every UI edit)
|
|
21
|
+
|
|
22
|
+
1. **Fluid type on content, fixed type in product UI.** Marketing pages
|
|
23
|
+
and long-form content: size headings with `clamp()` so they flow with
|
|
24
|
+
the viewport. App UIs, dashboards, forms, and dense tables: fixed
|
|
25
|
+
`rem` scales — no major design system uses fluid type in product UI,
|
|
26
|
+
and fluid type inside dense tables is chaos.
|
|
27
|
+
2. **Fewer sizes, more contrast.** Use a 5-step scale with a **1.25×
|
|
28
|
+
minimum ratio** between steps. Eight sizes at 1.1× apart produce a
|
|
29
|
+
flat hierarchy that reads as undesigned.
|
|
30
|
+
3. **Line-height scales inversely with line length.** Narrow columns:
|
|
31
|
+
1.2–1.35. Wide columns: 1.5–1.6. For light text on dark backgrounds,
|
|
32
|
+
**add 0.05–0.1 to your normal line-height** — light type reads as
|
|
33
|
+
lighter weight and needs more breathing room.
|
|
34
|
+
4. **Cap body line-length at 65–75ch.** Put `max-width: 65ch` (up to
|
|
35
|
+
`75ch`) on text blocks. Wider body text is fatiguing.
|
|
36
|
+
5. **Pair a distinctive display font with a refined body font.** Never
|
|
37
|
+
use a single font family for an entire page — you lose hierarchy
|
|
38
|
+
tools.
|
|
39
|
+
|
|
40
|
+
## The font-selection procedure (4 steps, in order)
|
|
41
|
+
|
|
42
|
+
This procedure exists to break one reflex: "I was told not to use
|
|
43
|
+
Inter, so I will pick my next favorite font" — which becomes the new
|
|
44
|
+
monoculture.
|
|
45
|
+
|
|
46
|
+
### Step 1 — Write the brief in 3 concrete words
|
|
47
|
+
|
|
48
|
+
Stop and write down three concrete brand-voice words. Not "modern" and
|
|
49
|
+
not "elegant" — those are dead categories that do not help you decide.
|
|
50
|
+
Concrete examples:
|
|
51
|
+
|
|
52
|
+
- "warm and mechanical and opinionated"
|
|
53
|
+
- "calm and clinical and careful"
|
|
54
|
+
- "fast and dense and unimpressed"
|
|
55
|
+
- "handmade and a little weird"
|
|
56
|
+
- "expensive and quiet and precise"
|
|
57
|
+
- "loud and angular and young"
|
|
58
|
+
|
|
59
|
+
The three words will produce mutually exclusive type choices, which is
|
|
60
|
+
the point.
|
|
61
|
+
|
|
62
|
+
### Step 2 — List your reflex picks, then reject them
|
|
63
|
+
|
|
64
|
+
Write down the 3 fonts you would normally pick given those words. Check
|
|
65
|
+
every one against the canonical `reflex_fonts_to_reject` list — it
|
|
66
|
+
lives in `ui-anti-patterns.md`, section "The reflex_fonts_to_reject
|
|
67
|
+
list" (Inter, Fraunces, Playfair and Playfair Display, Space Grotesk,
|
|
68
|
+
and all system defaults are on it; read the full list there — this file
|
|
69
|
+
deliberately does not carry a second copy). Most of what you wrote down
|
|
70
|
+
will be on it. Reject every font on that list for this project,
|
|
71
|
+
including the one you were about to pick.
|
|
72
|
+
|
|
73
|
+
### Step 3 — Pick candidates from a catalog, brief words in mind
|
|
74
|
+
|
|
75
|
+
Ordered branches — use the first one that applies:
|
|
76
|
+
|
|
77
|
+
1. **Web access available (WebFetch/WebSearch):** browse these catalogs
|
|
78
|
+
with the three words held in mind:
|
|
79
|
+
- Google Fonts (filter aggressively — avoid the top 20)
|
|
80
|
+
- Pangram Pangram
|
|
81
|
+
- Future Fonts
|
|
82
|
+
- Adobe Fonts
|
|
83
|
+
- ABC Dinamo
|
|
84
|
+
- Klim Type Foundry
|
|
85
|
+
- Velvetyne
|
|
86
|
+
- OH no Type Co
|
|
87
|
+
- Uncut
|
|
88
|
+
2. **No web access:** propose 5–8 candidates recalled from those same
|
|
89
|
+
foundries' catalogs. Verify each candidate is absent from the
|
|
90
|
+
`reflex_fonts_to_reject` list before shortlisting it.
|
|
91
|
+
3. **Project cannot load web fonts at all** (offline target, no font
|
|
92
|
+
pipeline): choose the most distinctive face already bundled with the
|
|
93
|
+
project, or compose a deliberate system-safe stack — and state
|
|
94
|
+
explicitly in your summary that the reject list was relaxed for this
|
|
95
|
+
reason only.
|
|
96
|
+
|
|
97
|
+
In every branch, look for something that fits the brand **as a physical
|
|
98
|
+
object**: a museum exhibit caption, a hand-painted shop sign, a 1970s
|
|
99
|
+
mainframe terminal manual, a fabric label sewn inside a coat, a
|
|
100
|
+
children's book printed on cheap newsprint, a laminated menu from a
|
|
101
|
+
highway diner. Reject the first thing that "looks designy" — that is
|
|
102
|
+
the trained reflex too. Keep looking.
|
|
103
|
+
|
|
104
|
+
### Step 4 — Cross-check against reflex
|
|
105
|
+
|
|
106
|
+
Check your final pick against the type of brief:
|
|
107
|
+
|
|
108
|
+
- The right font for an **"elegant"** brief is NOT necessarily a serif.
|
|
109
|
+
- The right font for a **"technical"** brief is NOT necessarily a sans.
|
|
110
|
+
- The right font for a **"warm"** brief is NOT Fraunces.
|
|
111
|
+
- The right font for a **"premium"** brief is NOT Playfair.
|
|
112
|
+
|
|
113
|
+
If your final pick lines up with the reflex pattern (warm → Fraunces,
|
|
114
|
+
technical → Space Mono, elegant → Playfair), go back to Step 3.
|
|
115
|
+
|
|
116
|
+
## Web font loading
|
|
117
|
+
|
|
118
|
+
- Use `font-display: swap` for body text, `font-display: optional` for
|
|
119
|
+
display headings that should render with the system fallback if the
|
|
120
|
+
web font is late. Never use `font-display: block`.
|
|
121
|
+
- Preload only the one or two critical faces; preloading everything
|
|
122
|
+
defeats the point.
|
|
123
|
+
- Subset aggressively. A display font used for a 3-word hero text should
|
|
124
|
+
not ship the full 5000-glyph payload.
|
|
125
|
+
- Variable fonts save one HTTP request and allow a wider range of
|
|
126
|
+
weights/widths — prefer them when available.
|
|
127
|
+
- For icon fonts: don't. Use SVG icons. Icon fonts lose accessibility
|
|
128
|
+
context and scale inconsistently at small sizes.
|
|
129
|
+
|
|
130
|
+
## OpenType features worth turning on
|
|
131
|
+
|
|
132
|
+
- `ss01`, `ss02`, … — stylistic sets. Check the type foundry's showings;
|
|
133
|
+
many fonts ship alternate character forms hidden behind these.
|
|
134
|
+
- `onum` — old-style figures for body text; `tnum` — tabular figures for
|
|
135
|
+
tables and numeric columns.
|
|
136
|
+
- `kern` — usually on by default, confirm.
|
|
137
|
+
- `liga`, `calt` — ligatures; confirm appropriate for your audience.
|
|
138
|
+
- `case` — case-sensitive forms; turn on for all-caps tracking.
|
|
139
|
+
|
|
140
|
+
Example:
|
|
141
|
+
```css
|
|
142
|
+
.body { font-feature-settings: "onum", "kern", "liga"; }
|
|
143
|
+
.table-num { font-feature-settings: "tnum", "lnum"; }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Tracking (letter-spacing)
|
|
147
|
+
|
|
148
|
+
- Display type (large headings, 40px+) often wants **slightly negative**
|
|
149
|
+
tracking (`-0.01em` to `-0.03em`). The optical default at large sizes
|
|
150
|
+
is too loose.
|
|
151
|
+
- Body type wants **0** tracking (rely on the type designer).
|
|
152
|
+
- Small caps and all-caps labels at <12px want **positive** tracking
|
|
153
|
+
(`+0.05em` to `+0.12em`) for readability.
|
|
154
|
+
- Never apply the same tracking value across the whole scale. Tracking
|
|
155
|
+
is optical and must vary with size.
|
|
156
|
+
|
|
157
|
+
## Typography rules of execution
|
|
158
|
+
|
|
159
|
+
**DO:**
|
|
160
|
+
- Vary font weights and sizes to create clear visual hierarchy.
|
|
161
|
+
- Vary font choices across projects. If your last project was a serif
|
|
162
|
+
display with sans body, look at sans display / monospace / slab for
|
|
163
|
+
the next one.
|
|
164
|
+
- Pair a distinctive display font with a refined body font.
|
|
165
|
+
|
|
166
|
+
**DO NOT:**
|
|
167
|
+
- Use any font on the canonical `reflex_fonts_to_reject` list
|
|
168
|
+
(`ui-anti-patterns.md`, section "The reflex_fonts_to_reject list") —
|
|
169
|
+
Inter, Roboto, Playfair, system defaults, all of them. Run the 4-step
|
|
170
|
+
procedure above instead.
|
|
171
|
+
- Use monospace typography as lazy shorthand for "technical/developer
|
|
172
|
+
vibes".
|
|
173
|
+
- Place large rounded-corner icons above every heading. They rarely add
|
|
174
|
+
value and make sites look templated.
|
|
175
|
+
- Use one font family for the entire page.
|
|
176
|
+
- Let the type scale collapse — step ratios below 1.25× read as flat.
|
|
177
|
+
- Set long body passages in all-caps. Reserve all-caps for short labels
|
|
178
|
+
and headings, ≤6 words.
|
|
179
|
+
- Use fluid type in product UI (forms, tables, dashboards) — Principle 1:
|
|
180
|
+
fixed `rem` scales there.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
Attribution: adapted from Impeccable's `reference/typography.md`
|
|
185
|
+
(Apache-2.0). See `../NOTICE.md`.
|