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,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-enforcement
|
|
3
|
+
description: Anti-laziness enforcement — bans placeholder patterns (// ..., // TODO, // rest of code), enforces complete code generation, handles token-limit splits cleanly. Activate for every code generation task.
|
|
4
|
+
tokens: 595
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Full Output Enforcement
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Every response contains complete, runnable code — no placeholders, no elided sections.
|
|
12
|
+
|
|
13
|
+
**Use when:** any code-generation task (new files, edits, refactors).
|
|
14
|
+
**Do not use:** prose-only responses with no code output.
|
|
15
|
+
|
|
16
|
+
## Hard Rules
|
|
17
|
+
|
|
18
|
+
1. NEVER emit a banned pattern (list below) in generated code.
|
|
19
|
+
2. Write every file complete, from first line to last.
|
|
20
|
+
3. If output must split, break ONLY at a complete function/class boundary and add a `[PAUSED …]` marker.
|
|
21
|
+
4. If a banned pattern appears in your draft, rewrite that section in full before responding — never send the draft as-is.
|
|
22
|
+
5. Every `import` must resolve, every type must be defined, every called function must exist.
|
|
23
|
+
|
|
24
|
+
## Banned Patterns
|
|
25
|
+
|
|
26
|
+
These MUST NEVER appear in generated code:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
// ...
|
|
30
|
+
// rest of code
|
|
31
|
+
// rest of the implementation
|
|
32
|
+
// implement here
|
|
33
|
+
// TODO: implement
|
|
34
|
+
// TODO
|
|
35
|
+
// existing code...
|
|
36
|
+
// previous code remains
|
|
37
|
+
// ... (other methods)
|
|
38
|
+
// similar to above
|
|
39
|
+
/* ... */
|
|
40
|
+
# ... rest
|
|
41
|
+
# TODO
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`/* ... */` is banned when it stands in for omitted code; a block comment with real content is fine.
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
1. **Scope** — count the files and functions to generate.
|
|
49
|
+
2. **Build** — write every file completely, no shortcuts.
|
|
50
|
+
3. **Cross-check** — every import resolves, every type exists, every function call targets a defined function.
|
|
51
|
+
4. **Self-check before sending** — search your draft for banned patterns:
|
|
52
|
+
- Pattern found → rewrite that section completely, then repeat this step.
|
|
53
|
+
- No pattern found → send.
|
|
54
|
+
|
|
55
|
+
## Token Limit Handling
|
|
56
|
+
|
|
57
|
+
If approaching the token limit mid-file:
|
|
58
|
+
|
|
59
|
+
1. Finish the current function/class completely.
|
|
60
|
+
2. Add a pause marker with progress tracking.
|
|
61
|
+
3. In the next response, continue from the marker — do not repeat completed code.
|
|
62
|
+
|
|
63
|
+
**Marker formats:**
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
[PAUSED — 3 of 7 files complete. Continuing with AuthService.ts]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
[PAUSED — AuthController.ts: 4 of 6 methods complete]
|
|
71
|
+
[Completed: login, logout, refresh, validate]
|
|
72
|
+
[Remaining: resetPassword, changeEmail]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Recap — non-negotiables
|
|
76
|
+
|
|
77
|
+
- Zero banned patterns in output; found in draft → rewrite the section in full before sending.
|
|
78
|
+
- Split only at a complete function/class boundary, always with a PAUSED marker.
|
|
79
|
+
- **Incomplete code is worse than no code.** A placeholder `// TODO` becomes invisible tech debt; a complete implementation can be reviewed, tested, and shipped.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: product-3d-lighting
|
|
3
|
+
description: Studio lighting setups for 3D product showcases — HDRI, directional/spot/point lights, Environment from drei, shadow config, dark background optimization. Use when setting up lighting for product 3D scenes.
|
|
4
|
+
tokens: 1279
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Product 3D Lighting
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Studio lighting recipes for product showcases in React Three Fiber: three copy-paste scenes plus numeric ranges that keep results dramatic instead of washed out.
|
|
12
|
+
|
|
13
|
+
## Use when / Do not use
|
|
14
|
+
|
|
15
|
+
- USE when lighting a single-subject product scene in R3F (hero section, product page, showcase).
|
|
16
|
+
- Do NOT use for full environments (landscapes, interiors, game levels) — these recipes assume one centered subject.
|
|
17
|
+
|
|
18
|
+
## Hard Rules
|
|
19
|
+
|
|
20
|
+
- Ambient intensity 0.2–0.3 on dark themes — higher washes out the drama.
|
|
21
|
+
- `environmentIntensity` 0.1–0.2 for dark themes, 0.3–0.5 for light themes.
|
|
22
|
+
- Every key light gets a softer fill from the opposite side — a single light means harsh shadows.
|
|
23
|
+
- `ContactShadows` opacity 0.3–0.5, never 1.0.
|
|
24
|
+
- Colored accent lights stay at intensity 0.3–0.5 — subtle beats obvious.
|
|
25
|
+
- Wrap the product in `<Float>` — static products read as screenshots.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
1. Pick a recipe: dark/black background hero → Recipe 1 · white/light page, even light → Recipe 2 · cinematic reflections on a glossy product → Recipe 3 · unsure → Recipe 1 (most common product pattern).
|
|
30
|
+
2. Paste the recipe, replace `<ProductModel />` with your model, adjust positions/intensities only within the Hard Rules ranges.
|
|
31
|
+
3. Check the result against the Common Mistakes table before shipping.
|
|
32
|
+
|
|
33
|
+
## Recipe 1 — Dark Background (Product Hero)
|
|
34
|
+
|
|
35
|
+
The most common product showcase pattern — dark/black background with dramatic lighting.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Environment, ContactShadows, Float } from '@react-three/drei';
|
|
39
|
+
|
|
40
|
+
function ProductScene() {
|
|
41
|
+
return (
|
|
42
|
+
<Canvas camera={{ position: [0, 0, 5], fov: 45 }}>
|
|
43
|
+
{/* Base: low ambient so dark areas stay dark */}
|
|
44
|
+
<ambientLight intensity={0.25} />
|
|
45
|
+
|
|
46
|
+
{/* Key light: main illumination from upper-right */}
|
|
47
|
+
<directionalLight
|
|
48
|
+
position={[5, 5, 5]}
|
|
49
|
+
intensity={0.6}
|
|
50
|
+
castShadow
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
{/* Fill light: softer, from opposite side */}
|
|
54
|
+
<directionalLight
|
|
55
|
+
position={[-3, 3, -3]}
|
|
56
|
+
intensity={0.25}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
{/* Accent: colored point light for brand feel */}
|
|
60
|
+
<pointLight
|
|
61
|
+
position={[0, -2, 3]}
|
|
62
|
+
color="#6366f1"
|
|
63
|
+
intensity={0.5}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
{/* Environment: very low intensity for subtle reflections (drei v9.88+) */}
|
|
67
|
+
<Environment preset="city" environmentIntensity={0.15} />
|
|
68
|
+
|
|
69
|
+
{/* Grounding shadow */}
|
|
70
|
+
<ContactShadows
|
|
71
|
+
position={[0, -1.5, 0]}
|
|
72
|
+
opacity={0.4}
|
|
73
|
+
blur={2.5}
|
|
74
|
+
far={4}
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
{/* Subtle idle animation */}
|
|
78
|
+
<Float speed={1.5} rotationIntensity={0.2} floatIntensity={0.3}>
|
|
79
|
+
<ProductModel />
|
|
80
|
+
</Float>
|
|
81
|
+
</Canvas>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Recipe 2 — Light Background (Clean Product)
|
|
87
|
+
|
|
88
|
+
For white/light product pages — even lighting, minimal shadows.
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Canvas>
|
|
92
|
+
<ambientLight intensity={0.8} />
|
|
93
|
+
<directionalLight position={[5, 5, 5]} intensity={0.5} />
|
|
94
|
+
<directionalLight position={[-5, 3, -5]} intensity={0.3} />
|
|
95
|
+
|
|
96
|
+
<Environment preset="apartment" environmentIntensity={0.4} />
|
|
97
|
+
<ContactShadows opacity={0.2} blur={3} />
|
|
98
|
+
</Canvas>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Recipe 3 — Lightformer Studio (Advanced)
|
|
102
|
+
|
|
103
|
+
Using drei Lightformer for cinematic studio lighting:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Lightformer, Environment } from '@react-three/drei';
|
|
107
|
+
|
|
108
|
+
<Environment resolution={256}>
|
|
109
|
+
{/* Key light — large softbox */}
|
|
110
|
+
<Lightformer
|
|
111
|
+
form="rect"
|
|
112
|
+
intensity={2}
|
|
113
|
+
position={[5, 5, -5]}
|
|
114
|
+
rotation={[0, Math.PI / 2, 0]}
|
|
115
|
+
scale={[5, 3, 1]}
|
|
116
|
+
color="white"
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
{/* Fill — subtle warm */}
|
|
120
|
+
<Lightformer
|
|
121
|
+
form="ring"
|
|
122
|
+
intensity={0.5}
|
|
123
|
+
position={[-5, 3, 5]}
|
|
124
|
+
color="#fef3c7"
|
|
125
|
+
scale={3}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
{/* Rim light — defines edge */}
|
|
129
|
+
<Lightformer
|
|
130
|
+
form="rect"
|
|
131
|
+
intensity={1.5}
|
|
132
|
+
position={[0, 5, -8]}
|
|
133
|
+
scale={[10, 1, 1]}
|
|
134
|
+
color="#e0e7ff"
|
|
135
|
+
/>
|
|
136
|
+
</Environment>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Common Mistakes
|
|
140
|
+
|
|
141
|
+
| Mistake | Fix | Why |
|
|
142
|
+
|---------|-----|-----|
|
|
143
|
+
| Ambient above 0.3 on dark theme | Set ambient intensity 0.2–0.3 | High ambient washes out the drama |
|
|
144
|
+
| `environmentIntensity` too high | 0.1–0.2 dark themes, 0.3–0.5 light | Strong reflections flatten the shading |
|
|
145
|
+
| Single light, no fill | Add a softer light from the opposite side | One light source means harsh shadows |
|
|
146
|
+
| `ContactShadows` opacity 1.0 | Use opacity 0.3–0.5 | Full-black shadow looks pasted on |
|
|
147
|
+
| Static product, no idle motion | Wrap the model in `<Float>` | Static products look like screenshots |
|
|
148
|
+
| Colored accent too strong | Keep accent intensity 0.3–0.5 | Subtle brand tint beats an obvious color cast |
|
|
149
|
+
|
|
150
|
+
## Environment Presets
|
|
151
|
+
|
|
152
|
+
| Preset | Look | Best for |
|
|
153
|
+
|--------|------|----------|
|
|
154
|
+
| `city` | Urban, neutral | General product |
|
|
155
|
+
| `studio` | Clean, white | Minimal product |
|
|
156
|
+
| `apartment` | Warm, natural | Lifestyle product |
|
|
157
|
+
| `sunset` | Golden, warm | Premium/luxury |
|
|
158
|
+
| `dawn` | Cool, blue | Tech/modern |
|
|
159
|
+
| `night` | Dark, moody | Gaming/dark UI |
|
|
160
|
+
|
|
161
|
+
## Recap — non-negotiables
|
|
162
|
+
|
|
163
|
+
- Dark theme: ambient 0.2–0.3, `environmentIntensity` 0.1–0.2.
|
|
164
|
+
- Always pair the key light with a softer fill from the opposite side.
|
|
165
|
+
- `ContactShadows` opacity 0.3–0.5; colored accents 0.3–0.5.
|
|
166
|
+
- Give the product `<Float>` idle motion.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: r3f-scroll-driven-3d
|
|
3
|
+
description: Connect GSAP ScrollTrigger to React Three Fiber — Zustand bridge, useFrame animation, scroll progress to 3D transforms. The pattern for scroll-driven 3D product showcases.
|
|
4
|
+
tokens: 1677
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Scroll-Driven 3D with GSAP + R3F
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
GSAP ScrollTrigger runs in the DOM; R3F runs in WebGL — they cannot talk directly. Bridge them with a Zustand store: GSAP writes scroll progress, R3F reads it in `useFrame`.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
[GSAP ScrollTrigger] → writes → [Zustand Store] → reads → [R3F useFrame]
|
|
15
|
+
(DOM) (shared state) (WebGL)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Use when / Do not use
|
|
19
|
+
|
|
20
|
+
- **Use when:** scroll position drives a 3D scene — product showcases, scrollytelling, camera/model/material state tied to scroll progress.
|
|
21
|
+
- **Do not use:** DOM-only scroll animation (plain ScrollTrigger, no store needed) or one-shot 3D intros with no scroll link (animate directly in `useFrame`).
|
|
22
|
+
|
|
23
|
+
## Hard Rules
|
|
24
|
+
|
|
25
|
+
1. `scrub` MUST be a number (e.g. `scrub: 1`), never `true` — the number adds catch-up smoothing; `true` locks 1:1 to the wheel and looks janky in 3D.
|
|
26
|
+
2. Every ScrollTrigger in this pattern MUST set `invalidateOnRefresh: true` — start/end values recalculate on resize/refresh so the pinned section stays aligned.
|
|
27
|
+
3. When normalizing timeline progress to 0–1, MUST extend the timeline with `tl.set({}, {}, 1)` — without it the timeline ends at the last tween and `tl.call()` positions after that point never fire.
|
|
28
|
+
4. Inside `useFrame` (or any per-frame callback), read the store with `useScrollStore.getState()` — never the hook subscription, which re-renders React on every scroll tick.
|
|
29
|
+
|
|
30
|
+
## Why Zustand (Not React State/Context)?
|
|
31
|
+
|
|
32
|
+
- React state/context triggers re-renders on every scroll tick (60fps = 60 re-renders/sec)
|
|
33
|
+
- Zustand `getState()` reads directly without subscribing — zero re-renders
|
|
34
|
+
- `useFrame` already runs at 60fps — just read the latest value
|
|
35
|
+
|
|
36
|
+
## Workflow
|
|
37
|
+
|
|
38
|
+
### Step 1: Create the store
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
// stores/useScrollStore.ts
|
|
42
|
+
import { create } from 'zustand';
|
|
43
|
+
|
|
44
|
+
interface ScrollStore {
|
|
45
|
+
progress: number; // 0-1 scroll progress
|
|
46
|
+
currentTexture: string; // active screen texture path
|
|
47
|
+
setProgress: (p: number) => void;
|
|
48
|
+
setTexture: (t: string) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const useScrollStore = create<ScrollStore>((set) => ({
|
|
52
|
+
progress: 0,
|
|
53
|
+
currentTexture: '/textures/screen-1.png',
|
|
54
|
+
setProgress: (p) => set({ progress: p }),
|
|
55
|
+
setTexture: (t) => set({ currentTexture: t }),
|
|
56
|
+
}));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Step 2: GSAP writes to store
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
// components/ScrollSection.tsx
|
|
63
|
+
import { useRef, useEffect } from 'react';
|
|
64
|
+
import gsap from 'gsap';
|
|
65
|
+
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
|
66
|
+
import { useScrollStore } from '@/stores/useScrollStore';
|
|
67
|
+
|
|
68
|
+
gsap.registerPlugin(ScrollTrigger);
|
|
69
|
+
|
|
70
|
+
export function ScrollSection() {
|
|
71
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
// getState(), not the hook — stable setters, no 60fps re-renders of this component
|
|
75
|
+
const { setProgress, setTexture } = useScrollStore.getState();
|
|
76
|
+
|
|
77
|
+
const ctx = gsap.context(() => {
|
|
78
|
+
const tl = gsap.timeline({
|
|
79
|
+
scrollTrigger: {
|
|
80
|
+
trigger: ref.current,
|
|
81
|
+
start: 'top top',
|
|
82
|
+
end: 'bottom bottom',
|
|
83
|
+
scrub: 1, // Hard Rule 1: number, NOT true
|
|
84
|
+
invalidateOnRefresh: true, // Hard Rule 2: MUST have
|
|
85
|
+
pin: true,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Animate progress 0 → 1
|
|
90
|
+
tl.to({}, {
|
|
91
|
+
duration: 1,
|
|
92
|
+
onUpdate: function() {
|
|
93
|
+
setProgress(this.progress());
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Swap texture at 50% scroll
|
|
98
|
+
tl.call(() => setTexture('/textures/screen-2.png'), [], 0.5);
|
|
99
|
+
|
|
100
|
+
// Hard Rule 3: extend timeline to full duration — otherwise it ends at
|
|
101
|
+
// the last tween and tl.call() positions after that never fire
|
|
102
|
+
tl.set({}, {}, 1.0);
|
|
103
|
+
|
|
104
|
+
}, ref);
|
|
105
|
+
|
|
106
|
+
return () => ctx.revert();
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
return <div ref={ref} style={{ height: '300vh' }} />;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Step 3: R3F reads in useFrame
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
// components/3d/PhoneModel.tsx
|
|
117
|
+
import { useFrame } from '@react-three/fiber';
|
|
118
|
+
import { useScrollStore } from '@/stores/useScrollStore';
|
|
119
|
+
import { useRef } from 'react';
|
|
120
|
+
import * as THREE from 'three';
|
|
121
|
+
|
|
122
|
+
export function PhoneModel() {
|
|
123
|
+
const groupRef = useRef<THREE.Group>(null);
|
|
124
|
+
|
|
125
|
+
useFrame(() => {
|
|
126
|
+
if (!groupRef.current) return;
|
|
127
|
+
|
|
128
|
+
// Hard Rule 4: getState() not hook — no re-renders
|
|
129
|
+
const { progress } = useScrollStore.getState();
|
|
130
|
+
|
|
131
|
+
// Rotate based on scroll
|
|
132
|
+
groupRef.current.rotation.y = progress * Math.PI * 2;
|
|
133
|
+
|
|
134
|
+
// Phase-based animation
|
|
135
|
+
if (progress < 0.3) {
|
|
136
|
+
// Entry: scale up
|
|
137
|
+
const t = progress / 0.3;
|
|
138
|
+
groupRef.current.scale.setScalar(0.5 + t * 0.5);
|
|
139
|
+
} else if (progress < 0.7) {
|
|
140
|
+
// Showcase: full size, rotate
|
|
141
|
+
groupRef.current.scale.setScalar(1);
|
|
142
|
+
} else {
|
|
143
|
+
// Exit: scale down
|
|
144
|
+
const t = (progress - 0.7) / 0.3;
|
|
145
|
+
groupRef.current.scale.setScalar(1 - t * 0.3);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<group ref={groupRef}>
|
|
151
|
+
{/* Your 3D model here */}
|
|
152
|
+
</group>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Performance Tips
|
|
158
|
+
|
|
159
|
+
- **Pre-allocate:** No `new THREE.Vector3()` inside useFrame — use refs
|
|
160
|
+
- **getState():** Always in useFrame, never hook subscription
|
|
161
|
+
- **DPR:** `dpr={[1, 2]}` — higher wastes mobile GPU
|
|
162
|
+
- **Dispose:** `dispose={null}` on reusable groups
|
|
163
|
+
|
|
164
|
+
## Dynamic Texture Swapping
|
|
165
|
+
|
|
166
|
+
Preload every texture up front (never load inside `useFrame`), then swap `material.map` when the store value changes. Step 2's `tl.call(...)` is what drives `currentTexture`.
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// components/3d/ScreenMaterial.tsx
|
|
170
|
+
import { useTexture } from '@react-three/drei';
|
|
171
|
+
import { useFrame } from '@react-three/fiber';
|
|
172
|
+
import { useRef } from 'react';
|
|
173
|
+
import * as THREE from 'three';
|
|
174
|
+
import { useScrollStore } from '@/stores/useScrollStore';
|
|
175
|
+
|
|
176
|
+
export function ScreenMaterial() {
|
|
177
|
+
const matRef = useRef<THREE.MeshBasicMaterial>(null);
|
|
178
|
+
const [screen1, screen2] = useTexture([
|
|
179
|
+
'/textures/screen-1.png',
|
|
180
|
+
'/textures/screen-2.png',
|
|
181
|
+
]);
|
|
182
|
+
const byPath: Record<string, THREE.Texture> = {
|
|
183
|
+
'/textures/screen-1.png': screen1,
|
|
184
|
+
'/textures/screen-2.png': screen2,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
useFrame(() => {
|
|
188
|
+
// Hard Rule 4: getState() not hook
|
|
189
|
+
const { currentTexture } = useScrollStore.getState();
|
|
190
|
+
const next = byPath[currentTexture];
|
|
191
|
+
if (matRef.current && next && matRef.current.map !== next) {
|
|
192
|
+
matRef.current.map = next;
|
|
193
|
+
matRef.current.needsUpdate = true;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// toneMapped=false: screen UI textures should not be tone-mapped
|
|
198
|
+
return <meshBasicMaterial ref={matRef} map={screen1} toneMapped={false} />;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
For correct color space on screen textures, see the `threejs-color-management` skill.
|
|
203
|
+
|
|
204
|
+
## Recap — non-negotiables
|
|
205
|
+
|
|
206
|
+
- `scrub: <number>`, never `scrub: true`.
|
|
207
|
+
- `invalidateOnRefresh: true` on every ScrollTrigger.
|
|
208
|
+
- `tl.set({}, {}, 1)` to extend the timeline to full duration when normalizing 0–1.
|
|
209
|
+
- `useScrollStore.getState()` inside `useFrame` and callbacks — never the hook subscription.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-color-management
|
|
3
|
+
description: Three.js color pipeline — sRGB vs Linear, toneMapping (None/ACES/Reinhard), texture colorSpace, when to use NoToneMapping for UI textures. Activate when color issues arise with 3D textures or rendered colors look wrong.
|
|
4
|
+
tokens: 1098
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Three.js Color Management
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
Fix wrong-looking colors in Three.js/R3F scenes — too bright, too dark, washed out, or distorted — by setting each stage of the color pipeline correctly.
|
|
11
|
+
|
|
12
|
+
## Use when / Do not use
|
|
13
|
+
- **Use when:** rendered colors do not match the source asset; a UI screenshot looks wrong on a 3D screen; textures look oversaturated, washed out, or too dark.
|
|
14
|
+
- **Do not use for:** brightness problems caused by light intensity/setup, or CSS/DOM color issues outside the Canvas.
|
|
15
|
+
|
|
16
|
+
## Hard Rules
|
|
17
|
+
- Visual textures (photos, UI screenshots) MUST set `texture.colorSpace = THREE.SRGBColorSpace`; data textures (normal, roughness) stay `THREE.LinearSRGBColorSpace`.
|
|
18
|
+
- Materials showing UI/screen content MUST set `toneMapped={false}`.
|
|
19
|
+
- Always write the named constant `THREE.NoToneMapping` — never the bare number `0`.
|
|
20
|
+
- NEVER use deprecated `sRGBEncoding` / `texture.encoding` — replaced by `colorSpace` since r152.
|
|
21
|
+
- Keep `renderer.outputColorSpace = THREE.SRGBColorSpace` (the default) unless there is a documented reason to change it.
|
|
22
|
+
|
|
23
|
+
## Debug Workflow
|
|
24
|
+
Diagnose in pipeline order:
|
|
25
|
+
1. Check `texture.colorSpace` — matches content type (Stage 1 table)?
|
|
26
|
+
2. Check material `toneMapped` — `false` for UI textures (Stage 2 table)?
|
|
27
|
+
3. Check Canvas `toneMapping` — `THREE.NoToneMapping` if the scene is UI-heavy (Stage 3 table)?
|
|
28
|
+
4. Check material type — `meshBasicMaterial` for screens (no lighting effects)?
|
|
29
|
+
5. Grep for deprecated `sRGBEncoding` — replace with `colorSpace` (since r152).
|
|
30
|
+
|
|
31
|
+
## The Color Pipeline
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Texture → Material → Renderer (toneMapping) → Output (outputColorSpace)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Every texture goes through all four stages.
|
|
38
|
+
|
|
39
|
+
### Stage 1: Texture colorSpace
|
|
40
|
+
Set on load. Tells Three.js how to interpret the texture data.
|
|
41
|
+
|
|
42
|
+
| Type | colorSpace | When |
|
|
43
|
+
|------|-----------|------|
|
|
44
|
+
| Photos, UI screenshots | `THREE.SRGBColorSpace` | Colors created for human eyes |
|
|
45
|
+
| Normal maps, roughness | `THREE.LinearSRGBColorSpace` | Data textures (not visual) |
|
|
46
|
+
| HDR environment | `THREE.LinearSRGBColorSpace` | Already in linear space |
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
const texture = useTexture('/screen.png');
|
|
50
|
+
texture.colorSpace = THREE.SRGBColorSpace; // UI screenshot
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Stage 2: Material toneMapped
|
|
54
|
+
Controls whether the material goes through the renderer's tone mapping.
|
|
55
|
+
|
|
56
|
+
| Scenario | toneMapped | Why |
|
|
57
|
+
|----------|-----------|-----|
|
|
58
|
+
| UI on 3D screen | `false` | Preserve exact pixel colors |
|
|
59
|
+
| Realistic objects | `true` (default) | HDR → SDR compression needed |
|
|
60
|
+
| Emissive displays | `false` | Screens emit, don't reflect |
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<meshBasicMaterial map={texture} toneMapped={false} />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Stage 3: Renderer toneMapping
|
|
67
|
+
Global setting. Compresses HDR values into displayable range.
|
|
68
|
+
|
|
69
|
+
| Value | Effect | Use when |
|
|
70
|
+
|-------|--------|----------|
|
|
71
|
+
| `THREE.ACESFilmicToneMapping` | Cinematic, saturated | Realistic 3D scenes (R3F Canvas default) |
|
|
72
|
+
| `THREE.NoToneMapping` (=0) | No compression | UI textures are primary visual |
|
|
73
|
+
| `THREE.ReinhardToneMapping` | Gentle compression | Bright scenes, less contrast |
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<Canvas gl={{ toneMapping: THREE.NoToneMapping }}>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Stage 4: Output colorSpace
|
|
80
|
+
`renderer.outputColorSpace = THREE.SRGBColorSpace` (default). Rarely change this.
|
|
81
|
+
|
|
82
|
+
## Common Issues & Fixes
|
|
83
|
+
|
|
84
|
+
### Colors too bright / oversaturated
|
|
85
|
+
**Cause:** Tone mapping amplifying already-sRGB colors.
|
|
86
|
+
**Fix:** `toneMapped={false}` on the material, or `gl={{ toneMapping: THREE.NoToneMapping }}` on Canvas.
|
|
87
|
+
|
|
88
|
+
### Colors washed out / desaturated
|
|
89
|
+
**Cause:** Texture loaded as LinearSRGB but contains sRGB data.
|
|
90
|
+
**Fix:** `texture.colorSpace = THREE.SRGBColorSpace`
|
|
91
|
+
|
|
92
|
+
### Colors too dark
|
|
93
|
+
**Cause:** sRGB texture treated as linear (double conversion).
|
|
94
|
+
**Fix:** Check `texture.colorSpace` — if it's a photo/UI, must be `THREE.SRGBColorSpace`.
|
|
95
|
+
|
|
96
|
+
### UI screenshot looks wrong on a 3D model
|
|
97
|
+
**UI-screenshot-on-3D-screen pattern** — apply all three settings together:
|
|
98
|
+
```tsx
|
|
99
|
+
<meshBasicMaterial
|
|
100
|
+
map={screenTexture}
|
|
101
|
+
toneMapped={false}
|
|
102
|
+
/>
|
|
103
|
+
// + screenTexture.colorSpace = THREE.SRGBColorSpace
|
|
104
|
+
// + Canvas gl={{ toneMapping: THREE.NoToneMapping }} if UI is the primary visual
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Recap — non-negotiables
|
|
108
|
+
- Photos/UI screenshots → `THREE.SRGBColorSpace`; data textures → `THREE.LinearSRGBColorSpace`.
|
|
109
|
+
- UI/screen materials → `toneMapped={false}` (use `meshBasicMaterial` for screens).
|
|
110
|
+
- Named constant `THREE.NoToneMapping`, never bare `0`.
|
|
111
|
+
- No `sRGBEncoding` — use `colorSpace` (r152+).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Attribution and Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This package incorporates material from the following sources.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Impeccable (Apache License 2.0)
|
|
8
|
+
|
|
9
|
+
**Source:** https://github.com/pbakaus/impeccable
|
|
10
|
+
**Author:** Paul Bakaus and contributors
|
|
11
|
+
**License:** Apache License, Version 2.0
|
|
12
|
+
|
|
13
|
+
**Copyright notice:**
|
|
14
|
+
```
|
|
15
|
+
Copyright 2025 Paul Bakaus
|
|
16
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
you may not use the files derived from this source except in compliance with
|
|
18
|
+
the License. You may obtain a copy of the License at:
|
|
19
|
+
|
|
20
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The Impeccable project itself builds upon Anthropic's
|
|
24
|
+
[`frontend-design`](https://github.com/anthropics/skills/tree/main/skills/frontend-design)
|
|
25
|
+
skill, which is released under the same Apache-2.0 license.
|
|
26
|
+
|
|
27
|
+
### Material incorporated
|
|
28
|
+
|
|
29
|
+
The following rule files in `packages/frontend-ui/rules/` contain material
|
|
30
|
+
adapted, summarised, or directly ported from Impeccable's reference
|
|
31
|
+
documentation:
|
|
32
|
+
|
|
33
|
+
| File | Adapted from |
|
|
34
|
+
|------|--------------|
|
|
35
|
+
| `frontend-design-aesthetics.md` | Impeccable `source/skills/impeccable/SKILL.md` (principles sections) |
|
|
36
|
+
| `typography-guidelines.md` | Impeccable `source/skills/impeccable/reference/typography.md` |
|
|
37
|
+
| `color-and-contrast.md` | Impeccable `source/skills/impeccable/reference/color-and-contrast.md` |
|
|
38
|
+
| `spatial-and-layout.md` | Impeccable `source/skills/impeccable/reference/spatial-design.md` + `responsive-design.md` |
|
|
39
|
+
| `motion-and-animation.md` | Impeccable `source/skills/impeccable/reference/motion-design.md` (partial) |
|
|
40
|
+
| `interaction-polish.md` | Impeccable `source/skills/impeccable/reference/interaction-design.md` + `ux-writing.md` |
|
|
41
|
+
| `ui-anti-patterns.md` | Impeccable's `reflex_fonts_to_reject` list and scattered "DO NOT" blocks |
|
|
42
|
+
|
|
43
|
+
Adaptations include: rephrasing for internal consistency with superkit
|
|
44
|
+
conventions, merging with material from other sources, adding
|
|
45
|
+
`applyWhenPaths` frontmatter for auto-loading, and removing the
|
|
46
|
+
skill-specific `teach` / `craft` flow scaffolding.
|
|
47
|
+
|
|
48
|
+
### Full Apache-2.0 license text
|
|
49
|
+
|
|
50
|
+
See https://www.apache.org/licenses/LICENSE-2.0 for the full, canonical
|
|
51
|
+
license text. The short notice required by the license is reproduced above;
|
|
52
|
+
the full text is not duplicated here to keep this notice concise but applies
|
|
53
|
+
in its entirety to all material listed in the "Material incorporated" table.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 2. Emil Kowalski's Design Engineering philosophy (ideas only)
|
|
58
|
+
|
|
59
|
+
**Source:** https://github.com/emilkowalski/skill and https://emilkowal.ski/skill
|
|
60
|
+
**Author:** Emil Kowalski
|
|
61
|
+
**License:** No LICENSE file present in the source repository at the time of review
|
|
62
|
+
|
|
63
|
+
Because the source repository did not include a license at the time this
|
|
64
|
+
package was authored, the **prose** from Emil's skill file has NOT been
|
|
65
|
+
copied. Only the following categories of material have been incorporated,
|
|
66
|
+
and all of it has been re-expressed in our own wording:
|
|
67
|
+
|
|
68
|
+
1. **Factual content:** easing curve `cubic-bezier` constants; animation
|
|
69
|
+
duration tables (buttons 100-160ms, tooltips 125-200ms, dropdowns
|
|
70
|
+
150-250ms, modals 200-500ms). Technical facts are not copyrightable.
|
|
71
|
+
2. **Methodology patterns:** the structure of the "Animation Decision
|
|
72
|
+
Framework" (four sequential questions: should this animate? what is the
|
|
73
|
+
purpose? what easing? how fast?). The structure is a pattern; our
|
|
74
|
+
implementation uses our own explanations and examples.
|
|
75
|
+
3. **Output-format convention:** the use of a `| Before | After | Why |`
|
|
76
|
+
markdown table for UI review output. Applied as a formatting pattern in
|
|
77
|
+
our agents, not as copied prose.
|
|
78
|
+
|
|
79
|
+
Specifically **not** incorporated: Emil's philosophical framing sections
|
|
80
|
+
("Taste is trained, not innate", "Unseen details compound", "Beauty is
|
|
81
|
+
leverage"), his author's-voice examples, and any quoted passages from other
|
|
82
|
+
authors (including the Paul Graham quotation).
|
|
83
|
+
|
|
84
|
+
If Emil's repository later adds an LICENSE permitting redistribution, this
|
|
85
|
+
notice should be updated to reflect that and additional material may be
|
|
86
|
+
incorporated directly.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## How to update this notice
|
|
91
|
+
|
|
92
|
+
When adding material from a new source:
|
|
93
|
+
1. Add a new numbered section here with source, author, license.
|
|
94
|
+
2. If the new source is under a license requiring a NOTICE entry (Apache-2.0
|
|
95
|
+
and similar), reproduce the required notice here.
|
|
96
|
+
3. List which files in this package incorporate material from the new
|
|
97
|
+
source.
|
|
98
|
+
4. Commit the NOTICE update in the same commit as the first file that
|
|
99
|
+
incorporates the material.
|