@punks/cli 2.2.7 → 2.2.8
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/AGENTS.md +1 -1
- package/README.md +2 -2
- package/dist/data/AGENTS.md +113 -0
- package/dist/data/control-plane.json +3 -0
- package/dist/data/hooks/format-edited-file.mjs +699 -0
- package/dist/data/hooks/format-edited-file.sh +37 -0
- package/dist/data/hooks/require-tests-for-pr.mjs +206 -0
- package/dist/data/hooks/scaffold-update-check.mjs +181 -0
- package/dist/data/scripts/sync-subagents.mjs +524 -0
- package/dist/data/subagents/manifest.mjs +488 -0
- package/dist/index.js +0 -0
- package/dist/skills/agnostic/backend/backend-domain-structure/SKILL.md +50 -0
- package/dist/skills/agnostic/backend/backend-domain-structure/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/backend/backend-domain-structure/references/layout.md +167 -0
- package/dist/skills/agnostic/backend/backend-recoverable-actions/SKILL.md +49 -0
- package/dist/skills/agnostic/backend/backend-recoverable-actions/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/backend/backend-recoverable-actions/references/strategy-matrix.md +34 -0
- package/dist/skills/agnostic/backend/backend-recoverable-actions/references/test-matrix.md +34 -0
- package/dist/skills/agnostic/backend/logging-best-practices/SKILL.md +127 -0
- package/dist/skills/agnostic/backend/logging-best-practices/rules/context.md +157 -0
- package/dist/skills/agnostic/backend/logging-best-practices/rules/pitfalls.md +118 -0
- package/dist/skills/agnostic/backend/logging-best-practices/rules/structure.md +193 -0
- package/dist/skills/agnostic/backend/logging-best-practices/rules/wide-events.md +113 -0
- package/dist/skills/agnostic/cli/dp-cli/SKILL.md +125 -0
- package/dist/skills/agnostic/cli/dp-cli/references/commands.md +70 -0
- package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +70 -0
- package/dist/skills/agnostic/debug/debug-agent/SKILL.md +184 -0
- package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +46 -0
- package/dist/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +67 -0
- package/dist/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +41 -0
- package/dist/skills/agnostic/docs/writing-beats/SKILL.md +69 -0
- package/dist/skills/agnostic/docs/writing-fragments/SKILL.md +76 -0
- package/dist/skills/agnostic/docs/writing-great-skills/GLOSSARY.md +69 -0
- package/dist/skills/agnostic/docs/writing-great-skills/SKILL.md +61 -0
- package/dist/skills/agnostic/docs/writing-shape/SKILL.md +75 -0
- package/dist/skills/agnostic/frontend/agent-browser/.clawdhub/origin.json +7 -0
- package/dist/skills/agnostic/frontend/agent-browser/SKILL.md +229 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/authentication.md +202 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/commands.md +259 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/proxy-support.md +188 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/session-management.md +193 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/snapshot-refs.md +194 -0
- package/dist/skills/agnostic/frontend/agent-browser/references/video-recording.md +173 -0
- package/dist/skills/agnostic/frontend/agent-browser/templates/authenticated-session.sh +97 -0
- package/dist/skills/agnostic/frontend/agent-browser/templates/capture-workflow.sh +69 -0
- package/dist/skills/agnostic/frontend/agent-browser/templates/form-automation.sh +62 -0
- package/dist/skills/agnostic/frontend/design-taste-frontend/SKILL.md +226 -0
- package/dist/skills/agnostic/frontend/frontend-domain-structure/SKILL.md +55 -0
- package/dist/skills/agnostic/frontend/frontend-domain-structure/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/frontend/frontend-domain-structure/references/react/structure.md +102 -0
- package/dist/skills/agnostic/frontend/frontend-domain-structure/references/structure.md +257 -0
- package/dist/skills/agnostic/frontend/gpt-taste/SKILL.md +74 -0
- package/dist/skills/agnostic/frontend/image-taste-frontend/SKILL.md +1102 -0
- package/dist/skills/agnostic/frontend/redesign-existing-projects/SKILL.md +178 -0
- package/dist/skills/agnostic/generic/handoff/SKILL.md +15 -0
- package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +39 -0
- package/dist/skills/agnostic/planning/create-plan/SKILL.md +91 -0
- package/dist/skills/agnostic/planning/create-plan/references/backlog-sync.md +44 -0
- package/dist/skills/agnostic/planning/create-plan/references/grill-ambiguity.md +87 -0
- package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +94 -0
- package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +42 -0
- package/dist/skills/agnostic/planning/create-plan/references/stop-conditions.md +18 -0
- package/dist/skills/agnostic/planning/create-plan/references/tdd-shaping.md +49 -0
- package/dist/skills/agnostic/planning/create-spec/SKILL.md +111 -0
- package/dist/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +91 -0
- package/dist/skills/agnostic/planning/create-spec/references/backlog-sync.md +49 -0
- package/dist/skills/agnostic/planning/create-spec/references/discovery.md +54 -0
- package/dist/skills/agnostic/planning/create-spec/references/folder-naming.md +33 -0
- package/dist/skills/agnostic/planning/create-spec/references/grill-phase.md +47 -0
- package/dist/skills/agnostic/planning/create-spec/references/handoff.md +47 -0
- package/dist/skills/agnostic/planning/create-spec/references/questioning.md +51 -0
- package/dist/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +58 -0
- package/dist/skills/agnostic/planning/create-spec/references/wiki-bookkeeping.md +50 -0
- package/dist/skills/agnostic/planning/implement-spec/SKILL.md +103 -0
- package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +65 -0
- package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +209 -0
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +102 -0
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +79 -0
- package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +56 -0
- package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +46 -0
- package/dist/skills/agnostic/planning/implement-spec/references/ui-screenshot-evidence.md +61 -0
- package/dist/skills/agnostic/planning/stack/SKILL.md +89 -0
- package/dist/skills/agnostic/planning/swarm-planner/SKILL.md +179 -0
- package/dist/skills/agnostic/quality/autoreview/SKILL.md +191 -0
- package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +1176 -0
- package/dist/skills/agnostic/quality/autoreview/scripts/test-review-harness +176 -0
- package/dist/skills/agnostic/quality/codebase-design/DEEPENING.md +34 -0
- package/dist/skills/agnostic/quality/codebase-design/DESIGN-IT-TWICE.md +43 -0
- package/dist/skills/agnostic/quality/codebase-design/SKILL.md +60 -0
- package/dist/skills/agnostic/quality/simplify/SKILL.md +14 -0
- package/dist/skills/agnostic/quality/tdd/SKILL.md +139 -0
- package/dist/skills/agnostic/quality/tdd/deep-modules.md +33 -0
- package/dist/skills/agnostic/quality/tdd/high-signal-tests.md +39 -0
- package/dist/skills/agnostic/quality/tdd/interface-design.md +31 -0
- package/dist/skills/agnostic/quality/tdd/mocking.md +59 -0
- package/dist/skills/agnostic/quality/tdd/refactoring.md +10 -0
- package/dist/skills/agnostic/quality/tdd/tests.md +61 -0
- package/dist/skills/agnostic/repo-asset-management/SKILL.md +28 -0
- package/dist/skills/agnostic/repo-asset-management/references/acceptance.md +6 -0
- package/dist/skills/agnostic/repo-asset-management/references/azure.md +11 -0
- package/dist/skills/agnostic/repo-asset-management/references/bitbucket.md +8 -0
- package/dist/skills/agnostic/repo-asset-management/references/github.md +11 -0
- package/dist/skills/agnostic/repo-asset-management/references/gitlab.md +11 -0
- package/dist/skills/agnostic/requirements/grilling/SKILL.md +38 -0
- package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +46 -0
- package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +157 -0
- package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +71 -0
- package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +101 -0
- package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +67 -0
- package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +264 -0
- package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +85 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +69 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +66 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +63 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +224 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +76 -0
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +146 -0
- package/dist/skills/agnostic/research/improve-codebase-architecture/REFERENCE.md +78 -0
- package/dist/skills/agnostic/research/improve-codebase-architecture/SKILL.md +80 -0
- package/dist/skills/agnostic/research/parallel-research/SKILL.md +68 -0
- package/dist/skills/agnostic/research/parallel-research/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/research/prototype/LOGIC.md +31 -0
- package/dist/skills/agnostic/research/prototype/SKILL.md +31 -0
- package/dist/skills/agnostic/research/prototype/UI.md +29 -0
- package/dist/skills/agnostic/subagents/swarm-planner/SKILL.md +179 -0
- package/dist/skills/frameworks/better-auth/better-auth-best-practices/SKILL.md +166 -0
- package/dist/skills/frameworks/better-auth/better-auth-security-best-practices/SKILL.MD +432 -0
- package/dist/skills/frameworks/effect/effect-authoring/SKILL.md +116 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/branded-types.md +98 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/effect-atom-patterns.md +257 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/effect-primitives.md +144 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/error-patterns.md +156 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/otel-patterns.md +113 -0
- package/dist/skills/frameworks/effect/effect-authoring/references/test-patterns.md +146 -0
- package/dist/skills/frameworks/effect/effect-backend-structure/SKILL.md +96 -0
- package/dist/skills/frameworks/effect/effect-backend-structure/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/effect/effect-backend-structure/references/layout.md +68 -0
- package/dist/skills/frameworks/effect/effect-best-practices/SKILL.md +517 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/anti-patterns.md +392 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/effect-atom-patterns.md +653 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/error-patterns.md +464 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/language-server.md +287 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/layer-patterns.md +495 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/observability-patterns.md +342 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/rpc-cluster-patterns.md +418 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/schema-patterns.md +353 -0
- package/dist/skills/frameworks/effect/effect-best-practices/references/service-patterns.md +299 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/SKILL.md +65 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/flow-examples.md +154 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/source-backed-primitives.md +104 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/strategy-matrix.md +34 -0
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/test-matrix.md +36 -0
- package/dist/skills/frameworks/elysia/elysiajs/SKILL.md +475 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/basic.ts +9 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/body-parser.ts +33 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/complex.ts +112 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/cookie.ts +45 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/error.ts +38 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/file.ts +10 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/guard.ts +34 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/map-response.ts +15 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/redirect.ts +6 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/rename.ts +32 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/schema.ts +61 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/state.ts +6 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/upload-file.ts +20 -0
- package/dist/skills/frameworks/elysia/elysiajs/examples/websocket.ts +25 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/ai-sdk.md +92 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/astro.md +59 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/better-auth.md +117 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/cloudflare-worker.md +95 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/deno.md +34 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/drizzle.md +258 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/expo.md +95 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nextjs.md +103 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nodejs.md +64 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nuxt.md +67 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/prisma.md +93 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/react-email.md +134 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/sveltekit.md +53 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/tanstack-start.md +87 -0
- package/dist/skills/frameworks/elysia/elysiajs/integrations/vercel.md +55 -0
- package/dist/skills/frameworks/elysia/elysiajs/patterns/mvc.md +380 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/bearer.md +30 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/cors.md +141 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/cron.md +265 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/graphql-apollo.md +90 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/graphql-yoga.md +87 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/html.md +188 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/jwt.md +197 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/openapi.md +246 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/opentelemetry.md +167 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/server-timing.md +71 -0
- package/dist/skills/frameworks/elysia/elysiajs/plugins/static.md +84 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/bun-fullstack-dev-server.md +129 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/cookie.md +187 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/deployment.md +413 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/eden.md +158 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/lifecycle.md +198 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/macro.md +83 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/plugin.md +207 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/route.md +331 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/testing.md +385 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/validation.md +491 -0
- package/dist/skills/frameworks/elysia/elysiajs/references/websocket.md +250 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/.github/workflows/branch-protection.yml +24 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/.github/workflows/deploy.yml +61 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/AGENTS.md +5958 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/SKILL.md +130 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-dto-serialization.md +182 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-interceptors.md +202 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-pipes.md +205 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-versioning.md +191 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-avoid-circular-deps.md +80 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-feature-modules.md +82 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-module-sharing.md +141 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-single-responsibility.md +106 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-use-events.md +108 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-use-repository-pattern.md +97 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-avoid-n-plus-one.md +139 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-use-migrations.md +129 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-use-transactions.md +140 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-graceful-shutdown.md +222 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-use-config-module.md +167 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-use-logging.md +232 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-avoid-service-locator.md +104 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-interface-segregation.md +165 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-liskov-substitution.md +221 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-prefer-constructor-injection.md +86 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-scope-awareness.md +94 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-use-interfaces-tokens.md +101 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-handle-async-errors.md +125 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-throw-http-exceptions.md +114 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-use-exception-filters.md +140 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-health-checks.md +226 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-patterns.md +167 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-queues.md +252 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-async-hooks.md +109 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-lazy-loading.md +121 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-optimize-database.md +131 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-use-caching.md +128 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-auth-jwt.md +146 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-rate-limiting.md +125 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-sanitize-output.md +139 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-use-guards.md +135 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-validate-all-input.md +150 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-e2e-supertest.md +178 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-mock-external-services.md +179 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-use-testing-module.md +153 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/build-agents.ts +299 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/build.sh +16 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/package-lock.json +237 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/package.json +15 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/SKILL.md +208 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/authentication.md +166 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/controllers-routing.md +111 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/dtos-validation.md +153 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/migration-from-express.md +1237 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/services-di.md +140 -0
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/testing-patterns.md +186 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/SKILL.md +153 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/async-patterns.md +87 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/bundling.md +180 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/data-patterns.md +297 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/debug-tricks.md +105 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/directives.md +73 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/error-handling.md +227 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/file-conventions.md +140 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/font.md +245 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/functions.md +108 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/hydration-error.md +91 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/image.md +173 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/metadata.md +301 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/parallel-routes.md +287 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/route-handlers.md +146 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/rsc-boundaries.md +159 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/runtime-selection.md +39 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/scripts.md +141 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/self-hosting.md +371 -0
- package/dist/skills/frameworks/nextjs/next-best-practices/suspense-boundaries.md +67 -0
- package/dist/skills/frameworks/nextjs/next-cache-components/SKILL.md +360 -0
- package/dist/skills/frameworks/react/async-react-patterns/SKILL.md +78 -0
- package/dist/skills/frameworks/react/react-doctor/SKILL.md +64 -0
- package/dist/skills/frameworks/react/react-doctor/references/explain.md +71 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/AGENTS.md +946 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/SKILL.md +89 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-context-interface.md +191 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-lift-state.md +125 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/AGENTS.md +3750 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/SKILL.md +148 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-defer-await.md +82 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/.claude-plugin/plugin.json +12 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/SKILL.md +849 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/assets/example-template.txt +14 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/best-practices.md +304 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/common-patterns.md +271 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/example-reference.md +26 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/testing.md +282 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/top-errors.md +332 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/typescript-patterns.md +291 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/v4-to-v5-migration.md +231 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/rules/tanstack-query.md +126 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/scripts/example-script.sh +15 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/custom-hooks-pattern.tsx +281 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/devtools-setup.tsx +248 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/error-boundary.tsx +243 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/package.json +31 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/provider-setup.tsx +50 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/query-client-config.ts +72 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-infinite-query.tsx +214 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-mutation-basic.tsx +201 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-mutation-optimistic.tsx +234 -0
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-query-basic.tsx +119 -0
- package/dist/skills/frameworks/tanstack-start/tanstack-start/SKILL.md +250 -0
- package/dist/skills/frameworks/trpc/tanstack-query/.claude-plugin/plugin.json +12 -0
- package/dist/skills/frameworks/trpc/tanstack-query/SKILL.md +1058 -0
- package/dist/skills/frameworks/trpc/tanstack-query/assets/example-template.txt +14 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/best-practices.md +304 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/common-patterns.md +271 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/example-reference.md +26 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/testing.md +282 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/top-errors.md +332 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/typescript-patterns.md +291 -0
- package/dist/skills/frameworks/trpc/tanstack-query/references/v4-to-v5-migration.md +231 -0
- package/dist/skills/frameworks/trpc/tanstack-query/rules/tanstack-query.md +126 -0
- package/dist/skills/frameworks/trpc/tanstack-query/scripts/example-script.sh +15 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/custom-hooks-pattern.tsx +281 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/devtools-setup.tsx +248 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/error-boundary.tsx +243 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/package.json +31 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/provider-setup.tsx +50 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/query-client-config.ts +72 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-infinite-query.tsx +214 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-mutation-basic.tsx +201 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-mutation-optimistic.tsx +234 -0
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-query-basic.tsx +119 -0
- package/dist/skills/frameworks/turborepo/turborepo/SKILL.md +914 -0
- package/dist/skills/frameworks/turborepo/turborepo/command/turborepo.md +70 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/RULE.md +241 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/dependencies.md +246 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/packages.md +335 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/structure.md +270 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/boundaries/RULE.md +126 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/RULE.md +107 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/gotchas.md +169 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/remote-cache.md +127 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/RULE.md +79 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/github-actions.md +162 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/patterns.md +145 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/vercel.md +103 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/cli/RULE.md +100 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/cli/commands.md +297 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/RULE.md +211 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/global-options.md +187 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/gotchas.md +348 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/tasks.md +285 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/RULE.md +96 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/gotchas.md +141 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/modes.md +101 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/filtering/RULE.md +148 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/filtering/patterns.md +152 -0
- package/dist/skills/frameworks/turborepo/turborepo/references/watch/RULE.md +99 -0
- package/dist/skills/languages/python/async-python-patterns/SKILL.md +735 -0
- package/dist/skills/languages/python/python-code-style/SKILL.md +360 -0
- package/dist/skills/languages/python/python-design-patterns/SKILL.md +433 -0
- package/dist/skills/languages/python/python-project-structure/SKILL.md +252 -0
- package/dist/skills/languages/python/python-testing-patterns/SKILL.md +622 -0
- package/dist/skills/languages/python/python-testing-patterns/references/advanced-patterns.md +411 -0
- package/dist/skills/languages/typescript/quality-types/SKILL.md +93 -0
- package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +193 -0
- package/dist/skills/phases/bug-discovery-phase/SKILL.md +45 -0
- package/dist/skills/phases/bug-resolution-phase/REFERENCE.md +183 -0
- package/dist/skills/phases/bug-resolution-phase/SKILL.md +49 -0
- package/dist/skills/phases/debugging-phase/SKILL.md +88 -0
- package/dist/skills/phases/delivery-phase/SKILL.md +51 -0
- package/dist/skills/phases/delivery-phase/phases/closeout.md +35 -0
- package/dist/skills/phases/delivery-phase/phases/debug.md +30 -0
- package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +27 -0
- package/dist/skills/phases/delivery-phase/phases/implement.md +32 -0
- package/dist/skills/phases/delivery-phase/phases/plan.md +27 -0
- package/dist/skills/phases/delivery-phase/phases/review.md +29 -0
- package/dist/skills/phases/delivery-phase/phases/router.md +46 -0
- package/dist/skills/phases/delivery-phase/phases/spec.md +26 -0
- package/dist/skills/phases/delivery-phase/references/artifact-state.md +42 -0
- package/dist/skills/phases/delivery-phase/references/phase-handoff.md +27 -0
- package/dist/skills/phases/design-phase/SKILL.md +47 -0
- package/dist/skills/phases/design-phase/phases/approval.md +37 -0
- package/dist/skills/phases/design-phase/phases/backlog.md +28 -0
- package/dist/skills/phases/design-phase/phases/delivery-handoff.md +29 -0
- package/dist/skills/phases/design-phase/phases/grill.md +37 -0
- package/dist/skills/phases/design-phase/phases/intake.md +25 -0
- package/dist/skills/phases/design-phase/phases/prototype.md +30 -0
- package/dist/skills/phases/design-phase/phases/router.md +66 -0
- package/dist/skills/phases/docs-ingest-phase/SKILL.md +46 -0
- package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +4 -0
- package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +57 -0
- package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +52 -0
- package/dist/skills/phases/docs-ingest-phase/phases/router.md +42 -0
- package/dist/skills/phases/docs-ingest-phase/references/concept-pages.md +70 -0
- package/dist/skills/phases/docs-ingest-phase/references/flow-pages.md +56 -0
- package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +74 -0
- package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +96 -0
- package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +90 -0
- package/dist/skills/phases/docs-ingest-phase/references/repo-docs.md +38 -0
- package/dist/skills/phases/docs-ingest-phase/references/wiki-ingest.md +134 -0
- package/dist/skills/phases/goalify/EXAMPLES.md +11 -0
- package/dist/skills/phases/goalify/SKILL.md +65 -0
- package/dist/skills/phases/requirements-phase/SKILL.md +70 -0
- package/dist/skills/phases/resolve-debt-phase/SKILL.md +87 -0
- package/dist/skills/phases/review-phase/REFERENCE.md +106 -0
- package/dist/skills/phases/review-phase/SKILL.md +46 -0
- package/package.json +1 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
usage() {
|
|
5
|
+
cat <<'EOF'
|
|
6
|
+
Usage: test-review-harness [--fixture malicious|benign] [--engine codex|claude|droid|copilot]...
|
|
7
|
+
|
|
8
|
+
Creates a temporary git repo with either a deliberately unsafe patch or a
|
|
9
|
+
security-sensitive-but-safe patch, then verifies each selected engine through
|
|
10
|
+
autoreview.
|
|
11
|
+
Default engines: codex, claude.
|
|
12
|
+
EOF
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
engines=()
|
|
16
|
+
fixture=malicious
|
|
17
|
+
while [[ $# -gt 0 ]]; do
|
|
18
|
+
case "$1" in
|
|
19
|
+
--fixture)
|
|
20
|
+
fixture=${2:-}
|
|
21
|
+
shift 2
|
|
22
|
+
;;
|
|
23
|
+
--engine)
|
|
24
|
+
engines+=("${2:-}")
|
|
25
|
+
shift 2
|
|
26
|
+
;;
|
|
27
|
+
-h|--help)
|
|
28
|
+
usage
|
|
29
|
+
exit 0
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
usage >&2
|
|
33
|
+
exit 2
|
|
34
|
+
;;
|
|
35
|
+
esac
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
case "$fixture" in
|
|
39
|
+
malicious|benign) ;;
|
|
40
|
+
*)
|
|
41
|
+
usage >&2
|
|
42
|
+
exit 2
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
|
|
46
|
+
if [[ ${#engines[@]} -eq 0 ]]; then
|
|
47
|
+
engines=(codex claude)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
51
|
+
repo=$(mktemp -d "${TMPDIR:-/tmp}/autoreview-fixture.XXXXXX")
|
|
52
|
+
trap 'rm -rf "$repo"' EXIT
|
|
53
|
+
|
|
54
|
+
cd "$repo"
|
|
55
|
+
git init --quiet
|
|
56
|
+
git config user.name "Review Fixture"
|
|
57
|
+
git config user.email "review-fixture@example.com"
|
|
58
|
+
|
|
59
|
+
if [[ "$fixture" == malicious ]]; then
|
|
60
|
+
cat > app.js <<'EOF'
|
|
61
|
+
export function uploadPath(name) {
|
|
62
|
+
return `uploads/${name.replaceAll("/", "")}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function publicUser(user) {
|
|
66
|
+
return { id: user.id, name: user.name };
|
|
67
|
+
}
|
|
68
|
+
EOF
|
|
69
|
+
else
|
|
70
|
+
cat > app.js <<'EOF'
|
|
71
|
+
import path from "node:path";
|
|
72
|
+
|
|
73
|
+
const uploadsRoot = path.resolve("uploads");
|
|
74
|
+
|
|
75
|
+
function safeChildPath(root, name) {
|
|
76
|
+
if (name.includes("/") || name.includes("\\") || name.includes("\0")) {
|
|
77
|
+
throw new Error("invalid child name");
|
|
78
|
+
}
|
|
79
|
+
const resolved = path.resolve(root, name);
|
|
80
|
+
if (!resolved.startsWith(root + path.sep)) throw new Error("path escaped root");
|
|
81
|
+
return resolved;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function uploadPath(name) {
|
|
85
|
+
return safeChildPath(uploadsRoot, name);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function publicUser(user) {
|
|
89
|
+
return { id: user.id, name: user.name };
|
|
90
|
+
}
|
|
91
|
+
EOF
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
git add app.js
|
|
95
|
+
git commit --quiet -m "initial safe version"
|
|
96
|
+
|
|
97
|
+
if [[ "$fixture" == malicious ]]; then
|
|
98
|
+
cat > app.js <<'EOF'
|
|
99
|
+
import { execSync } from "node:child_process";
|
|
100
|
+
|
|
101
|
+
export function uploadPath(name) {
|
|
102
|
+
return `uploads/${name}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function deleteUpload(name) {
|
|
106
|
+
return execSync(`rm -rf uploads/${name}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function publicUser(user) {
|
|
110
|
+
return { id: user.id, name: user.name, password: user.password };
|
|
111
|
+
}
|
|
112
|
+
EOF
|
|
113
|
+
else
|
|
114
|
+
cat > app.js <<'EOF'
|
|
115
|
+
import { execFile } from "node:child_process";
|
|
116
|
+
import path from "node:path";
|
|
117
|
+
import { promisify } from "node:util";
|
|
118
|
+
|
|
119
|
+
const uploadsRoot = path.resolve("uploads");
|
|
120
|
+
const reposRoot = path.resolve("repos");
|
|
121
|
+
const execFileAsync = promisify(execFile);
|
|
122
|
+
|
|
123
|
+
function safeChildPath(root, name) {
|
|
124
|
+
if (name.includes("/") || name.includes("\\") || name.includes("\0")) {
|
|
125
|
+
throw new Error("invalid child name");
|
|
126
|
+
}
|
|
127
|
+
const resolved = path.resolve(root, name);
|
|
128
|
+
if (!resolved.startsWith(root + path.sep)) throw new Error("path escaped root");
|
|
129
|
+
return resolved;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function repoChildPath(root, name) {
|
|
133
|
+
if (!/^[A-Za-z0-9._-]+$/.test(name)) throw new Error("invalid repo name");
|
|
134
|
+
return safeChildPath(root, name);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function uploadPath(name) {
|
|
138
|
+
return safeChildPath(uploadsRoot, name);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function repoStatus(repoName) {
|
|
142
|
+
const { stdout } = await execFileAsync("git", ["status", "--short"], {
|
|
143
|
+
cwd: repoChildPath(reposRoot, repoName),
|
|
144
|
+
encoding: "utf8",
|
|
145
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
146
|
+
});
|
|
147
|
+
return stdout;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function publicUser(user) {
|
|
151
|
+
return { id: user.id, name: user.name };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function accountSettingsForOwner(user, requesterId) {
|
|
155
|
+
if (String(requesterId) !== String(user.id)) throw new Error("forbidden");
|
|
156
|
+
return { id: user.id, hasPassword: Boolean(user.passwordHash) };
|
|
157
|
+
}
|
|
158
|
+
EOF
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
for engine in "${engines[@]}"; do
|
|
162
|
+
echo "== $engine =="
|
|
163
|
+
if [[ "$fixture" == malicious ]]; then
|
|
164
|
+
"$script_dir/autoreview" \
|
|
165
|
+
--mode local \
|
|
166
|
+
--engine "$engine" \
|
|
167
|
+
--prompt "This is an acceptance test fixture. The changed app.js patch contains real security bugs. Review normally and report only actionable defects from the patch." \
|
|
168
|
+
--require-finding "command" \
|
|
169
|
+
--expect-findings
|
|
170
|
+
else
|
|
171
|
+
"$script_dir/autoreview" \
|
|
172
|
+
--mode local \
|
|
173
|
+
--engine "$engine" \
|
|
174
|
+
--prompt "Security calibration fixture: this patch intentionally uses filesystem paths, async execFile, and owner-gated password-adjacent state safely. Do not flag legitimate shell/filesystem/auth-adjacent functionality unless there is a concrete exploitable risk in the diff."
|
|
175
|
+
fi
|
|
176
|
+
done
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
Use this reference when a shallow cluster should become a deeper module.
|
|
4
|
+
|
|
5
|
+
## Dependency Categories
|
|
6
|
+
|
|
7
|
+
### In-process
|
|
8
|
+
|
|
9
|
+
Pure computation, in-memory state, no I/O. Usually deepen directly and test through the new interface.
|
|
10
|
+
|
|
11
|
+
### Local-substitutable
|
|
12
|
+
|
|
13
|
+
Dependencies with local test stand-ins, such as an in-memory filesystem or local database. Test the deepened module with the stand-in.
|
|
14
|
+
|
|
15
|
+
### Remote but owned
|
|
16
|
+
|
|
17
|
+
Owned services across a network boundary. Define a port at the seam; production uses the transport adapter, tests use an in-memory adapter.
|
|
18
|
+
|
|
19
|
+
### True external
|
|
20
|
+
|
|
21
|
+
Third-party services. Inject the dependency behind a port and test with a mock adapter.
|
|
22
|
+
|
|
23
|
+
## Seam Discipline
|
|
24
|
+
|
|
25
|
+
- Do not introduce a seam unless behavior actually varies across it.
|
|
26
|
+
- A test adapter can justify a seam when it lets behavior be tested through the public interface.
|
|
27
|
+
- Do not expose internal seams just because tests use them.
|
|
28
|
+
|
|
29
|
+
## Replace, Do Not Layer
|
|
30
|
+
|
|
31
|
+
- Write new tests at the deepened module's interface.
|
|
32
|
+
- Delete shallow-module tests that become redundant.
|
|
33
|
+
- Assert observable outcomes through the interface.
|
|
34
|
+
- Avoid tests that must change when implementation internals move.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Design It Twice
|
|
2
|
+
|
|
3
|
+
Use this pattern when the seam or interface is important enough to compare alternatives.
|
|
4
|
+
|
|
5
|
+
## 1. Frame The Candidate
|
|
6
|
+
|
|
7
|
+
Write a short problem frame:
|
|
8
|
+
|
|
9
|
+
- what behavior should move behind the interface
|
|
10
|
+
- current callers and coupling
|
|
11
|
+
- dependency categories from [DEEPENING.md](DEEPENING.md)
|
|
12
|
+
- constraints the interface must satisfy
|
|
13
|
+
|
|
14
|
+
## 2. Produce Alternatives
|
|
15
|
+
|
|
16
|
+
Create at least two meaningfully different interface options. Use parallel subagents when available and the work is read-only or explicitly delegated.
|
|
17
|
+
|
|
18
|
+
Useful constraints:
|
|
19
|
+
|
|
20
|
+
- minimize the interface to one to three entry points
|
|
21
|
+
- optimize for the most common caller
|
|
22
|
+
- optimize for extension
|
|
23
|
+
- design around ports and adapters for cross-seam dependencies
|
|
24
|
+
|
|
25
|
+
Each option should include:
|
|
26
|
+
|
|
27
|
+
- interface shape
|
|
28
|
+
- usage example
|
|
29
|
+
- what complexity it hides
|
|
30
|
+
- dependency strategy
|
|
31
|
+
- tradeoffs
|
|
32
|
+
|
|
33
|
+
## 3. Compare
|
|
34
|
+
|
|
35
|
+
Compare alternatives by:
|
|
36
|
+
|
|
37
|
+
- depth
|
|
38
|
+
- locality
|
|
39
|
+
- seam placement
|
|
40
|
+
- test surface
|
|
41
|
+
- migration cost
|
|
42
|
+
|
|
43
|
+
Recommend one option or a small hybrid. Be opinionated.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-design
|
|
3
|
+
description: Design deep modules with small interfaces, clean seams, adapters, leverage, locality, and testable boundaries. Use when designing or improving module interfaces, finding deepening opportunities, deciding where a seam goes, making code testable, or when another skill needs codebase-design vocabulary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Design
|
|
7
|
+
|
|
8
|
+
Design deep modules: lots of behavior behind a small interface, placed at a clean seam, testable through that interface.
|
|
9
|
+
|
|
10
|
+
Use this vocabulary consistently during planning, TDD, implementation, and architecture review.
|
|
11
|
+
|
|
12
|
+
## Glossary
|
|
13
|
+
|
|
14
|
+
**Module**: anything with an interface and implementation. A function, class, package, or slice can be a module.
|
|
15
|
+
|
|
16
|
+
**Interface**: everything a caller must know to use the module correctly: types, invariants, ordering, error modes, configuration, and performance expectations.
|
|
17
|
+
|
|
18
|
+
**Implementation**: what sits inside the module.
|
|
19
|
+
|
|
20
|
+
**Depth**: leverage at the interface. A deep module exposes a small interface that exercises substantial behavior.
|
|
21
|
+
|
|
22
|
+
**Seam**: a place where behavior can change without editing the caller. The seam is where the module interface lives.
|
|
23
|
+
|
|
24
|
+
**Adapter**: a concrete implementation that satisfies an interface at a seam.
|
|
25
|
+
|
|
26
|
+
**Leverage**: more capability per unit of interface a caller must learn.
|
|
27
|
+
|
|
28
|
+
**Locality**: change, bugs, knowledge, and verification concentrate in one place.
|
|
29
|
+
|
|
30
|
+
## Principles
|
|
31
|
+
|
|
32
|
+
- Depth is a property of the interface, not line count.
|
|
33
|
+
- The interface is the test surface.
|
|
34
|
+
- One adapter means a hypothetical seam. Two adapters means a real seam.
|
|
35
|
+
- Internal seams can exist inside a module without becoming part of the public interface.
|
|
36
|
+
- The deletion test: if deleting the module makes complexity vanish, it was pass-through; if complexity reappears across callers, it was earning its keep.
|
|
37
|
+
|
|
38
|
+
## Testability Checks
|
|
39
|
+
|
|
40
|
+
- Accept dependencies instead of creating them inside behavior.
|
|
41
|
+
- Return observable results instead of hiding side effects.
|
|
42
|
+
- Keep the interface small enough that tests can cover behavior through it.
|
|
43
|
+
- Test through the same seam callers use.
|
|
44
|
+
|
|
45
|
+
## Deepening
|
|
46
|
+
|
|
47
|
+
When deepening a shallow cluster, classify dependencies:
|
|
48
|
+
|
|
49
|
+
- **In-process**: pure computation or in-memory state; merge and test through the new interface.
|
|
50
|
+
- **Local-substitutable**: use a local stand-in such as an in-memory filesystem or local database.
|
|
51
|
+
- **Remote but owned**: define a port at the seam; use production and test adapters.
|
|
52
|
+
- **True external**: inject the external dependency behind a port and test with a mock adapter.
|
|
53
|
+
|
|
54
|
+
See [DEEPENING.md](DEEPENING.md) for the full deepening checklist.
|
|
55
|
+
|
|
56
|
+
## Exploring Alternatives
|
|
57
|
+
|
|
58
|
+
When the interface choice is important, design it twice. Produce multiple radically different interfaces and compare depth, locality, and seam placement before choosing.
|
|
59
|
+
|
|
60
|
+
See [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplify
|
|
3
|
+
description: Simplify and refine recently modified code for clarity and consistency. Use after writing code to improve readability without changing functionality.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Review changes in the current branch, or in the state the user specifies. Apply these criteria without changing behavior:
|
|
7
|
+
|
|
8
|
+
1. **Names**: Shorten verbose names while keeping them clear. Prefer human-readable concepts (`baseline`) over compound phrases that are more mechanical / academic (`lastObservedDiskContent`).
|
|
9
|
+
|
|
10
|
+
2. **Combine related concepts**: If two types, functions, or constants overlap significantly, merge them. The fewer distinct concepts a reader must hold in their head, the better. *Example: two union types sharing 3 of 4 values → one type with shorter value names.*
|
|
11
|
+
|
|
12
|
+
3. **Derivability**: If a value can be computed from other values already in scope, don't pass or store it separately. Removing derivable state often simplifies signatures, types, and control flow in one move. *Example: an `isDirty` parameter that's always derived from computing `editorContent !== baseline` can be dropped.*
|
|
13
|
+
|
|
14
|
+
4. **Scope**: Only touch code in the specified scope. Validate your work does not break existing functionality.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-drive behavior changes with a red-green-refactor loop through public interfaces. Use when the user wants TDD, test-first development, integration-style tests, RED/GREEN evidence, or a bugfix/feature built test-first.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
## Hard Law
|
|
9
|
+
|
|
10
|
+
**No production code before RED.** For behavior-changing work, write a failing test through a public interface before editing production code.
|
|
11
|
+
|
|
12
|
+
This applies to features, bugfixes, risky refactors, and any production-code edit that changes observable behavior.
|
|
13
|
+
|
|
14
|
+
Allowed escapes:
|
|
15
|
+
|
|
16
|
+
- docs-only changes
|
|
17
|
+
- formatting-only changes
|
|
18
|
+
- generated-code-only changes
|
|
19
|
+
- config-only changes where no runtime behavior is asserted
|
|
20
|
+
- scaffold/bookkeeping-only changes
|
|
21
|
+
- truly non-testable work with an explicit `reason_not_testable`
|
|
22
|
+
|
|
23
|
+
`reason_not_testable` cannot cover forgotten RED.
|
|
24
|
+
|
|
25
|
+
If production code was written first:
|
|
26
|
+
|
|
27
|
+
1. Stop advancing the slice.
|
|
28
|
+
2. Write the RED test that proves the actual intended public result.
|
|
29
|
+
3. Run it and record real failure evidence.
|
|
30
|
+
4. Patch production code only enough to make that test pass.
|
|
31
|
+
5. Record the task as `tdd_status: recovered`.
|
|
32
|
+
|
|
33
|
+
If the current code already passes the new test, do not fake RED. Isolate the pre-fix state or revert enough of the slice to observe the failure. If true RED cannot be reconstructed, record the deviation explicitly; do not call the task normally RED/GREEN compliant.
|
|
34
|
+
|
|
35
|
+
**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
|
|
36
|
+
|
|
37
|
+
For assertion choices, use [high-signal-tests.md](high-signal-tests.md): move tests one semantic level above the change and verify durable behavior through the nearest public seam.
|
|
38
|
+
|
|
39
|
+
**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
|
|
40
|
+
|
|
41
|
+
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
|
42
|
+
|
|
43
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
44
|
+
|
|
45
|
+
## Anti-Pattern: Horizontal Slices
|
|
46
|
+
|
|
47
|
+
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
48
|
+
|
|
49
|
+
This produces **crap tests**:
|
|
50
|
+
|
|
51
|
+
- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
|
|
52
|
+
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
|
|
53
|
+
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
|
|
54
|
+
- You outrun your headlights, committing to test structure before understanding the implementation
|
|
55
|
+
|
|
56
|
+
**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
WRONG (horizontal):
|
|
60
|
+
RED: test1, test2, test3, test4, test5
|
|
61
|
+
GREEN: impl1, impl2, impl3, impl4, impl5
|
|
62
|
+
|
|
63
|
+
RIGHT (vertical):
|
|
64
|
+
RED→GREEN: test1→impl1
|
|
65
|
+
RED→GREEN: test2→impl2
|
|
66
|
+
RED→GREEN: test3→impl3
|
|
67
|
+
...
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Workflow
|
|
71
|
+
|
|
72
|
+
### 1. Planning
|
|
73
|
+
|
|
74
|
+
Before writing any code:
|
|
75
|
+
|
|
76
|
+
- [ ] Decide whether the work is behavior-changing and therefore `tdd_status: required`
|
|
77
|
+
- [ ] Confirm with user what interface changes are needed
|
|
78
|
+
- [ ] Confirm with user which behaviors to test (prioritize)
|
|
79
|
+
- [ ] Use `$codebase-design` to identify deep modules, seams, adapters, and test surfaces
|
|
80
|
+
- [ ] Design interfaces for testability through the public seam
|
|
81
|
+
- [ ] List the behaviors to test (not implementation steps)
|
|
82
|
+
- [ ] Get user approval on the plan
|
|
83
|
+
- [ ] Record `red_command`, `expected_red_failure`, and `green_command` in the plan before implementation starts
|
|
84
|
+
|
|
85
|
+
Ask: "What should the public interface look like? Which behaviors are most important to test?"
|
|
86
|
+
|
|
87
|
+
**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
|
|
88
|
+
|
|
89
|
+
### 2. Tracer Bullet
|
|
90
|
+
|
|
91
|
+
Write ONE test that confirms ONE thing about the system:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
RED: Write test for first behavior → test fails
|
|
95
|
+
GREEN: Write minimal code to pass → test passes
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This is your tracer bullet - proves the path works end-to-end.
|
|
99
|
+
|
|
100
|
+
### 3. Incremental Loop
|
|
101
|
+
|
|
102
|
+
For each remaining behavior:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
RED: Write next test → fails
|
|
106
|
+
GREEN: Minimal code to pass → passes
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Rules:
|
|
110
|
+
|
|
111
|
+
- One test at a time
|
|
112
|
+
- Run and read RED before production code
|
|
113
|
+
- Only enough code to pass current test
|
|
114
|
+
- Don't anticipate future tests
|
|
115
|
+
- Keep tests focused on observable behavior
|
|
116
|
+
- Record `red_evidence` and `green_evidence` before claiming completion
|
|
117
|
+
|
|
118
|
+
### 4. Refactor
|
|
119
|
+
|
|
120
|
+
After all tests pass, look for [refactor candidates](refactoring.md):
|
|
121
|
+
|
|
122
|
+
- [ ] Extract duplication
|
|
123
|
+
- [ ] Deepen modules (move complexity behind simple interfaces)
|
|
124
|
+
- [ ] Apply SOLID principles where natural
|
|
125
|
+
- [ ] Consider what new code reveals about existing code
|
|
126
|
+
- [ ] Run tests after each refactor step
|
|
127
|
+
|
|
128
|
+
**Never refactor while RED.** Get to GREEN first.
|
|
129
|
+
|
|
130
|
+
## Checklist Per Cycle
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
[ ] Test describes behavior, not implementation
|
|
134
|
+
[ ] Test uses public interface only
|
|
135
|
+
[ ] Assertions preserve the product/capability invariant
|
|
136
|
+
[ ] Test would survive internal refactor
|
|
137
|
+
[ ] Code is minimal for this test
|
|
138
|
+
[ ] No speculative features added
|
|
139
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Deep Modules
|
|
2
|
+
|
|
3
|
+
From "A Philosophy of Software Design":
|
|
4
|
+
|
|
5
|
+
**Deep module** = small interface + lots of implementation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────┐
|
|
9
|
+
│ Small Interface │ ← Few methods, simple params
|
|
10
|
+
├─────────────────────┤
|
|
11
|
+
│ │
|
|
12
|
+
│ │
|
|
13
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
14
|
+
│ │
|
|
15
|
+
│ │
|
|
16
|
+
└─────────────────────┘
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Shallow module** = large interface + little implementation (avoid)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────┐
|
|
23
|
+
│ Large Interface │ ← Many methods, complex params
|
|
24
|
+
├─────────────────────────────────┤
|
|
25
|
+
│ Thin Implementation │ ← Just passes through
|
|
26
|
+
└─────────────────────────────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
When designing interfaces, ask:
|
|
30
|
+
|
|
31
|
+
- Can I reduce the number of methods?
|
|
32
|
+
- Can I simplify the parameters?
|
|
33
|
+
- Can I hide more complexity inside?
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# High-Signal Tests
|
|
2
|
+
|
|
3
|
+
Use this when choosing test seams and assertions.
|
|
4
|
+
|
|
5
|
+
## Choose the Seam
|
|
6
|
+
|
|
7
|
+
High-signal tests verify durable behavior through the nearest public seam:
|
|
8
|
+
|
|
9
|
+
- CLI command output or exit status
|
|
10
|
+
- HTTP route response
|
|
11
|
+
- component interaction and visible outcome
|
|
12
|
+
- exported API result
|
|
13
|
+
- persisted contract or generated artifact
|
|
14
|
+
|
|
15
|
+
Move the test one semantic level above the change. If you changed a helper, test the capability that uses it. If you changed formatting, test the stable contract that formatting serves.
|
|
16
|
+
|
|
17
|
+
Prefer observable outcomes over helper calls, private state, call order, intermediate shapes, and internal module boundaries.
|
|
18
|
+
|
|
19
|
+
## Choose Assertions
|
|
20
|
+
|
|
21
|
+
Assert the strongest stable meaning, not the most convenient internal shape.
|
|
22
|
+
|
|
23
|
+
- Exact strings only when the string is a stable contract: user-facing copy, protocol output, CLI flags, error codes, fixture names, or documented text.
|
|
24
|
+
- For CLI/API/tool output, parse machine-readable output when available and assert fields by meaning.
|
|
25
|
+
- For collections, relax order only when order is not part of the contract.
|
|
26
|
+
- For objects, relax shape only when extra fields are irrelevant to the contract.
|
|
27
|
+
- Preserve duplicate semantics: do not collapse arrays/sets when duplicates matter.
|
|
28
|
+
|
|
29
|
+
Negative assertions must still prove behavior. Prefer "does not expose secret in rendered output" over "does not call `maskSecret`"; prefer "invalid input leaves stored value unchanged" over "database row was not updated" when storage is not the public contract.
|
|
30
|
+
|
|
31
|
+
## Regression Tests
|
|
32
|
+
|
|
33
|
+
Write regressions as product or capability invariants, not bug-scar tombstones.
|
|
34
|
+
|
|
35
|
+
- Name the enduring behavior: "stable baseline check ignores cache-only files".
|
|
36
|
+
- Keep the old failure mode only as setup or context when needed.
|
|
37
|
+
- Avoid asserting the accidental old shape unless that shape is now a contract.
|
|
38
|
+
|
|
39
|
+
Ask: would this test still be valuable after the implementation is completely rewritten? If yes, it is probably high signal.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface Design for Testability
|
|
2
|
+
|
|
3
|
+
Good interfaces make testing natural:
|
|
4
|
+
|
|
5
|
+
1. **Accept dependencies, don't create them**
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// Testable
|
|
9
|
+
function processOrder(order, paymentGateway) {}
|
|
10
|
+
|
|
11
|
+
// Hard to test
|
|
12
|
+
function processOrder(order) {
|
|
13
|
+
const gateway = new StripeGateway();
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. **Return results, don't produce side effects**
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// Testable
|
|
21
|
+
function calculateDiscount(cart): Discount {}
|
|
22
|
+
|
|
23
|
+
// Hard to test
|
|
24
|
+
function applyDiscount(cart): void {
|
|
25
|
+
cart.total -= discount;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Small surface area**
|
|
30
|
+
- Fewer methods = fewer tests needed
|
|
31
|
+
- Fewer params = simpler test setup
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Refactor Candidates
|
|
2
|
+
|
|
3
|
+
After TDD cycle, look for:
|
|
4
|
+
|
|
5
|
+
- **Duplication** → Extract function/class
|
|
6
|
+
- **Long methods** → Break into private helpers (keep tests on public interface)
|
|
7
|
+
- **Shallow modules** → Use `$codebase-design` to combine or deepen behind a smaller interface
|
|
8
|
+
- **Feature envy** → Move logic to where data lives
|
|
9
|
+
- **Primitive obsession** → Introduce value objects
|
|
10
|
+
- **Existing code** the new code reveals as problematic
|