@zenrick/zenkit 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +19 -0
- package/.cursor-plugin/marketplace.json +22 -0
- package/INSTALL.md +73 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +69 -3
- package/TERMS.md +48 -0
- package/THIRD-PARTY-NOTICES.md +109 -0
- package/kit/agents/backend-specialist.md +263 -0
- package/kit/agents/code-archaeologist.md +106 -0
- package/kit/agents/database-architect.md +226 -0
- package/kit/agents/debugger.md +226 -0
- package/kit/agents/devops-engineer.md +242 -0
- package/kit/agents/documentation-writer.md +104 -0
- package/kit/agents/explorer-agent.md +73 -0
- package/kit/agents/frontend-specialist.md +593 -0
- package/kit/agents/game-developer.md +162 -0
- package/kit/agents/mobile-developer.md +377 -0
- package/kit/agents/orchestrator.md +489 -0
- package/kit/agents/penetration-tester.md +188 -0
- package/kit/agents/performance-optimizer.md +187 -0
- package/kit/agents/product-manager.md +112 -0
- package/kit/agents/product-owner.md +95 -0
- package/kit/agents/project-planner.md +409 -0
- package/kit/agents/qa-automation-engineer.md +103 -0
- package/kit/agents/security-auditor.md +170 -0
- package/kit/agents/seo-specialist.md +111 -0
- package/kit/agents/test-engineer.md +158 -0
- package/kit/bundles/agent-building.yaml +26 -0
- package/kit/bundles/backend-data.yaml +14 -0
- package/kit/bundles/base.yaml +10 -0
- package/kit/bundles/core.yaml +21 -0
- package/kit/bundles/kit-engenharia.yaml +8 -0
- package/kit/bundles/kit-lite.yaml +9 -0
- package/kit/bundles/security.yaml +11 -0
- package/kit/bundles/ship-run.yaml +16 -0
- package/kit/bundles/web-ui.yaml +18 -0
- package/kit/commands/docs.md +33 -0
- package/kit/commands/explain.md +41 -0
- package/kit/commands/fix.md +65 -0
- package/kit/commands/implement.md +35 -0
- package/kit/commands/refactor.md +59 -0
- package/kit/commands/review.md +55 -0
- package/kit/commands/test.md +63 -0
- package/kit/modules/bridge/rules/cross-ide-bridge.mdc +73 -0
- package/kit/modules/bridge/zenkit-layer.yaml +1 -0
- package/kit/modules/nexuscore/sections/convivencia.md +12 -0
- package/kit/modules/nexuscore/sections/memoria.md +9 -0
- package/kit/modules/nexuscore/skills/quadro-agentes/SKILL.md +186 -0
- package/kit/modules/nexuscore/zenkit-layer.yaml +1 -0
- package/kit/rules/ZENKIT.mdc +294 -0
- package/kit/rules/git.mdc +51 -0
- package/kit/rules/karpathy-guidelines.mdc +70 -0
- package/kit/rules/model-routing.mdc +89 -0
- package/kit/rules/security-headers.mdc +41 -0
- package/kit/rules/social-automation.mdc +69 -0
- package/kit/rules/toc.mdc +40 -0
- package/kit/skills/api-patterns/SKILL.md +95 -0
- package/kit/skills/api-patterns/api-style.md +42 -0
- package/kit/skills/api-patterns/auth.md +24 -0
- package/kit/skills/api-patterns/documentation.md +26 -0
- package/kit/skills/api-patterns/graphql.md +41 -0
- package/kit/skills/api-patterns/rate-limiting.md +31 -0
- package/kit/skills/api-patterns/references/backend/backend-api-design.md +495 -0
- package/kit/skills/api-patterns/references/backend/backend-architecture.md +454 -0
- package/kit/skills/api-patterns/references/backend/backend-authentication.md +338 -0
- package/kit/skills/api-patterns/references/backend/backend-code-quality.md +659 -0
- package/kit/skills/api-patterns/references/backend/backend-debugging.md +904 -0
- package/kit/skills/api-patterns/references/backend/backend-devops.md +494 -0
- package/kit/skills/api-patterns/references/backend/backend-mindset.md +387 -0
- package/kit/skills/api-patterns/references/backend/backend-performance.md +397 -0
- package/kit/skills/api-patterns/references/backend/backend-security.md +290 -0
- package/kit/skills/api-patterns/references/backend/backend-technologies.md +256 -0
- package/kit/skills/api-patterns/references/backend/backend-testing.md +429 -0
- package/kit/skills/api-patterns/response.md +37 -0
- package/kit/skills/api-patterns/rest.md +40 -0
- package/kit/skills/api-patterns/scripts/api_validator.py +211 -0
- package/kit/skills/api-patterns/security-testing.md +122 -0
- package/kit/skills/api-patterns/trpc.md +41 -0
- package/kit/skills/api-patterns/versioning.md +22 -0
- package/kit/skills/app-builder/SKILL.md +76 -0
- package/kit/skills/app-builder/agent-coordination.md +71 -0
- package/kit/skills/app-builder/feature-building.md +53 -0
- package/kit/skills/app-builder/project-detection.md +34 -0
- package/kit/skills/app-builder/scaffolding.md +118 -0
- package/kit/skills/app-builder/tech-stack.md +41 -0
- package/kit/skills/app-builder/templates/SKILL.md +39 -0
- package/kit/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/kit/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/kit/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/kit/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/kit/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/kit/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/kit/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/kit/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/kit/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/kit/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/kit/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/kit/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/kit/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/kit/skills/architecture/SKILL.md +56 -0
- package/kit/skills/architecture/context-discovery.md +43 -0
- package/kit/skills/architecture/examples.md +94 -0
- package/kit/skills/architecture/pattern-selection.md +68 -0
- package/kit/skills/architecture/patterns-reference.md +50 -0
- package/kit/skills/architecture/trade-off-analysis.md +77 -0
- package/kit/skills/bash-linux/SKILL.md +203 -0
- package/kit/skills/batch-operations/SKILL.md +112 -0
- package/kit/skills/behavioral-modes/SKILL.md +255 -0
- package/kit/skills/brainstorming/SKILL.md +189 -0
- package/kit/skills/brainstorming/dynamic-questioning.md +350 -0
- package/kit/skills/brainstorming/references/problem-solving/attribution.md +69 -0
- package/kit/skills/brainstorming/references/problem-solving/collision-zone-thinking.md +79 -0
- package/kit/skills/brainstorming/references/problem-solving/inversion-exercise.md +91 -0
- package/kit/skills/brainstorming/references/problem-solving/meta-pattern-recognition.md +87 -0
- package/kit/skills/brainstorming/references/problem-solving/scale-game.md +95 -0
- package/kit/skills/brainstorming/references/problem-solving/simplification-cascades.md +80 -0
- package/kit/skills/brainstorming/references/problem-solving/when-stuck.md +72 -0
- package/kit/skills/claude-exec/SKILL.md +185 -0
- package/kit/skills/clean-code/SKILL.md +210 -0
- package/kit/skills/code-review-checklist/SKILL.md +115 -0
- package/kit/skills/code-review-graph/SKILL.md +50 -0
- package/kit/skills/code-review-graph/references/alternatives-comparison.md +12 -0
- package/kit/skills/code-review-graph/references/best-practices.md +9 -0
- package/kit/skills/code-review-graph/references/configuration.md +43 -0
- package/kit/skills/code-review-graph/references/core-workflows.md +61 -0
- package/kit/skills/code-review-graph/references/how-it-works-4-layers.md +20 -0
- package/kit/skills/code-review-graph/references/installation.md +67 -0
- package/kit/skills/code-review-graph/references/integration-with-zenkit.md +23 -0
- package/kit/skills/code-review-graph/references/known-limitations.md +13 -0
- package/kit/skills/code-review-graph/references/when-to-use-vs-when-to-skip.md +21 -0
- package/kit/skills/codex-exec/SKILL.md +161 -0
- package/kit/skills/context-compression/SKILL.md +145 -0
- package/kit/skills/coordinator-mode/SKILL.md +215 -0
- package/kit/skills/cursor-exec/SKILL.md +152 -0
- package/kit/skills/database-design/SKILL.md +53 -0
- package/kit/skills/database-design/database-selection.md +43 -0
- package/kit/skills/database-design/indexing.md +39 -0
- package/kit/skills/database-design/migrations.md +48 -0
- package/kit/skills/database-design/optimization.md +36 -0
- package/kit/skills/database-design/orm-selection.md +30 -0
- package/kit/skills/database-design/schema-design.md +56 -0
- package/kit/skills/database-design/scripts/schema_validator.py +172 -0
- package/kit/skills/deployment-procedures/SKILL.md +242 -0
- package/kit/skills/deprecation-and-migration/SKILL.md +149 -0
- package/kit/skills/documentation-templates/SKILL.md +195 -0
- package/kit/skills/entrega-com-agentes/SKILL.md +177 -0
- package/kit/skills/frontend-design/NOTICE.md +6 -0
- package/kit/skills/frontend-design/SKILL.md +456 -0
- package/kit/skills/frontend-design/animation-guide.md +331 -0
- package/kit/skills/frontend-design/color-system.md +311 -0
- package/kit/skills/frontend-design/decision-trees.md +418 -0
- package/kit/skills/frontend-design/motion-graphics.md +306 -0
- package/kit/skills/frontend-design/references/aesthetic/design-guideline-template.md +163 -0
- package/kit/skills/frontend-design/references/aesthetic/design-principles.md +62 -0
- package/kit/skills/frontend-design/references/aesthetic/design-resources.md +75 -0
- package/kit/skills/frontend-design/references/aesthetic/design-story-template.md +135 -0
- package/kit/skills/frontend-design/references/aesthetic/micro-interactions.md +53 -0
- package/kit/skills/frontend-design/references/aesthetic/storytelling-design.md +50 -0
- package/kit/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/kit/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/kit/skills/frontend-design/typography-system.md +345 -0
- package/kit/skills/frontend-design/ux-psychology.md +1116 -0
- package/kit/skills/frontend-design/visual-effects.md +383 -0
- package/kit/skills/game-development/2d-games/SKILL.md +119 -0
- package/kit/skills/game-development/3d-games/SKILL.md +135 -0
- package/kit/skills/game-development/SKILL.md +168 -0
- package/kit/skills/game-development/game-art/SKILL.md +185 -0
- package/kit/skills/game-development/game-audio/SKILL.md +190 -0
- package/kit/skills/game-development/game-design/SKILL.md +129 -0
- package/kit/skills/game-development/mobile-games/SKILL.md +108 -0
- package/kit/skills/game-development/multiplayer/SKILL.md +132 -0
- package/kit/skills/game-development/pc-games/SKILL.md +144 -0
- package/kit/skills/game-development/vr-ar/SKILL.md +123 -0
- package/kit/skills/game-development/web-games/SKILL.md +150 -0
- package/kit/skills/gemini-exec/SKILL.md +80 -0
- package/kit/skills/geo-fundamentals/SKILL.md +157 -0
- package/kit/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/kit/skills/git-worktrees/SKILL.md +107 -0
- package/kit/skills/i18n-localization/SKILL.md +145 -0
- package/kit/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/kit/skills/intelligent-routing/SKILL.md +128 -0
- package/kit/skills/intelligent-routing/references/4-response-format.md +16 -0
- package/kit/skills/intelligent-routing/references/complexity-assessment.md +29 -0
- package/kit/skills/intelligent-routing/references/debug-intelligent-routing.md +9 -0
- package/kit/skills/intelligent-routing/references/debugging-agent-selection.md +7 -0
- package/kit/skills/intelligent-routing/references/domain-detection-rules.md +29 -0
- package/kit/skills/intelligent-routing/references/edge-cases.md +29 -0
- package/kit/skills/intelligent-routing/references/implementation-rules.md +35 -0
- package/kit/skills/intelligent-routing/references/integration-with-existing-workflows.md +21 -0
- package/kit/skills/intelligent-routing/references/performance-considerations.md +14 -0
- package/kit/skills/intelligent-routing/references/summary.md +16 -0
- package/kit/skills/intelligent-routing/references/testing-the-system.md +36 -0
- package/kit/skills/intelligent-routing/references/tier-0-automatic-analysis-always-active.md +27 -0
- package/kit/skills/intelligent-routing/references/user-education.md +12 -0
- package/kit/skills/karpathy-guidelines/SKILL.md +67 -0
- package/kit/skills/karpathy-guidelines/references/EXAMPLES.md +522 -0
- package/kit/skills/lint-and-validate/SKILL.md +46 -0
- package/kit/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/kit/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/kit/skills/mcp-atuacao/SKILL.md +238 -0
- package/kit/skills/mcp-builder/NOTICE.md +6 -0
- package/kit/skills/mcp-builder/SKILL.md +259 -0
- package/kit/skills/memory-system/SKILL.md +181 -0
- package/kit/skills/mobile-design/SKILL.md +395 -0
- package/kit/skills/mobile-design/decision-trees.md +516 -0
- package/kit/skills/mobile-design/mobile-backend.md +491 -0
- package/kit/skills/mobile-design/mobile-color-system.md +420 -0
- package/kit/skills/mobile-design/mobile-debugging.md +122 -0
- package/kit/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/kit/skills/mobile-design/mobile-navigation.md +458 -0
- package/kit/skills/mobile-design/mobile-performance.md +767 -0
- package/kit/skills/mobile-design/mobile-testing.md +356 -0
- package/kit/skills/mobile-design/mobile-typography.md +433 -0
- package/kit/skills/mobile-design/platform-android.md +666 -0
- package/kit/skills/mobile-design/platform-ios.md +561 -0
- package/kit/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/kit/skills/mobile-design/touch-psychology.md +537 -0
- package/kit/skills/negocio-agente-conversa/SKILL.md +168 -0
- package/kit/skills/negocio-atendimento/SKILL.md +134 -0
- package/kit/skills/negocio-linguagem/SKILL.md +166 -0
- package/kit/skills/negocio-preco/SKILL.md +174 -0
- package/kit/skills/negocio-preco/scripts/preco.mjs +160 -0
- package/kit/skills/negocio-qualificacao/SKILL.md +140 -0
- package/kit/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/kit/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/kit/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/kit/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/kit/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/kit/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/kit/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/kit/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/kit/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/kit/skills/nextjs-react-expert/SKILL.md +308 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/common-patterns.md +331 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/complete-examples.md +872 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/component-patterns.md +502 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/data-fetching.md +767 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/file-organization.md +502 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/loading-and-error-states.md +501 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/performance.md +406 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/routing-guide.md +364 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/styling-guide.md +428 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/typescript-standards.md +418 -0
- package/kit/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/kit/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/kit/skills/nodejs-best-practices/SKILL.md +78 -0
- package/kit/skills/nodejs-best-practices/references/10-anti-patterns-to-avoid.md +21 -0
- package/kit/skills/nodejs-best-practices/references/11-decision-checklist.md +14 -0
- package/kit/skills/nodejs-best-practices/references/2-runtime-considerations-2025.md +36 -0
- package/kit/skills/nodejs-best-practices/references/3-architecture-principles.md +35 -0
- package/kit/skills/nodejs-best-practices/references/4-error-handling-principles.md +42 -0
- package/kit/skills/nodejs-best-practices/references/5-async-patterns-principles.md +35 -0
- package/kit/skills/nodejs-best-practices/references/6-validation-principles.md +29 -0
- package/kit/skills/nodejs-best-practices/references/7-security-principles.md +29 -0
- package/kit/skills/nodejs-best-practices/references/8-testing-principles.md +28 -0
- package/kit/skills/observability-and-instrumentation/SKILL.md +150 -0
- package/kit/skills/opencode-go-exec/SKILL.md +101 -0
- package/kit/skills/parallel-agents/SKILL.md +184 -0
- package/kit/skills/performance-profiling/SKILL.md +145 -0
- package/kit/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/kit/skills/plan-writing/SKILL.md +213 -0
- package/kit/skills/powershell-windows/SKILL.md +196 -0
- package/kit/skills/provider-orchestration/SKILL.md +269 -0
- package/kit/skills/python-patterns/SKILL.md +80 -0
- package/kit/skills/python-patterns/references/10-decision-checklist.md +14 -0
- package/kit/skills/python-patterns/references/11-anti-patterns-to-avoid.md +20 -0
- package/kit/skills/python-patterns/references/2-async-vs-sync-decision.md +44 -0
- package/kit/skills/python-patterns/references/3-type-hints-strategy.md +56 -0
- package/kit/skills/python-patterns/references/4-project-structure-principles.md +56 -0
- package/kit/skills/python-patterns/references/5-django-principles-2025.md +40 -0
- package/kit/skills/python-patterns/references/6-fastapi-principles.md +50 -0
- package/kit/skills/python-patterns/references/7-background-tasks.md +31 -0
- package/kit/skills/python-patterns/references/8-error-handling-principles.md +29 -0
- package/kit/skills/python-patterns/references/9-testing-principles.md +37 -0
- package/kit/skills/red-team-tactics/SKILL.md +201 -0
- package/kit/skills/research/SKILL.md +166 -0
- package/kit/skills/rust-pro/SKILL.md +177 -0
- package/kit/skills/seo-fundamentals/SKILL.md +130 -0
- package/kit/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/kit/skills/sequential-thinking/.env.example +8 -0
- package/kit/skills/sequential-thinking/README.md +183 -0
- package/kit/skills/sequential-thinking/SKILL.md +95 -0
- package/kit/skills/sequential-thinking/package.json +31 -0
- package/kit/skills/sequential-thinking/references/advanced-strategies.md +79 -0
- package/kit/skills/sequential-thinking/references/advanced-techniques.md +76 -0
- package/kit/skills/sequential-thinking/references/core-patterns.md +95 -0
- package/kit/skills/sequential-thinking/references/examples-api.md +88 -0
- package/kit/skills/sequential-thinking/references/examples-architecture.md +94 -0
- package/kit/skills/sequential-thinking/references/examples-debug.md +90 -0
- package/kit/skills/sequential-thinking/scripts/format-thought.js +159 -0
- package/kit/skills/sequential-thinking/scripts/process-thought.js +236 -0
- package/kit/skills/server-management/SKILL.md +162 -0
- package/kit/skills/simplify-code/SKILL.md +133 -0
- package/kit/skills/skillify/SKILL.md +116 -0
- package/kit/skills/system-design-interview/SKILL.md +268 -0
- package/kit/skills/systematic-debugging/SKILL.md +110 -0
- package/kit/skills/tailwind-patterns/SKILL.md +283 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/canvas-design-system.md +320 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-accessibility.md +471 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-components.md +424 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-theming.md +373 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-customization.md +483 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-responsive.md +382 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-utilities.md +455 -0
- package/kit/skills/tdd-workflow/SKILL.md +150 -0
- package/kit/skills/testing-patterns/SKILL.md +196 -0
- package/kit/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kit/skills/ui-ux-pro-max/SKILL.md +135 -0
- package/kit/skills/verify-changes/SKILL.md +125 -0
- package/kit/skills/vulnerability-scanner/SKILL.md +278 -0
- package/kit/skills/vulnerability-scanner/checklists.md +121 -0
- package/kit/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/kit/skills/web-design-guidelines/SKILL.md +58 -0
- package/kit/skills/webapp-testing/NOTICE.md +6 -0
- package/kit/skills/webapp-testing/SKILL.md +188 -0
- package/kit/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/kit/workflows/brainstorm.md +113 -0
- package/kit/workflows/coordinate.md +72 -0
- package/kit/workflows/create.md +59 -0
- package/kit/workflows/debug.md +103 -0
- package/kit/workflows/deploy.md +176 -0
- package/kit/workflows/enhance.md +63 -0
- package/kit/workflows/orchestrate.md +237 -0
- package/kit/workflows/plan.md +89 -0
- package/kit/workflows/preview.md +81 -0
- package/kit/workflows/remember.md +67 -0
- package/kit/workflows/status.md +86 -0
- package/kit/workflows/test.md +144 -0
- package/kit/workflows/ui-ux-pro-max.md +296 -0
- package/kit/workflows/verify.md +72 -0
- package/licenses/Apache-2.0.txt +202 -0
- package/package.json +60 -6
- package/scripts/avaliar-vigilancia-mandato.mjs +38 -0
- package/scripts/bundle.mjs +158 -0
- package/scripts/check-deps.mjs +178 -0
- package/scripts/check-models.mjs +150 -0
- package/scripts/cli.mjs +295 -0
- package/scripts/continuidade-mandato.mjs +47 -0
- package/scripts/discriminar-turno.mjs +191 -0
- package/scripts/doctor.mjs +615 -0
- package/scripts/generate.mjs +676 -0
- package/scripts/install.mjs +11 -0
- package/scripts/layer-remote.mjs +344 -0
- package/scripts/layers.mjs +208 -0
- package/scripts/marketplace.mjs +77 -0
- package/scripts/product.mjs +32 -0
- package/scripts/ruleset-core.mjs +68 -0
- package/scripts/social-hooks.mjs +293 -0
- package/scripts/social-pacer.mjs +219 -0
- package/scripts/validate-bundles.mjs +14 -0
- package/scripts/validate-skills.mjs +174 -0
- package/scripts/zenkit-daemon-task.cmd +3 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Real-world code examples demonstrating the four principles. Each example shows what LLMs commonly do wrong and how to fix it.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Think Before Coding
|
|
8
|
+
|
|
9
|
+
### Example 1: Hidden Assumptions
|
|
10
|
+
|
|
11
|
+
**User Request:** "Add a feature to export user data"
|
|
12
|
+
|
|
13
|
+
**❌ What LLMs Do (Wrong Assumptions)**
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
def export_users(format='json'):
|
|
17
|
+
"""Export all users to a file."""
|
|
18
|
+
users = User.query.all()
|
|
19
|
+
|
|
20
|
+
if format == 'json':
|
|
21
|
+
with open('users.json', 'w') as f:
|
|
22
|
+
json.dump([u.to_dict() for u in users], f)
|
|
23
|
+
elif format == 'csv':
|
|
24
|
+
with open('users.csv', 'w') as f:
|
|
25
|
+
writer = csv.DictWriter(f, fieldnames=['id', 'email', 'name'])
|
|
26
|
+
writer.writeheader()
|
|
27
|
+
writer.writerows([u.to_dict() for u in users])
|
|
28
|
+
|
|
29
|
+
return f"Exported {len(users)} users"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Problems:**
|
|
33
|
+
- Assumed it should export ALL users (what about pagination? privacy?)
|
|
34
|
+
- Assumed file location without asking
|
|
35
|
+
- Assumed which fields to include
|
|
36
|
+
- Assumed CSV fieldnames without checking actual data structure
|
|
37
|
+
|
|
38
|
+
**✅ What Should Happen (Surface Assumptions)**
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Before implementing, I need to clarify:
|
|
42
|
+
|
|
43
|
+
1. **Scope**: Export all users or filtered subset? (privacy implications)
|
|
44
|
+
2. **Format**: You mentioned "export" - did you mean:
|
|
45
|
+
- Download file in browser?
|
|
46
|
+
- Background job with email notification?
|
|
47
|
+
- API endpoint returning data?
|
|
48
|
+
3. **Fields**: Which user fields? (some might be sensitive)
|
|
49
|
+
4. **Volume**: How many users typically? (affects approach)
|
|
50
|
+
|
|
51
|
+
Simplest approach: Add an API endpoint that returns paginated JSON.
|
|
52
|
+
Would need more info for file-based exports.
|
|
53
|
+
|
|
54
|
+
What's your preference?
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 2: Multiple Interpretations
|
|
58
|
+
|
|
59
|
+
**User Request:** "Make the search faster"
|
|
60
|
+
|
|
61
|
+
**❌ What LLMs Do (Pick Silently)**
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
# Adds caching, database indexes, and async processing
|
|
65
|
+
# without asking which "faster" matters
|
|
66
|
+
@lru_cache(maxsize=1000)
|
|
67
|
+
async def search(query: str) -> List[Result]:
|
|
68
|
+
# ... 200 lines of optimization code
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**✅ What Should Happen**
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
"Make the search faster" could mean:
|
|
75
|
+
|
|
76
|
+
1. **Faster response time** (< 100ms instead of 500ms)
|
|
77
|
+
- Add database indexes
|
|
78
|
+
- Cache frequent queries
|
|
79
|
+
- Estimated effort: 2 hours
|
|
80
|
+
|
|
81
|
+
2. **Handle more concurrent searches** (throughput)
|
|
82
|
+
- Add async/await
|
|
83
|
+
- Connection pooling
|
|
84
|
+
- Estimated effort: 4 hours
|
|
85
|
+
|
|
86
|
+
3. **Faster perceived speed** (UX)
|
|
87
|
+
- Show partial results immediately
|
|
88
|
+
- Progressive loading
|
|
89
|
+
- Estimated effort: 3 hours
|
|
90
|
+
|
|
91
|
+
Current search takes ~500ms for typical queries.
|
|
92
|
+
Which aspect matters most for your use case?
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 2. Simplicity First
|
|
98
|
+
|
|
99
|
+
### Example 1: Over-abstraction
|
|
100
|
+
|
|
101
|
+
**User Request:** "Add a function to calculate discount"
|
|
102
|
+
|
|
103
|
+
**❌ What LLMs Do (Overengineered)**
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from abc import ABC, abstractmethod
|
|
107
|
+
from enum import Enum
|
|
108
|
+
from typing import Protocol, Union
|
|
109
|
+
from dataclasses import dataclass
|
|
110
|
+
|
|
111
|
+
class DiscountStrategy(ABC):
|
|
112
|
+
@abstractmethod
|
|
113
|
+
def calculate(self, amount: float) -> float:
|
|
114
|
+
pass
|
|
115
|
+
|
|
116
|
+
class PercentageDiscount(DiscountStrategy):
|
|
117
|
+
def __init__(self, percentage: float):
|
|
118
|
+
self.percentage = percentage
|
|
119
|
+
|
|
120
|
+
def calculate(self, amount: float) -> float:
|
|
121
|
+
return amount * (self.percentage / 100)
|
|
122
|
+
|
|
123
|
+
class FixedDiscount(DiscountStrategy):
|
|
124
|
+
def __init__(self, fixed_amount: float):
|
|
125
|
+
self.fixed_amount = fixed_amount
|
|
126
|
+
|
|
127
|
+
def calculate(self, amount: float) -> float:
|
|
128
|
+
return min(self.fixed_amount, amount)
|
|
129
|
+
|
|
130
|
+
@dataclass
|
|
131
|
+
class DiscountConfig:
|
|
132
|
+
strategy: DiscountStrategy
|
|
133
|
+
min_purchase: float = 0.0
|
|
134
|
+
max_discount: float = float('inf')
|
|
135
|
+
|
|
136
|
+
class DiscountCalculator:
|
|
137
|
+
def __init__(self, config: DiscountConfig):
|
|
138
|
+
self.config = config
|
|
139
|
+
|
|
140
|
+
def apply_discount(self, amount: float) -> float:
|
|
141
|
+
if amount < self.config.min_purchase:
|
|
142
|
+
return 0
|
|
143
|
+
discount = self.config.strategy.calculate(amount)
|
|
144
|
+
return min(discount, self.config.max_discount)
|
|
145
|
+
|
|
146
|
+
# Usage requires 30+ lines of setup for a simple calculation
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**✅ What Should Happen (Simple)**
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
def calculate_discount(amount: float, percent: float) -> float:
|
|
153
|
+
"""Calculate discount amount. percent should be 0-100."""
|
|
154
|
+
return amount * (percent / 100)
|
|
155
|
+
|
|
156
|
+
# Usage
|
|
157
|
+
discount = calculate_discount(100.0, 10.0) # $10 off
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**When to add complexity:** Only when you actually need multiple discount types. If that requirement comes later, refactor then.
|
|
161
|
+
|
|
162
|
+
### Example 2: Speculative Features
|
|
163
|
+
|
|
164
|
+
**User Request:** "Save user preferences to database"
|
|
165
|
+
|
|
166
|
+
**❌ What LLMs Do (Unnecessary Features)**
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
class PreferenceManager:
|
|
170
|
+
def __init__(self, db, cache=None, validator=None):
|
|
171
|
+
self.db = db
|
|
172
|
+
self.cache = cache or InMemoryCache()
|
|
173
|
+
self.validator = validator or DefaultValidator()
|
|
174
|
+
|
|
175
|
+
def save(self, user_id: int, prefs: dict,
|
|
176
|
+
merge: bool = True,
|
|
177
|
+
validate: bool = True,
|
|
178
|
+
notify: bool = False) -> bool:
|
|
179
|
+
"""Save preferences with optional merging, validation, and notifications."""
|
|
180
|
+
|
|
181
|
+
if validate:
|
|
182
|
+
errors = self.validator.validate(prefs)
|
|
183
|
+
if errors:
|
|
184
|
+
raise ValidationError(errors)
|
|
185
|
+
|
|
186
|
+
existing = self.get(user_id) if merge else {}
|
|
187
|
+
|
|
188
|
+
if merge:
|
|
189
|
+
existing.update(prefs)
|
|
190
|
+
prefs = existing
|
|
191
|
+
|
|
192
|
+
self.db.execute(
|
|
193
|
+
"UPDATE users SET preferences = ? WHERE id = ?",
|
|
194
|
+
(json.dumps(prefs), user_id)
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if self.cache:
|
|
198
|
+
self.cache.set(f"prefs:{user_id}", prefs)
|
|
199
|
+
|
|
200
|
+
if notify:
|
|
201
|
+
self.notify_preference_change(user_id, prefs)
|
|
202
|
+
|
|
203
|
+
return True
|
|
204
|
+
|
|
205
|
+
def notify_preference_change(self, user_id: int, prefs: dict):
|
|
206
|
+
# Another 30 lines for a feature nobody asked for
|
|
207
|
+
pass
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**✅ What Should Happen (Just What Was Asked)**
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
def save_preferences(db, user_id: int, preferences: dict):
|
|
214
|
+
"""Save user preferences to database."""
|
|
215
|
+
db.execute(
|
|
216
|
+
"UPDATE users SET preferences = ? WHERE id = ?",
|
|
217
|
+
(json.dumps(preferences), user_id)
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Add later if needed:** Caching (when performance matters), validation (when bad data appears), merging (when requirement emerges).
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 3. Surgical Changes
|
|
226
|
+
|
|
227
|
+
### Example 1: Drive-by Refactoring
|
|
228
|
+
|
|
229
|
+
**User Request:** "Fix the bug where empty emails crash the validator"
|
|
230
|
+
|
|
231
|
+
**❌ What LLMs Do (Too Much)**
|
|
232
|
+
|
|
233
|
+
```diff
|
|
234
|
+
def validate_user(user_data):
|
|
235
|
+
- # Check email format
|
|
236
|
+
- if not user_data.get('email'):
|
|
237
|
+
+ """Validate user data."""
|
|
238
|
+
+ email = user_data.get('email', '').strip()
|
|
239
|
+
+
|
|
240
|
+
+ # Validate email
|
|
241
|
+
+ if not email:
|
|
242
|
+
raise ValueError("Email required")
|
|
243
|
+
-
|
|
244
|
+
- # Basic email validation
|
|
245
|
+
- if '@' not in user_data['email']:
|
|
246
|
+
+ if '@' not in email or '.' not in email.split('@')[1]:
|
|
247
|
+
raise ValueError("Invalid email")
|
|
248
|
+
|
|
249
|
+
- # Check username
|
|
250
|
+
- if not user_data.get('username'):
|
|
251
|
+
+ # Validate username
|
|
252
|
+
+ username = user_data.get('username', '').strip()
|
|
253
|
+
+ if not username:
|
|
254
|
+
raise ValueError("Username required")
|
|
255
|
+
+ if len(username) < 3:
|
|
256
|
+
+ raise ValueError("Username too short")
|
|
257
|
+
+ if not username.isalnum():
|
|
258
|
+
+ raise ValueError("Username must be alphanumeric")
|
|
259
|
+
|
|
260
|
+
return True
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Problems:**
|
|
264
|
+
- "Improved" email validation beyond the bug fix
|
|
265
|
+
- Added username validation nobody asked for
|
|
266
|
+
- Changed comments
|
|
267
|
+
- Added docstring
|
|
268
|
+
|
|
269
|
+
**✅ What Should Happen (Surgical)**
|
|
270
|
+
|
|
271
|
+
```diff
|
|
272
|
+
def validate_user(user_data):
|
|
273
|
+
# Check email format
|
|
274
|
+
- if not user_data.get('email'):
|
|
275
|
+
+ email = user_data.get('email', '')
|
|
276
|
+
+ if not email or not email.strip():
|
|
277
|
+
raise ValueError("Email required")
|
|
278
|
+
|
|
279
|
+
# Basic email validation
|
|
280
|
+
- if '@' not in user_data['email']:
|
|
281
|
+
+ if '@' not in email:
|
|
282
|
+
raise ValueError("Invalid email")
|
|
283
|
+
|
|
284
|
+
# Check username
|
|
285
|
+
if not user_data.get('username'):
|
|
286
|
+
raise ValueError("Username required")
|
|
287
|
+
|
|
288
|
+
return True
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Only changed:** The specific lines that fix empty email handling.
|
|
292
|
+
|
|
293
|
+
### Example 2: Style Drift
|
|
294
|
+
|
|
295
|
+
**User Request:** "Add logging to the upload function"
|
|
296
|
+
|
|
297
|
+
**❌ What LLMs Do (Reformat Everything)**
|
|
298
|
+
|
|
299
|
+
```diff
|
|
300
|
+
- def upload_file(file_path, destination):
|
|
301
|
+
+ def upload_file(file_path: str, destination: str) -> bool:
|
|
302
|
+
+ """Upload file to destination with logging."""
|
|
303
|
+
+ logger.info(f"Uploading {file_path} to {destination}")
|
|
304
|
+
+
|
|
305
|
+
try:
|
|
306
|
+
- with open(file_path, 'rb') as f:
|
|
307
|
+
- data = f.read()
|
|
308
|
+
-
|
|
309
|
+
- response = requests.post(destination, files={'file': data})
|
|
310
|
+
-
|
|
311
|
+
- if response.status_code == 200:
|
|
312
|
+
- return True
|
|
313
|
+
- else:
|
|
314
|
+
- return False
|
|
315
|
+
+ with open(file_path, "rb") as f:
|
|
316
|
+
+ data = f.read()
|
|
317
|
+
+ response = requests.post(destination, files={"file": data})
|
|
318
|
+
+ success = response.status_code == 200
|
|
319
|
+
+
|
|
320
|
+
+ if success:
|
|
321
|
+
+ logger.info(f"Upload successful: {file_path}")
|
|
322
|
+
+ else:
|
|
323
|
+
+ logger.error(f"Upload failed: {file_path}, status={response.status_code}")
|
|
324
|
+
+
|
|
325
|
+
+ return success
|
|
326
|
+
except Exception as e:
|
|
327
|
+
- print(f"Error: {e}")
|
|
328
|
+
+ logger.exception(f"Upload error for {file_path}: {e}")
|
|
329
|
+
return False
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Problems:**
|
|
333
|
+
- Changed quote style ('' to "")
|
|
334
|
+
- Added type hints nobody asked for
|
|
335
|
+
- Added docstring
|
|
336
|
+
- Reformatted whitespace
|
|
337
|
+
- Changed boolean return logic
|
|
338
|
+
|
|
339
|
+
**✅ What Should Happen (Match Existing Style)**
|
|
340
|
+
|
|
341
|
+
```diff
|
|
342
|
+
+ import logging
|
|
343
|
+
+
|
|
344
|
+
+ logger = logging.getLogger(__name__)
|
|
345
|
+
+
|
|
346
|
+
def upload_file(file_path, destination):
|
|
347
|
+
+ logger.info(f'Starting upload: {file_path}')
|
|
348
|
+
try:
|
|
349
|
+
with open(file_path, 'rb') as f:
|
|
350
|
+
data = f.read()
|
|
351
|
+
|
|
352
|
+
response = requests.post(destination, files={'file': data})
|
|
353
|
+
|
|
354
|
+
if response.status_code == 200:
|
|
355
|
+
+ logger.info(f'Upload successful: {file_path}')
|
|
356
|
+
return True
|
|
357
|
+
else:
|
|
358
|
+
+ logger.error(f'Upload failed: {file_path}, status={response.status_code}')
|
|
359
|
+
return False
|
|
360
|
+
except Exception as e:
|
|
361
|
+
- print(f"Error: {e}")
|
|
362
|
+
+ logger.exception(f'Upload error: {file_path}')
|
|
363
|
+
return False
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Matched:** Single quotes, no type hints, existing boolean pattern, spacing style.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## 4. Goal-Driven Execution
|
|
371
|
+
|
|
372
|
+
### Example 1: Vague vs. Verifiable
|
|
373
|
+
|
|
374
|
+
**User Request:** "Fix the authentication system"
|
|
375
|
+
|
|
376
|
+
**❌ What LLMs Do (Vague Approach)**
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
I'll fix the authentication system by:
|
|
380
|
+
1. Reviewing the code
|
|
381
|
+
2. Identifying issues
|
|
382
|
+
3. Making improvements
|
|
383
|
+
4. Testing the changes
|
|
384
|
+
|
|
385
|
+
[Proceeds to make changes without clear success criteria]
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**✅ What Should Happen (Verifiable Goals)**
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
To "fix authentication," I need to define success criteria.
|
|
392
|
+
What specific issue are we solving?
|
|
393
|
+
|
|
394
|
+
If the issue is "users stay logged in after password change":
|
|
395
|
+
|
|
396
|
+
Plan:
|
|
397
|
+
1. Write test: Change password → verify old session invalidated
|
|
398
|
+
Verify: Test fails (reproduces bug)
|
|
399
|
+
|
|
400
|
+
2. Implement: Invalidate sessions on password change
|
|
401
|
+
Verify: Test passes
|
|
402
|
+
|
|
403
|
+
3. Check edge cases: Multiple active sessions, concurrent changes
|
|
404
|
+
Verify: Additional tests pass
|
|
405
|
+
|
|
406
|
+
4. Verify no regression: Existing auth tests still pass
|
|
407
|
+
Verify: Full test suite green
|
|
408
|
+
|
|
409
|
+
Current test coverage for auth: [shows coverage]
|
|
410
|
+
What's the specific auth issue you're seeing?
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Example 2: Multi-Step with Verification
|
|
414
|
+
|
|
415
|
+
**User Request:** "Add rate limiting to the API"
|
|
416
|
+
|
|
417
|
+
**❌ What LLMs Do (All at Once)**
|
|
418
|
+
|
|
419
|
+
```python
|
|
420
|
+
# Implements full rate limiting with Redis, multiple strategies,
|
|
421
|
+
# configuration system, and monitoring in one 300-line commit
|
|
422
|
+
# No clear verification steps
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**✅ What Should Happen (Incremental with Verification)**
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
Plan for rate limiting:
|
|
429
|
+
|
|
430
|
+
1. Add basic in-memory rate limiting (single endpoint)
|
|
431
|
+
Verify:
|
|
432
|
+
- Test: 100 requests → first 10 succeed, rest get 429
|
|
433
|
+
- Manual: curl endpoint 11 times, see rate limit error
|
|
434
|
+
|
|
435
|
+
2. Extract to middleware (apply to all endpoints)
|
|
436
|
+
Verify:
|
|
437
|
+
- Test: Rate limits apply to /users and /posts
|
|
438
|
+
- Existing endpoint tests still pass
|
|
439
|
+
|
|
440
|
+
3. Add Redis backend (for multi-server)
|
|
441
|
+
Verify:
|
|
442
|
+
- Test: Rate limit persists across app restarts
|
|
443
|
+
- Test: Two app instances share rate limit counter
|
|
444
|
+
|
|
445
|
+
4. Add configuration (rates per endpoint)
|
|
446
|
+
Verify:
|
|
447
|
+
- Test: /search allows 10/min, /users allows 100/min
|
|
448
|
+
- Config file parsed correctly
|
|
449
|
+
|
|
450
|
+
Each step is independently verifiable and deployable.
|
|
451
|
+
Start with step 1?
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Example 3: Test-First Verification
|
|
455
|
+
|
|
456
|
+
**User Request:** "The sorting breaks when there are duplicate scores"
|
|
457
|
+
|
|
458
|
+
**❌ What LLMs Do (Fix Without Reproducing)**
|
|
459
|
+
|
|
460
|
+
```python
|
|
461
|
+
# Immediately changes sort logic without confirming the bug
|
|
462
|
+
def sort_scores(scores):
|
|
463
|
+
return sorted(scores, key=lambda x: (-x['score'], x['name']))
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**✅ What Should Happen (Reproduce First)**
|
|
467
|
+
|
|
468
|
+
```python
|
|
469
|
+
# 1. First, write a test that reproduces the issue
|
|
470
|
+
def test_sort_with_duplicate_scores():
|
|
471
|
+
"""Test sorting when multiple items have same score."""
|
|
472
|
+
scores = [
|
|
473
|
+
{'name': 'Alice', 'score': 100},
|
|
474
|
+
{'name': 'Bob', 'score': 100},
|
|
475
|
+
{'name': 'Charlie', 'score': 90},
|
|
476
|
+
]
|
|
477
|
+
|
|
478
|
+
result = sort_scores(scores)
|
|
479
|
+
|
|
480
|
+
# The bug: order is non-deterministic for duplicates
|
|
481
|
+
# Run this test multiple times, it should be consistent
|
|
482
|
+
assert result[0]['score'] == 100
|
|
483
|
+
assert result[1]['score'] == 100
|
|
484
|
+
assert result[2]['score'] == 90
|
|
485
|
+
|
|
486
|
+
# Verify: Run test 10 times → fails with inconsistent ordering
|
|
487
|
+
|
|
488
|
+
# 2. Now fix with stable sort
|
|
489
|
+
def sort_scores(scores):
|
|
490
|
+
"""Sort by score descending, then name ascending for ties."""
|
|
491
|
+
return sorted(scores, key=lambda x: (-x['score'], x['name']))
|
|
492
|
+
|
|
493
|
+
# Verify: Test passes consistently
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## Anti-Patterns Summary
|
|
499
|
+
|
|
500
|
+
| Principle | Anti-Pattern | Fix |
|
|
501
|
+
|-----------|-------------|-----|
|
|
502
|
+
| Think Before Coding | Silently assumes file format, fields, scope | List assumptions explicitly, ask for clarification |
|
|
503
|
+
| Simplicity First | Strategy pattern for single discount calculation | One function until complexity is actually needed |
|
|
504
|
+
| Surgical Changes | Reformats quotes, adds type hints while fixing bug | Only change lines that fix the reported issue |
|
|
505
|
+
| Goal-Driven | "I'll review and improve the code" | "Write test for bug X → make it pass → verify no regressions" |
|
|
506
|
+
|
|
507
|
+
## Key Insight
|
|
508
|
+
|
|
509
|
+
The "overcomplicated" examples aren't obviously wrong—they follow design patterns and best practices. The problem is **timing**: they add complexity before it's needed, which:
|
|
510
|
+
|
|
511
|
+
- Makes code harder to understand
|
|
512
|
+
- Introduces more bugs
|
|
513
|
+
- Takes longer to implement
|
|
514
|
+
- Harder to test
|
|
515
|
+
|
|
516
|
+
The "simple" versions are:
|
|
517
|
+
- Easier to understand
|
|
518
|
+
- Faster to implement
|
|
519
|
+
- Easier to test
|
|
520
|
+
- Can be refactored later when complexity is actually needed
|
|
521
|
+
|
|
522
|
+
**Good code is code that solves today's problem simply, not tomorrow's problem prematurely.**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-and-validate
|
|
3
|
+
description: Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers onKeywords: lint, format, check, validate, types, static analysis.
|
|
4
|
+
when_to_use: "When running linters, type checkers, or code formatters. After any code change that needs quality validation."
|
|
5
|
+
allowed-tools: Read, Glob, Grep, Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Lint and Validate Skill
|
|
9
|
+
|
|
10
|
+
> **MANDATORY:** Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free.
|
|
11
|
+
|
|
12
|
+
### Procedures by Ecosystem
|
|
13
|
+
|
|
14
|
+
#### Node.js / TypeScript
|
|
15
|
+
1. **Lint/Format:** `npm run lint` (or `npx biome check .` / `npx eslint .`). Avoid blind `--fix` on semantic logic.
|
|
16
|
+
2. **Types:** `npx tsc --noEmit` (strict mode: never suppress with `as any` or `@ts-ignore`).
|
|
17
|
+
3. **Security:** `npm audit --audit-level=high`
|
|
18
|
+
|
|
19
|
+
#### Python
|
|
20
|
+
1. **Linter & Format (Ruff):** `ruff check "path"` and `ruff format --check "path"`
|
|
21
|
+
2. **Security (Bandit):** `bandit -r "path" -ll`
|
|
22
|
+
3. **Types (MyPy / Pyright):** `mypy "path"` or `pyright "path"`
|
|
23
|
+
|
|
24
|
+
## The Quality Loop
|
|
25
|
+
1. **Write/Edit Code**
|
|
26
|
+
2. **Run Validation:** `npm run lint && npx tsc --noEmit`
|
|
27
|
+
3. **Verify Exit Codes:** Every validation command must exit with code 0.
|
|
28
|
+
4. **Fix Root Causes:** Never suppress type errors or lint warnings to force green pipelines. Code is only done when checks pass cleanly.
|
|
29
|
+
|
|
30
|
+
## Error Handling
|
|
31
|
+
- If `lint` fails: Fix the style or syntax issues immediately.
|
|
32
|
+
- If `tsc` fails: Correct type mismatches before proceeding.
|
|
33
|
+
- If no tool is configured: Check the project root for `.eslintrc`, `tsconfig.json`, `pyproject.toml` and suggest creating one.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
**Strict Rule:** No code should be committed or reported as "done" without passing these checks.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Scripts
|
|
41
|
+
|
|
42
|
+
| Script | Purpose | Command |
|
|
43
|
+
|--------|---------|---------|
|
|
44
|
+
| `scripts/lint_runner.py` | Unified lint check | `python scripts/lint_runner.py <project_path>` |
|
|
45
|
+
| `scripts/type_coverage.py` | Type coverage analysis | `python scripts/type_coverage.py <project_path>` |
|
|
46
|
+
|