ada-agent 0.1.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/LICENSE +21 -0
- package/README.md +256 -0
- package/bench/README.md +88 -0
- package/bench/swebench.mjs +242 -0
- package/bin/ada-server.mjs +6 -0
- package/bin/ada.mjs +7 -0
- package/docs/agent-loop.svg +66 -0
- package/docs/architecture.md +139 -0
- package/docs/architecture.svg +73 -0
- package/docs/connectors.md +48 -0
- package/docs/integrations.md +59 -0
- package/docs/login-flow.svg +56 -0
- package/docs/orchestration.md +45 -0
- package/package.json +64 -0
- package/skills/accessibility/SKILL.md +23 -0
- package/skills/add-logging/SKILL.md +23 -0
- package/skills/add-metrics/SKILL.md +23 -0
- package/skills/adr/SKILL.md +24 -0
- package/skills/aesthetic-direction/SKILL.md +24 -0
- package/skills/agent-loop/SKILL.md +23 -0
- package/skills/alerting/SKILL.md +23 -0
- package/skills/alpha-compositing/SKILL.md +23 -0
- package/skills/android-compose/SKILL.md +23 -0
- package/skills/angular-module/SKILL.md +23 -0
- package/skills/ansible-playbook/SKILL.md +24 -0
- package/skills/api-docs/SKILL.md +24 -0
- package/skills/app-store-prep/SKILL.md +23 -0
- package/skills/architecture-diagram/SKILL.md +21 -0
- package/skills/architecture-doc/SKILL.md +24 -0
- package/skills/audit-log/SKILL.md +23 -0
- package/skills/authz-review/SKILL.md +23 -0
- package/skills/aws-lambda/SKILL.md +24 -0
- package/skills/bash-script/SKILL.md +23 -0
- package/skills/batch/SKILL.md +23 -0
- package/skills/bisect/SKILL.md +23 -0
- package/skills/bounding-box/SKILL.md +24 -0
- package/skills/branch-cleanup/SKILL.md +23 -0
- package/skills/bundle-analyze/SKILL.md +23 -0
- package/skills/cache/SKILL.md +23 -0
- package/skills/call-graph/SKILL.md +23 -0
- package/skills/canvas-debug/SKILL.md +23 -0
- package/skills/cdn-setup/SKILL.md +23 -0
- package/skills/changelog/SKILL.md +24 -0
- package/skills/cherry-pick/SKILL.md +23 -0
- package/skills/ci-setup/SKILL.md +23 -0
- package/skills/cleanup/SKILL.md +23 -0
- package/skills/cli-tool/SKILL.md +23 -0
- package/skills/cloudformation/SKILL.md +23 -0
- package/skills/code-examples/SKILL.md +24 -0
- package/skills/code-review/SKILL.md +23 -0
- package/skills/color-palette/SKILL.md +24 -0
- package/skills/color-space/SKILL.md +24 -0
- package/skills/comment-why/SKILL.md +23 -0
- package/skills/commit/SKILL.md +26 -0
- package/skills/complexity-audit/SKILL.md +23 -0
- package/skills/component/SKILL.md +23 -0
- package/skills/component-library/SKILL.md +23 -0
- package/skills/connect-github/SKILL.md +20 -0
- package/skills/connect-mcp/SKILL.md +21 -0
- package/skills/connect-postgres/SKILL.md +20 -0
- package/skills/connect-remote/SKILL.md +23 -0
- package/skills/connect-slack/SKILL.md +20 -0
- package/skills/contract-audit/SKILL.md +25 -0
- package/skills/contributing/SKILL.md +23 -0
- package/skills/cpp-raii/SKILL.md +23 -0
- package/skills/cron-job/SKILL.md +23 -0
- package/skills/cv-preprocess/SKILL.md +24 -0
- package/skills/dark-mode/SKILL.md +24 -0
- package/skills/dashboard/SKILL.md +23 -0
- package/skills/dashboard-ui/SKILL.md +23 -0
- package/skills/data-export/SKILL.md +23 -0
- package/skills/data-validation/SKILL.md +23 -0
- package/skills/dataframe/SKILL.md +23 -0
- package/skills/db-index/SKILL.md +24 -0
- package/skills/dead-code/SKILL.md +23 -0
- package/skills/debug/SKILL.md +24 -0
- package/skills/deck-review/SKILL.md +24 -0
- package/skills/dedupe/SKILL.md +23 -0
- package/skills/dedupe-deps/SKILL.md +23 -0
- package/skills/dependency-audit/SKILL.md +23 -0
- package/skills/dependency-update/SKILL.md +23 -0
- package/skills/deploy/SKILL.md +23 -0
- package/skills/design-system/SKILL.md +24 -0
- package/skills/design-tokens/SKILL.md +24 -0
- package/skills/diagram-as-code/SKILL.md +24 -0
- package/skills/diff-explain/SKILL.md +23 -0
- package/skills/django-view/SKILL.md +23 -0
- package/skills/doc-lint/SKILL.md +24 -0
- package/skills/docker-compose/SKILL.md +23 -0
- package/skills/dockerize/SKILL.md +23 -0
- package/skills/docstrings/SKILL.md +23 -0
- package/skills/dotfiles/SKILL.md +23 -0
- package/skills/dpi-scaling/SKILL.md +23 -0
- package/skills/e2e-test/SKILL.md +23 -0
- package/skills/embeddings/SKILL.md +23 -0
- package/skills/empty-states/SKILL.md +23 -0
- package/skills/env-setup/SKILL.md +23 -0
- package/skills/erc20/SKILL.md +24 -0
- package/skills/error-tracking/SKILL.md +23 -0
- package/skills/estimate/SKILL.md +23 -0
- package/skills/etl-pipeline/SKILL.md +24 -0
- package/skills/eval-harness/SKILL.md +23 -0
- package/skills/exif-orientation/SKILL.md +23 -0
- package/skills/explain-code/SKILL.md +23 -0
- package/skills/express-middleware/SKILL.md +23 -0
- package/skills/extract-function/SKILL.md +23 -0
- package/skills/faq/SKILL.md +24 -0
- package/skills/fastapi-endpoint/SKILL.md +23 -0
- package/skills/favicon/SKILL.md +23 -0
- package/skills/feature-engineering/SKILL.md +23 -0
- package/skills/few-shot/SKILL.md +23 -0
- package/skills/find-owner/SKILL.md +23 -0
- package/skills/firmware-driver/SKILL.md +23 -0
- package/skills/fix-flaky-tests/SKILL.md +23 -0
- package/skills/flutter-widget/SKILL.md +23 -0
- package/skills/font-rendering/SKILL.md +23 -0
- package/skills/form-validation/SKILL.md +23 -0
- package/skills/format/SKILL.md +23 -0
- package/skills/game-loop/SKILL.md +23 -0
- package/skills/gas-optimize/SKILL.md +25 -0
- package/skills/gdpr-review/SKILL.md +24 -0
- package/skills/github-actions/SKILL.md +23 -0
- package/skills/glossary/SKILL.md +24 -0
- package/skills/go-idioms/SKILL.md +23 -0
- package/skills/gpu-profile/SKILL.md +23 -0
- package/skills/graphify/SKILL.md +21 -0
- package/skills/graphql-resolver/SKILL.md +23 -0
- package/skills/grpc-service/SKILL.md +23 -0
- package/skills/guardrails/SKILL.md +23 -0
- package/skills/healthcheck/SKILL.md +23 -0
- package/skills/heisenbug/SKILL.md +23 -0
- package/skills/helm-chart/SKILL.md +24 -0
- package/skills/hero-section/SKILL.md +23 -0
- package/skills/html-email/SKILL.md +24 -0
- package/skills/html-form/SKILL.md +23 -0
- package/skills/html-sanitize/SKILL.md +23 -0
- package/skills/html-table/SKILL.md +23 -0
- package/skills/html-to-pdf/SKILL.md +23 -0
- package/skills/http-client/SKILL.md +23 -0
- package/skills/i18n/SKILL.md +23 -0
- package/skills/i2c-spi/SKILL.md +23 -0
- package/skills/image-decode/SKILL.md +24 -0
- package/skills/image-memory/SKILL.md +24 -0
- package/skills/image-perf/SKILL.md +24 -0
- package/skills/image-pipeline/SKILL.md +24 -0
- package/skills/image-upload/SKILL.md +24 -0
- package/skills/infra-cost/SKILL.md +24 -0
- package/skills/input-validation/SKILL.md +23 -0
- package/skills/issue-template/SKILL.md +23 -0
- package/skills/java-streams/SKILL.md +23 -0
- package/skills/k8s-manifest/SKILL.md +23 -0
- package/skills/kotlin-coroutines/SKILL.md +23 -0
- package/skills/landing-page/SKILL.md +24 -0
- package/skills/laravel-controller/SKILL.md +23 -0
- package/skills/lazy-load/SKILL.md +23 -0
- package/skills/license-check/SKILL.md +23 -0
- package/skills/license-header/SKILL.md +23 -0
- package/skills/lint-fix/SKILL.md +23 -0
- package/skills/llm-cost/SKILL.md +23 -0
- package/skills/lockfile-fix/SKILL.md +23 -0
- package/skills/low-power/SKILL.md +23 -0
- package/skills/makefile/SKILL.md +23 -0
- package/skills/man-page/SKILL.md +24 -0
- package/skills/mcp-server/SKILL.md +23 -0
- package/skills/memory-leak/SKILL.md +23 -0
- package/skills/mermaid-diagram/SKILL.md +23 -0
- package/skills/meta-tags/SKILL.md +23 -0
- package/skills/micro-interactions/SKILL.md +23 -0
- package/skills/migration/SKILL.md +23 -0
- package/skills/migration-guide/SKILL.md +24 -0
- package/skills/mkdocs-setup/SKILL.md +24 -0
- package/skills/mobile-permissions/SKILL.md +23 -0
- package/skills/mock-api/SKILL.md +23 -0
- package/skills/modernize/SKILL.md +23 -0
- package/skills/monorepo-setup/SKILL.md +23 -0
- package/skills/motion-design/SKILL.md +23 -0
- package/skills/n-plus-one/SKILL.md +23 -0
- package/skills/naming-review/SKILL.md +23 -0
- package/skills/nextjs-route/SKILL.md +23 -0
- package/skills/nginx-config/SKILL.md +23 -0
- package/skills/ocr-debug/SKILL.md +24 -0
- package/skills/onboard/SKILL.md +23 -0
- package/skills/onboarding-map/SKILL.md +23 -0
- package/skills/open-pr/SKILL.md +24 -0
- package/skills/openapi/SKILL.md +23 -0
- package/skills/opencv-debug/SKILL.md +24 -0
- package/skills/orm-model/SKILL.md +23 -0
- package/skills/owasp-check/SKILL.md +24 -0
- package/skills/page-transitions/SKILL.md +23 -0
- package/skills/pagination/SKILL.md +23 -0
- package/skills/perf-optimize/SKILL.md +23 -0
- package/skills/perf-profile/SKILL.md +23 -0
- package/skills/physics/SKILL.md +23 -0
- package/skills/pitch-deck/SKILL.md +24 -0
- package/skills/pixel-diff/SKILL.md +23 -0
- package/skills/ponytail/SKILL.md +46 -0
- package/skills/postmortem/SKILL.md +24 -0
- package/skills/pptx-deck/SKILL.md +23 -0
- package/skills/pptx-export/SKILL.md +23 -0
- package/skills/pptx-from-markdown/SKILL.md +23 -0
- package/skills/pptx-template/SKILL.md +24 -0
- package/skills/pr-review/SKILL.md +24 -0
- package/skills/precommit/SKILL.md +23 -0
- package/skills/pricing-page/SKILL.md +23 -0
- package/skills/project-overview/SKILL.md +22 -0
- package/skills/prompt-template/SKILL.md +23 -0
- package/skills/property-test/SKILL.md +23 -0
- package/skills/protobuf/SKILL.md +23 -0
- package/skills/py-async/SKILL.md +23 -0
- package/skills/py-typing/SKILL.md +23 -0
- package/skills/query-optimize/SKILL.md +23 -0
- package/skills/rag-pipeline/SKILL.md +23 -0
- package/skills/rails-resource/SKILL.md +23 -0
- package/skills/rate-limit/SKILL.md +23 -0
- package/skills/react-hooks/SKILL.md +23 -0
- package/skills/react-native-screen/SKILL.md +23 -0
- package/skills/react-perf/SKILL.md +23 -0
- package/skills/readme/SKILL.md +24 -0
- package/skills/rebase/SKILL.md +24 -0
- package/skills/refactor/SKILL.md +23 -0
- package/skills/regression-test/SKILL.md +23 -0
- package/skills/release-notes/SKILL.md +24 -0
- package/skills/rename-symbol/SKILL.md +23 -0
- package/skills/repro/SKILL.md +23 -0
- package/skills/resolve-conflicts/SKILL.md +23 -0
- package/skills/responsive/SKILL.md +23 -0
- package/skills/rest-endpoint/SKILL.md +23 -0
- package/skills/retro/SKILL.md +23 -0
- package/skills/rtos-task/SKILL.md +23 -0
- package/skills/runbook/SKILL.md +25 -0
- package/skills/rust-borrow/SKILL.md +23 -0
- package/skills/rust-unsafe-audit/SKILL.md +23 -0
- package/skills/sanitize/SKILL.md +23 -0
- package/skills/schema-design/SKILL.md +23 -0
- package/skills/screenshot-debug/SKILL.md +22 -0
- package/skills/scroll-animation/SKILL.md +23 -0
- package/skills/secret-scan/SKILL.md +23 -0
- package/skills/security-audit/SKILL.md +23 -0
- package/skills/security-review/SKILL.md +23 -0
- package/skills/seed-data/SKILL.md +23 -0
- package/skills/self-review/SKILL.md +23 -0
- package/skills/semantic-html/SKILL.md +23 -0
- package/skills/semver-bump/SKILL.md +24 -0
- package/skills/shader/SKILL.md +23 -0
- package/skills/shader-debug/SKILL.md +23 -0
- package/skills/simplify-conditionals/SKILL.md +23 -0
- package/skills/sitemap/SKILL.md +23 -0
- package/skills/skeleton-loader/SKILL.md +23 -0
- package/skills/slide-charts/SKILL.md +24 -0
- package/skills/slide-outline/SKILL.md +23 -0
- package/skills/snapshot-update/SKILL.md +23 -0
- package/skills/solidity-contract/SKILL.md +25 -0
- package/skills/speaker-notes/SKILL.md +23 -0
- package/skills/spike/SKILL.md +23 -0
- package/skills/split-file/SKILL.md +23 -0
- package/skills/spring-controller/SKILL.md +23 -0
- package/skills/sprite-anim/SKILL.md +23 -0
- package/skills/sql-report/SKILL.md +23 -0
- package/skills/squash/SKILL.md +24 -0
- package/skills/ssl-setup/SKILL.md +23 -0
- package/skills/stacktrace/SKILL.md +23 -0
- package/skills/static-site/SKILL.md +24 -0
- package/skills/structured-logging/SKILL.md +23 -0
- package/skills/svelte-store/SKILL.md +23 -0
- package/skills/swiftui-view/SKILL.md +23 -0
- package/skills/tailwind-theme/SKILL.md +24 -0
- package/skills/tcp-server/SKILL.md +23 -0
- package/skills/tdd/SKILL.md +23 -0
- package/skills/terraform-module/SKILL.md +24 -0
- package/skills/test-coverage/SKILL.md +23 -0
- package/skills/texture-debug/SKILL.md +23 -0
- package/skills/threat-model/SKILL.md +23 -0
- package/skills/thumbnail/SKILL.md +24 -0
- package/skills/todo-scan/SKILL.md +23 -0
- package/skills/tool-definition/SKILL.md +23 -0
- package/skills/trace-flow/SKILL.md +23 -0
- package/skills/tracing/SKILL.md +23 -0
- package/skills/train-model/SKILL.md +24 -0
- package/skills/tree-shake/SKILL.md +23 -0
- package/skills/ts-generics/SKILL.md +23 -0
- package/skills/ts-strict/SKILL.md +23 -0
- package/skills/tui-app/SKILL.md +23 -0
- package/skills/tutorial/SKILL.md +24 -0
- package/skills/type-tighten/SKILL.md +23 -0
- package/skills/typography/SKILL.md +24 -0
- package/skills/ui-bug-repro/SKILL.md +23 -0
- package/skills/ui-polish/SKILL.md +24 -0
- package/skills/ui-review/SKILL.md +24 -0
- package/skills/vendor/SKILL.md +23 -0
- package/skills/visual-diff-ci/SKILL.md +24 -0
- package/skills/visual-regression/SKILL.md +23 -0
- package/skills/vue-composition/SKILL.md +23 -0
- package/skills/web-component/SKILL.md +23 -0
- package/skills/web-fonts/SKILL.md +24 -0
- package/skills/web3-frontend/SKILL.md +25 -0
- package/skills/webgl-debug/SKILL.md +23 -0
- package/skills/webhook/SKILL.md +23 -0
- package/skills/websocket/SKILL.md +23 -0
- package/skills/write-tests/SKILL.md +19 -0
- package/src/client/agent.ts +803 -0
- package/src/client/background.ts +39 -0
- package/src/client/checkpoint.ts +48 -0
- package/src/client/cli.ts +1253 -0
- package/src/client/compaction.ts +86 -0
- package/src/client/extensions.ts +83 -0
- package/src/client/hooks.ts +40 -0
- package/src/client/image.ts +26 -0
- package/src/client/lsp.ts +0 -0
- package/src/client/mcp.ts +276 -0
- package/src/client/models-dev.ts +52 -0
- package/src/client/pkg.ts +41 -0
- package/src/client/platform.ts +94 -0
- package/src/client/prompts.ts +47 -0
- package/src/client/render.ts +138 -0
- package/src/client/session.ts +107 -0
- package/src/client/settings.ts +86 -0
- package/src/client/skill-router.ts +79 -0
- package/src/client/skills.ts +199 -0
- package/src/client/snapshot.ts +56 -0
- package/src/client/telemetry.ts +24 -0
- package/src/client/todos.ts +23 -0
- package/src/client/tools.ts +756 -0
- package/src/client/tui-mode.ts +41 -0
- package/src/client/tui.ts +224 -0
- package/src/sdk/index.ts +36 -0
- package/src/selfcheck.ts +364 -0
- package/src/server/config.ts +58 -0
- package/src/server/credentials.ts +89 -0
- package/src/server/identity.ts +58 -0
- package/src/server/index.ts +113 -0
- package/src/server/oauth.ts +93 -0
- package/src/server/providers/adapter.ts +25 -0
- package/src/server/providers/anthropic.ts +189 -0
- package/src/server/providers/openai-compat.ts +76 -0
- package/src/server/providers/registry.ts +31 -0
- package/src/server/router.ts +29 -0
- package/src/server/sse.ts +20 -0
- package/src/shared/types.ts +20 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwind-theme
|
|
3
|
+
description: Set up Tailwind with a custom token-driven theme so utilities map to your design system, not defaults
|
|
4
|
+
category: ui-design
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tailwind Theme
|
|
8
|
+
|
|
9
|
+
Use this when a Tailwind project still looks like stock Tailwind — default grays, `blue-500`, `shadow-md` everywhere. The fix is wiring Tailwind to your tokens so utility classes carry your brand.
|
|
10
|
+
|
|
11
|
+
1. Define your palette/space/type/radius as CSS custom properties on `:root` (and a dark override), then point Tailwind at them. In v4, do this in CSS via `@theme { --color-accent: …; --radius-lg: …; }`.
|
|
12
|
+
2. Map semantic names into the theme: `bg-surface`, `text-muted`, `border-subtle`, `bg-accent` — so markup reads by role and a re-theme is a token edit, not a find-replace across components.
|
|
13
|
+
3. Replace, don't extend-and-ignore, the defaults you won't use: prune the stock gray ramp and arbitrary blues so nobody reaches for `text-gray-500` and bypasses your system.
|
|
14
|
+
4. Set a real type scale and `fontFamily` from your fonts; configure `--leading-*` and `--tracking-*` so `text-2xl` etc. carry intentional line-height, not Tailwind's generic defaults.
|
|
15
|
+
5. Build repeated patterns as components (React/Astro/Svelte) or `@apply` recipes for true primitives (`.btn`), not by copy-pasting 14 utility classes per button.
|
|
16
|
+
6. Lean on Tailwind's modern features intentionally: container queries (`@container`), `data-*`/`aria-*` variants for state, and the `dark:` variant driven by your `[data-theme]` strategy.
|
|
17
|
+
7. Add `prettier-plugin-tailwindcss` for canonical class order and an ESLint rule to flag arbitrary values (`w-[13px]`) that signal an off-system value.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Utilities must resolve to your tokens; if `bg-accent` doesn't exist, the theme isn't wired up.
|
|
21
|
+
- Prune unused default colors so the stock palette can't be used by accident.
|
|
22
|
+
- Extract a component or `@apply` recipe once a class string repeats; don't shotgun utilities.
|
|
23
|
+
- Arbitrary values (`p-[13px]`, `text-[#3a3a3a]`) are escape hatches — flag and minimize them.
|
|
24
|
+
- Drive `dark:` from the same token strategy as the rest of the system, not a separate color set.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tcp-server
|
|
3
|
+
description: Write a TCP or UDP server with correct framing, concurrency, timeouts, and graceful shutdown
|
|
4
|
+
category: networking
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TCP / UDP Server
|
|
8
|
+
|
|
9
|
+
Reach for this when implementing a custom wire protocol or a low-level network service below HTTP. Choose TCP for ordered, reliable streams; UDP for low-latency, loss-tolerant datagrams.
|
|
10
|
+
|
|
11
|
+
1. Bind and listen, then accept connections in a loop, handing each to its own handler (goroutine/thread/async task) so one slow client can't block others.
|
|
12
|
+
2. Define framing for TCP — length-prefix or a delimiter — because TCP is a byte stream with no message boundaries; never assume one read equals one message.
|
|
13
|
+
3. Read in a loop into a buffer until you have a full frame; handle partial reads, coalesced messages, and split messages across reads.
|
|
14
|
+
4. Set read/write/idle deadlines per connection so dead or stalled peers get closed instead of leaking.
|
|
15
|
+
5. For UDP, handle each datagram independently — no connection state, expect loss/reordering/duplication, and validate every packet's size and contents.
|
|
16
|
+
6. Implement graceful shutdown: stop accepting, signal handlers to drain, close listeners, and wait (with a timeout) for in-flight connections.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- TCP has no message boundaries — always frame explicitly; relying on read sizes is the classic bug.
|
|
20
|
+
- Cap per-message and total per-connection buffer sizes; an attacker sending a huge length prefix can OOM you.
|
|
21
|
+
- Always set socket deadlines; without them a half-open connection (peer vanished) hangs a handler forever.
|
|
22
|
+
- Limit concurrent connections (a semaphore/accept limiter) so the server degrades instead of falling over under load.
|
|
23
|
+
- For UDP, never trust the source address blindly — it's trivially spoofed; don't use it alone for auth or amplification-prone replies.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Drive a feature with a red-green-refactor loop, writing the failing test before any implementation
|
|
4
|
+
category: testing
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TDD
|
|
8
|
+
|
|
9
|
+
Reach for this when building a new feature or behavior and you want tests to define the contract before code exists.
|
|
10
|
+
|
|
11
|
+
1. Pick the smallest next behavior and write one test that asserts it; do not write implementation yet.
|
|
12
|
+
2. Run the test and confirm it fails for the expected reason (assertion, not a typo or import error) — this is RED.
|
|
13
|
+
3. Write the minimum code to make that test pass; resist adding anything the test doesn't demand.
|
|
14
|
+
4. Run the full test file and confirm GREEN; if other tests broke, fix them before moving on.
|
|
15
|
+
5. Refactor names, duplication, and structure with tests green as a safety net; re-run after each change.
|
|
16
|
+
6. Commit the green increment, then loop back to the next behavior.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- One behavior per cycle; never write a second test while the first is red.
|
|
20
|
+
- A test that passes on its first run is suspect — make it fail first to prove it tests something.
|
|
21
|
+
- Keep implementation minimal; "fake it till you make it" (hardcode, then generalize) is valid early.
|
|
22
|
+
- Refactor only on green, never while red, and never mix a refactor with new behavior in one commit.
|
|
23
|
+
- If a test is hard to write, treat it as a design smell and reconsider the interface before forcing it.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: terraform-module
|
|
3
|
+
description: Write a reusable Terraform module with clean inputs, outputs, and pinned providers
|
|
4
|
+
category: cloud
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Terraform Module
|
|
8
|
+
|
|
9
|
+
Reach for this when you need to package infrastructure (a VPC, a bucket, an ECS service) so it can be called repeatedly with different inputs instead of copy-pasted HCL.
|
|
10
|
+
|
|
11
|
+
1. Lay out the standard files: `main.tf`, `variables.tf`, `outputs.tf`, `versions.tf`, and `README.md` in the module directory.
|
|
12
|
+
2. Pin Terraform and provider versions in `versions.tf` with `required_version` and `required_providers` (use `~>` constraints, not floating).
|
|
13
|
+
3. Declare every input in `variables.tf` with `type`, `description`, and a sensible `default` only where optional; add `validation` blocks for constrained values.
|
|
14
|
+
4. Build resources in `main.tf` using only variables and locals — never hardcode account IDs, regions, names, or CIDRs.
|
|
15
|
+
5. Expose the IDs/ARNs/endpoints callers will need in `outputs.tf`, each with a `description`.
|
|
16
|
+
6. Run `terraform fmt -recursive`, `terraform validate`, and `terraform-docs markdown table . > README.md` before committing.
|
|
17
|
+
7. Add an `examples/` subdir with a minimal working invocation that `init`/`plan` cleanly.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- A module must not configure `provider` blocks or backends — that belongs to the root caller.
|
|
21
|
+
- Name resources `this` (or by role) and rely on the module name for namespacing; avoid baking the module name into every resource.
|
|
22
|
+
- Mark secrets `sensitive = true` and never write them to `outputs` in plaintext.
|
|
23
|
+
- Don't use `count`/`for_each` on whole modules to fake conditional creation if a `create` bool + per-resource `count` is clearer.
|
|
24
|
+
- Keep provider and state concerns out; a module should be importable into any backend.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-coverage
|
|
3
|
+
description: Find untested code paths in a module and add focused tests that exercise the real risk
|
|
4
|
+
category: testing
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Test Coverage
|
|
8
|
+
|
|
9
|
+
Use when a module is under-tested and you need to raise meaningful coverage, not just the percentage.
|
|
10
|
+
|
|
11
|
+
1. Run the suite with coverage reporting enabled and read the per-file line/branch numbers for the target module.
|
|
12
|
+
2. Open the coverage report and locate uncovered lines, especially error handling, early returns, and conditional branches.
|
|
13
|
+
3. Rank gaps by risk: prioritize logic that can fail in production over trivial getters or generated code.
|
|
14
|
+
4. Write a test for each high-risk path, naming it after the behavior it pins (not "test_function_2").
|
|
15
|
+
5. Cover the negative and edge cases — empty inputs, nulls, boundary values, thrown exceptions — not just the happy path.
|
|
16
|
+
6. Re-run coverage to confirm the lines are hit, then sanity-check that each new test actually asserts something.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Chase uncovered branches and behaviors, not a coverage number; 100% line coverage with weak asserts is worthless.
|
|
20
|
+
- Do not add tests that only call code without asserting on results or side effects.
|
|
21
|
+
- Skip testing third-party libraries and trivial pass-throughs; focus on your own logic.
|
|
22
|
+
- A surprising uncovered path often signals dead code — confirm it is reachable before testing it.
|
|
23
|
+
- Keep each test isolated; do not rely on order or shared mutable state to hit a path.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: texture-debug
|
|
3
|
+
description: Debug texture loading, UV mapping, mipmaps, wrapping and seams — black, blurry, repeated, or flipped textures
|
|
4
|
+
category: graphics
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Texture Debug
|
|
8
|
+
|
|
9
|
+
Reach for this when a textured surface shows black, solid color, blur, visible seams, repeats, or upside-down/mirrored image.
|
|
10
|
+
|
|
11
|
+
1. Confirm the image actually loaded before upload: textures uploaded from an unloaded `<img>`/fetch are blank. Log dimensions and bind from the `onload`/awaited decode, not synchronously.
|
|
12
|
+
2. Swap in a known-good debug texture (a 2x2 checker or magenta/green stripes generated in code). If the checker maps correctly, the bug is your asset or its load; if it's also wrong, the bug is UVs/sampling.
|
|
13
|
+
3. For black or solid-color textures in WebGL/GL, check the NPOT (non-power-of-two) rule: NPOT textures require `CLAMP_TO_EDGE` wrapping and `LINEAR`/`NEAREST` (no mipmap) min filter, or they sample black. Either pad to POT or set those params.
|
|
14
|
+
4. For blur/shimmer at distance or on minification, you likely have no mipmaps: call `generateMipmap` after upload and use a `*_MIPMAP_*` min filter. For oversharp/aliased edges at angles, enable anisotropic filtering if available.
|
|
15
|
+
5. For repeating or stretched-edge artifacts, audit wrap mode: `REPEAT` tiles, `CLAMP_TO_EDGE` smears the border, `MIRRORED_REPEAT` flips. Pick to match intent and check UVs aren't outside [0,1] unintentionally.
|
|
16
|
+
6. For flipped/mirrored images, check the Y convention (`UNPACK_FLIP_Y_WEBGL` or a flipped UV.y) and that your atlas/UV offsets use top-left vs bottom-left origin consistently.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Never bind a texture before its source image has finished decoding — upload in the load callback.
|
|
20
|
+
- NPOT textures + `REPEAT` or mipmap filtering = black sample; clamp + non-mip filter, or resize to POT.
|
|
21
|
+
- `generateMipmap` must run after the base level is uploaded and again on any base-level change.
|
|
22
|
+
- Set min and mag filters explicitly; defaults vary and the mipmap default needs mipmaps to exist.
|
|
23
|
+
- Seams between tiles usually mean `REPEAT` where you wanted `CLAMP_TO_EDGE`, or half-texel UV bleed — inset UVs by half a texel.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threat-model
|
|
3
|
+
description: Produce a quick STRIDE-based threat model for a feature with ranked threats and mitigations
|
|
4
|
+
category: security
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Threat Model
|
|
8
|
+
|
|
9
|
+
Use this when designing or reviewing a feature to surface what can go wrong before it ships — a lightweight, decision-ready threat model.
|
|
10
|
+
|
|
11
|
+
1. Scope it: state the feature, its assets (data, money, capabilities), the actors (users, admins, external services, attackers), and the trust boundaries.
|
|
12
|
+
2. Sketch the data flow: entry points, components, data stores, and where data crosses a trust boundary (these are the interesting spots).
|
|
13
|
+
3. Enumerate threats per boundary using STRIDE (Spoofing, Tampering, Repudiation, Info disclosure, Denial of service, Elevation of privilege).
|
|
14
|
+
4. Rank each threat by likelihood x impact; drop the implausible ones to keep the model actionable.
|
|
15
|
+
5. Assign each top threat a mitigation (control, design change, or accepted-risk) and who/what enforces it.
|
|
16
|
+
6. List residual risks and any assumptions the design depends on (e.g. "TLS terminates upstream", "tenant id is trusted from gateway").
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Keep it lean and decision-oriented — a one-page model that ships beats an exhaustive one that does not.
|
|
20
|
+
- Anchor on trust boundaries; most real threats live where data or control crosses one.
|
|
21
|
+
- Every retained threat needs an owner-able mitigation or an explicit accepted-risk note.
|
|
22
|
+
- State assumptions plainly — an unvalidated assumption is a future vulnerability.
|
|
23
|
+
- Revisit the model when the feature's data flow or trust boundaries change.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thumbnail
|
|
3
|
+
description: Generate and debug thumbnails and responsive srcset — aspect ratio, sharpness, format, and the picked source
|
|
4
|
+
category: visual-test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Thumbnail
|
|
8
|
+
|
|
9
|
+
Reach for this when thumbnails come out stretched, blurry, wrong-format, or the browser picks the wrong `srcset` candidate.
|
|
10
|
+
|
|
11
|
+
1. Reproduce against the actual source asset: pull the original, note its real dimensions and aspect ratio, and run the resize step in isolation.
|
|
12
|
+
2. Diagnose distortion: stretched output means the resize ignored aspect ratio — decide fit (`cover` crop vs `contain` letterbox) explicitly and apply it.
|
|
13
|
+
3. Diagnose blur: re-encoding at low quality, upscaling a small source, or a bad downscale filter — downscale with a quality filter (Lanczos/area) and never upscale past the source.
|
|
14
|
+
4. Pick the format deliberately: serve AVIF/WebP with a JPEG/PNG fallback; debug `<picture>`/`type` negotiation by checking which candidate the browser actually requested.
|
|
15
|
+
5. Build the `srcset` with real intrinsic widths and a correct `sizes` attribute, then verify in devtools (Network → the chosen file, `currentSrc`) that the expected candidate loads at each DPR/viewport.
|
|
16
|
+
6. Confirm visually: render each generated size at its display box and diff against the source crop to catch off-by-one cropping or wrong gravity.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Decide and document fit mode (cover vs contain) per use case — silent stretching is the most common thumbnail bug.
|
|
20
|
+
- Never upscale beyond the source resolution; generate only sizes ≤ original and let CSS handle the rest.
|
|
21
|
+
- `sizes` is required for `srcset` width descriptors to work — a missing/wrong `sizes` makes the browser fetch the largest candidate every time.
|
|
22
|
+
- Use a proper downscaling filter and a sane quality setting; default/fast filters produce mushy thumbnails.
|
|
23
|
+
- Verify the *picked* source via `img.currentSrc` and the Network tab, not by guessing from the markup.
|
|
24
|
+
- Generate at device pixel ratios (1x/2x/3x) and cache by content hash so a re-upload busts stale thumbnails.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: todo-scan
|
|
3
|
+
description: Collect TODO/FIXME/HACK comments across the codebase into a triaged, actionable backlog
|
|
4
|
+
category: productivity
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Todo Scan
|
|
8
|
+
|
|
9
|
+
Reach for this when you want a single inventory of the inline debt scattered through code comments, turned into a backlog you can prioritize instead of a pile of grep hits.
|
|
10
|
+
|
|
11
|
+
1. Grep the tree for the marker set: `TODO`, `FIXME`, `HACK`, `XXX`, `BUG`, `OPTIMIZE` (case-insensitive), excluding `node_modules`, `vendor`, build, and lockfiles.
|
|
12
|
+
2. For each hit capture file path, line number, the marker type, and the full comment text plus a line or two of surrounding context.
|
|
13
|
+
3. Normalize duplicates and multi-line comments into one entry each; drop commented-out code and false positives (e.g. the word "todo" in a string or doc).
|
|
14
|
+
4. Tag every entry with a rough severity (blocker / should-fix / nice-to-have) and a guessed area (auth, db, ui, build, tests) from the path.
|
|
15
|
+
5. Sort by severity then area, and emit a Markdown table: marker, severity, location (`path:line`), summary.
|
|
16
|
+
6. Surface any entry that names a person, ticket id, or a date that has already passed — those are the highest-signal items.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Report `path:line` for every item so it is click-to-open; never paraphrase a location.
|
|
20
|
+
- Do not edit, resolve, or delete the comments — this skill only inventories them.
|
|
21
|
+
- Skip generated/vendored directories and minified files or the list drowns in noise.
|
|
22
|
+
- Distinguish marker types in output; a `FIXME` is not the same priority as an aspirational `TODO`.
|
|
23
|
+
- If the scan returns more than ~50 items, summarize counts per area first, then list the top items rather than dumping everything.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tool-definition
|
|
3
|
+
description: Define a new agent tool/function schema the LLM can call reliably
|
|
4
|
+
category: agent-llm
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tool Definition
|
|
8
|
+
|
|
9
|
+
Use this when adding a callable tool/function to an agent so the model invokes it with correct arguments and at the right time.
|
|
10
|
+
|
|
11
|
+
1. Name the tool as a clear verb_noun (e.g. `search_orders`, `create_invoice`); the name is the model's primary cue for when to call it.
|
|
12
|
+
2. Write a description that states what it does, when to use it, and when NOT to use it — this matters more than the schema for routing accuracy.
|
|
13
|
+
3. Define a JSON-Schema for inputs: type every field, mark required vs optional, use enums for fixed choices, and add per-field descriptions.
|
|
14
|
+
4. Constrain inputs to reduce ambiguity — prefer enums over free text, give formats (date, uri) and examples in field descriptions.
|
|
15
|
+
5. Specify the return shape and keep it compact: return only what the model needs downstream, not raw dumps.
|
|
16
|
+
6. Test with adversarial prompts (ambiguous, missing args, wrong tool) and confirm the model selects correctly and fills required fields.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- One tool = one job; if the description needs "and", split it into two tools.
|
|
20
|
+
- Make required fields truly required; optional-but-important fields get a description telling the model when to set them.
|
|
21
|
+
- Avoid overlapping tools with near-identical descriptions — the model will pick at random; disambiguate explicitly.
|
|
22
|
+
- Echo back enough context in the result for multi-step reasoning, but truncate large payloads (paginate or summarize).
|
|
23
|
+
- Never trust model-supplied arguments for security decisions; re-validate and authorize server-side.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trace-flow
|
|
3
|
+
description: Trace a request or data flow end-to-end across layers, from entry point to final effect
|
|
4
|
+
category: code-understanding
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Trace Flow
|
|
8
|
+
|
|
9
|
+
Use to follow a single request, event, or piece of data through the system — e.g. "what happens when a user submits this form?" — across the layers it touches.
|
|
10
|
+
|
|
11
|
+
1. Find the entry point: the route, handler, listener, CLI command, or subscriber where the flow begins.
|
|
12
|
+
2. Step forward through each call, recording the file, function, and what transforms the data at that hop.
|
|
13
|
+
3. Cross boundaries deliberately: middleware, service calls, queues, DB reads/writes, external APIs, and async/await or callback handoffs.
|
|
14
|
+
4. Track the data shape as it changes — note where it is validated, mapped, enriched, or persisted.
|
|
15
|
+
5. Identify the terminal effect: the response returned, row written, message published, or file emitted.
|
|
16
|
+
6. Lay out the path as an ordered list of hops with file:line, and mark branch points, retries, and error/rollback paths.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Async boundaries break the call stack — connect producers to consumers by the queue/topic/event name, not by control flow.
|
|
20
|
+
- Note where the flow forks (conditionals, fan-out) instead of silently following one branch.
|
|
21
|
+
- Call out side effects along the way (logging, caching, metrics) separately from the main data path.
|
|
22
|
+
- If a hop dispatches dynamically and you cannot resolve the target, say so rather than guessing.
|
|
23
|
+
- Anchor every hop to a concrete file:line so the reader can follow along.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tracing
|
|
3
|
+
description: Add distributed tracing spans with OpenTelemetry to follow requests across services
|
|
4
|
+
category: observability
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tracing
|
|
8
|
+
|
|
9
|
+
Use this when a request crosses service or async boundaries and you need to see where time goes and how calls fan out.
|
|
10
|
+
|
|
11
|
+
1. Install the OpenTelemetry SDK plus auto-instrumentations for your HTTP/DB/queue libraries, and configure an OTLP exporter to your collector or backend (Jaeger, Tempo, Honeycomb).
|
|
12
|
+
2. Set a `service.name` resource attribute and a sampler (parent-based, with a ratio for high-traffic services) in the tracer provider.
|
|
13
|
+
3. Enable auto-instrumentation first — it covers inbound/outbound HTTP, DB clients, and frameworks for free; verify spans appear before adding manual ones.
|
|
14
|
+
4. Add manual spans only around meaningful units of work the libraries don't cover (business logic, batch steps), naming them `verb.noun` (`charge.card`).
|
|
15
|
+
5. Attach attributes for high-signal context (`tenant.id`, `job.kind`, row counts) and record exceptions with `span.recordException` + set status `ERROR`.
|
|
16
|
+
6. Ensure W3C `traceparent` propagation across service calls and into async work (queues, background jobs) so traces stay connected; verify an end-to-end trace links all hops.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- One trace per logical request; don't start a new root span mid-request — continue the propagated context.
|
|
20
|
+
- Keep span names low-cardinality (no IDs in the name — put IDs in attributes).
|
|
21
|
+
- Always `end()` spans, including on error paths; use a try/finally or scoped helper.
|
|
22
|
+
- Sample at the head consistently across services so traces aren't half-recorded.
|
|
23
|
+
- Never put secrets, full request bodies, or PII in span attributes.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: train-model
|
|
3
|
+
description: Scaffold a reproducible model training script with proper splits and checkpoints
|
|
4
|
+
category: data-ml
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Train Model
|
|
8
|
+
|
|
9
|
+
Use when setting up a training run for a classical ML or deep learning model and you want a reproducible, debuggable script rather than a notebook mess.
|
|
10
|
+
|
|
11
|
+
1. Split data into train/validation/test up front with a fixed seed; for time series or grouped data, split by time/group to prevent leakage.
|
|
12
|
+
2. Fit all preprocessing (scaling, encoding, imputation) on train only, then apply to val/test — wrap in a pipeline so it travels with the model.
|
|
13
|
+
3. Set and log seeds, hyperparameters, data version, and code commit so the run is reproducible.
|
|
14
|
+
4. Train with a small subset first to confirm the loss decreases and the script runs end-to-end before the full run.
|
|
15
|
+
5. Track train and validation metrics each epoch/iteration; checkpoint the best model by the validation metric, not train loss.
|
|
16
|
+
6. Add early stopping or a fixed budget, then evaluate the final model on the untouched test set exactly once.
|
|
17
|
+
7. Save the model, the fitted preprocessing, and a metrics summary as artifacts.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- The test set is touched once, at the very end — never for tuning or model selection.
|
|
21
|
+
- Fit preprocessing on train only; fitting on the full dataset leaks the target into training.
|
|
22
|
+
- Always run an overfit-one-batch smoke test before committing to a long run.
|
|
23
|
+
- Log seed, config, and data version with every run so results can be reproduced.
|
|
24
|
+
- Select and checkpoint on the validation metric; report the held-out test metric as the headline number.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tree-shake
|
|
3
|
+
description: Eliminate unused imports and exports so dead code is dropped from the bundle
|
|
4
|
+
category: dependencies
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tree Shake
|
|
8
|
+
|
|
9
|
+
Reach for this when dead code is shipping because imports/exports aren't being eliminated by the bundler.
|
|
10
|
+
|
|
11
|
+
1. Run a static analyzer (`knip`, `ts-prune`, ESLint `no-unused-vars`/`unused-imports`) to list unused imports and unreferenced exports.
|
|
12
|
+
2. Remove unused imports and delete or stop exporting symbols nothing consumes.
|
|
13
|
+
3. Replace whole-module/namespace imports with named imports so the bundler can drop the rest.
|
|
14
|
+
4. Break up barrel (`index.ts` re-export) files or mark them side-effect-free so importing one symbol doesn't pull the whole directory.
|
|
15
|
+
5. Set `"sideEffects": false` (or an explicit file list) in package.json and keep the build target ESM.
|
|
16
|
+
6. Rebuild and confirm the removed code is gone from the output via the bundle analyzer.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Don't remove an export that's part of the public API just because it's unused internally.
|
|
20
|
+
- Watch for imports kept only for side effects (polyfills, CSS, registrations) — flagging `sideEffects: false` wrongly drops them.
|
|
21
|
+
- Named imports tree-shake; `import * as x` and default-object imports usually don't.
|
|
22
|
+
- Barrel files defeat tree-shaking in many bundlers — import from the source module directly.
|
|
23
|
+
- Verify the result in the actual build output, not just the linter — analysis and bundling differ.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ts-generics
|
|
3
|
+
description: Improve TypeScript generics and inference so call sites stay type-safe without manual annotations
|
|
4
|
+
category: languages
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ts Generics
|
|
8
|
+
|
|
9
|
+
Reach for this when an API forces callers to annotate types manually, returns `any`, or loses the relationship between input and output types.
|
|
10
|
+
|
|
11
|
+
1. Identify where types are flowing through: a function/class that takes a value and should return a type derived from it is a generics candidate.
|
|
12
|
+
2. Introduce type parameters that get inferred from arguments (`function get<T>(obj: T, key: keyof T)`) so callers never pass `<...>` explicitly.
|
|
13
|
+
3. Constrain parameters with `extends` (`<T extends Record<string, unknown>>`) to enable property access and reject bad inputs at the call site.
|
|
14
|
+
4. Use conditional and mapped types (`T extends U ? A : B`, `{ [K in keyof T]: ... }`) and `infer` to transform types instead of widening to `any`.
|
|
15
|
+
5. Preserve literal types where they matter with `const` type parameters (`<const T>`) or `as const`, so unions don't collapse to `string`/`number`.
|
|
16
|
+
6. Verify inference with type-level tests (`expectTypeError` / `// @ts-expect-error`) and by hovering real call sites — confirm no caller needs explicit args.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- A generic that appears only once in a signature is usually pointless — each type parameter should connect at least two positions (input↔output).
|
|
20
|
+
- Constrain before you access: you can't read `t.id` off an unconstrained `T` — add `extends { id: ... }`.
|
|
21
|
+
- Don't over-engineer; if a plain union or overload is clearer than a conditional type, use it.
|
|
22
|
+
- Keep error messages legible — deeply nested conditional types produce inscrutable errors; name intermediate types as aliases.
|
|
23
|
+
- Default type parameters (`<T = unknown>`) for ergonomics, but never default to `any`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ts-strict
|
|
3
|
+
description: Enable TypeScript strict mode and fix the resulting type errors safely
|
|
4
|
+
category: languages
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ts Strict
|
|
8
|
+
|
|
9
|
+
Use this when turning on `strict` (or its sub-flags) in a TypeScript project that compiled loosely, and you need to clear the error wave without papering over real bugs.
|
|
10
|
+
|
|
11
|
+
1. Enable flags incrementally in `tsconfig.json`: start with `strictNullChecks`, then `noImplicitAny`, then `strictFunctionTypes`, rather than flipping `strict: true` blind.
|
|
12
|
+
2. Run `tsc --noEmit` and triage by file/error code; fix the highest-frequency code (often `TS2532` undefined / `TS7006` implicit any) first.
|
|
13
|
+
3. For null/undefined errors, narrow with guards (`if (x == null) return`), optional chaining `?.`, or nullish coalescing `??` — not `!` non-null assertions by default.
|
|
14
|
+
4. Replace implicit `any` with real types or `unknown` plus a narrowing check; type function params and exported signatures explicitly.
|
|
15
|
+
5. Fix unsafe index access (`noUncheckedIndexedAccess`) by handling the `undefined` case from `arr[i]` and `map[key]`.
|
|
16
|
+
6. Re-run `tsc --noEmit` until clean, then commit each flag separately so regressions are bisectable.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Prefer `unknown` over `any` when a type is genuinely open — it forces a check at the use site.
|
|
20
|
+
- Use `!` and `as` casts sparingly; each one is a place the compiler can no longer protect you — leave a comment justifying it.
|
|
21
|
+
- Don't add `// @ts-ignore`/`// @ts-expect-error` to bulk-clear errors; reserve them for known upstream typing bugs and prefer `@ts-expect-error` so they self-remove when fixed.
|
|
22
|
+
- Keep `tsconfig` changes and code fixes in lockstep; turning on a flag without fixing its errors breaks the build for everyone.
|
|
23
|
+
- Don't loosen library types you don't own — wrap them in a typed adapter instead.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tui-app
|
|
3
|
+
description: Build a terminal UI app with a render loop, input handling, and clean teardown using ratatui, ink, or textual
|
|
4
|
+
category: shell
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TUI App
|
|
8
|
+
|
|
9
|
+
Reach for this when building an interactive full-screen terminal application — dashboards, pickers, file browsers — with keyboard navigation and live updates.
|
|
10
|
+
|
|
11
|
+
1. Pick a framework: Rust → `ratatui` + `crossterm`, Node → `ink` (React-style), Python → `textual` or `urwid`.
|
|
12
|
+
2. Model state explicitly (a single app struct/store) and render the whole UI as a pure function of that state each frame — never mutate widgets imperatively from scattered handlers.
|
|
13
|
+
3. Run an event loop that blocks on input/timer events, updates state, then redraws; keep heavy or blocking work (I/O, network) off the UI thread via async tasks or a worker channel.
|
|
14
|
+
4. On startup enter raw mode and the alternate screen; on exit — including panics and Ctrl-C — restore the terminal so the user's shell isn't left corrupted.
|
|
15
|
+
5. Handle resize events and recompute layout; never hardcode width/height, and degrade gracefully on tiny terminals.
|
|
16
|
+
6. Provide clear key hints and a quit binding (`q`/Ctrl-C), and test the render-from-state logic without a real TTY.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Always restore the terminal on exit: wrap teardown in a guard/`defer`/panic hook so a crash mid-frame doesn't leave a broken shell.
|
|
20
|
+
- Keep the event loop non-blocking; spawn long tasks elsewhere and feed results back as events, or the UI freezes.
|
|
21
|
+
- Throttle redraws (only on state change or a frame tick) instead of busy-looping the CPU at full speed.
|
|
22
|
+
- Don't print to stdout/stderr while in alternate-screen mode — it scrambles the display; route logs to a file.
|
|
23
|
+
- Make every action keyboard-reachable and show the active keymap; assume no mouse.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tutorial
|
|
3
|
+
description: Write a getting-started tutorial that takes a new user from install to a first working result
|
|
4
|
+
category: docs
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tutorial
|
|
8
|
+
|
|
9
|
+
Use this to create a guided, linear walkthrough that gets a newcomer to a small success quickly. Unlike reference docs, a tutorial is a single happy path the reader follows top to bottom.
|
|
10
|
+
|
|
11
|
+
1. Pick one concrete end goal a beginner can reach in 10-15 minutes ("send your first request", "render a page").
|
|
12
|
+
2. State prerequisites up front: tools, accounts, versions the reader must have.
|
|
13
|
+
3. Break the path into numbered steps; each step is one action with the exact command or code to paste.
|
|
14
|
+
4. After each step, show the expected output so the reader can confirm they're on track.
|
|
15
|
+
5. End with a working result, then a short "next steps" pointing to deeper docs.
|
|
16
|
+
6. Add a brief troubleshooting note for the one or two failures beginners actually hit.
|
|
17
|
+
7. Run the whole tutorial from a clean environment yourself and fix anything that doesn't work verbatim.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- One linear happy path — defer options, edge cases, and theory to reference docs.
|
|
21
|
+
- Every code block must be copy-pasteable and produce the shown output.
|
|
22
|
+
- Show expected output after steps so readers can self-correct.
|
|
23
|
+
- Test it end to end from a fresh setup; a tutorial that fails at step 3 is worse than none.
|
|
24
|
+
- Keep prerequisites honest and minimal; don't assume tools the reader hasn't installed.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: type-tighten
|
|
3
|
+
description: Strengthen types and remove anys/implicit untyped code in TS or mypy
|
|
4
|
+
category: refactoring
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Type Tighten
|
|
8
|
+
|
|
9
|
+
Use when types are loose, missing, or littered with `any`/`Any`, letting bugs slip past the checker. The goal is precise types that document intent and catch errors.
|
|
10
|
+
|
|
11
|
+
1. Turn on or raise strictness incrementally (`strict`, `noImplicitAny`; mypy `--strict` / `disallow-untyped-defs`) and read the new errors.
|
|
12
|
+
2. Replace `any`/`Any` with concrete types, unions, generics, or `unknown` plus a narrowing check.
|
|
13
|
+
3. Annotate function signatures (params and returns) so call sites are checked, not just bodies.
|
|
14
|
+
4. Add narrowing at boundaries — validate or guard external/JSON input rather than asserting its type.
|
|
15
|
+
5. Run the type checker and the test suite; fix real type errors instead of suppressing them.
|
|
16
|
+
6. Confirm no runtime behavior changed — types should be erased/ignored at runtime.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Prefer `unknown` over `any` when a type is truly open, then narrow before use.
|
|
20
|
+
- Avoid `as`/`cast` and `# type: ignore` as fixes; each one is a hole — justify any you keep with a comment.
|
|
21
|
+
- Don't let added types change runtime behavior (e.g. introducing a default value via an annotation).
|
|
22
|
+
- Tighten at the edges first (public APIs, I/O boundaries); internal inference often follows for free.
|
|
23
|
+
- If a precise type is genuinely impractical, narrow as far as cheaply possible rather than defaulting to `any`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typography
|
|
3
|
+
description: Set an intentional modular type scale and font pairing with deliberate rhythm, measure, and hierarchy
|
|
4
|
+
category: ui-design
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Typography
|
|
8
|
+
|
|
9
|
+
Reach for this when text feels flat or noisy — everything the same weight, headings barely larger than body, lines too long to read. Typography carries most of a UI's perceived quality.
|
|
10
|
+
|
|
11
|
+
1. Pick a scale ratio and generate sizes from one base: 1.2 (minor third) for dense product UI, 1.25–1.333 for marketing. Use `clamp()` for fluid headings: `clamp(2rem, 1.2rem + 3vw, 3.5rem)`.
|
|
12
|
+
2. Pair at most two families with real contrast in role — e.g. a characterful display serif (Fraunces) over a neutral workhorse sans (Inter), or one superfamily across weights. More than two fonts reads as chaos.
|
|
13
|
+
3. Set body deliberately: 15–18px, `line-height` 1.5–1.65, and constrain measure to 60–75ch with `max-width: 65ch`. Long lines are the most common readability failure.
|
|
14
|
+
4. Build hierarchy with weight and size and color together — not size alone. A muted `--text-muted` for captions, a heavier 600–700 for headings, tight tracking (`-0.02em`) on large display text.
|
|
15
|
+
5. Tighten leading as size grows (headings 1.1–1.2, body 1.5) and add `text-wrap: balance` on headings, `pretty` on paragraphs to kill orphans.
|
|
16
|
+
6. Enable OpenType features that fit the context: `font-feature-settings` for tabular numerals in tables/dashboards, ligatures for prose; `font-variant-numeric: tabular-nums` stops number jitter.
|
|
17
|
+
7. Verify the rendered rhythm at real sizes and viewports, not in the abstract — print a paragraph plus h1–h4 and adjust.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Two type families maximum; if you need a third role, change weight, not font.
|
|
21
|
+
- Body measure 60–75ch; never let prose run the full container width.
|
|
22
|
+
- Pair every font-size with an intentional line-height — don't inherit a global 1.5 onto display text.
|
|
23
|
+
- Use tabular numerals anywhere numbers align in columns or update live.
|
|
24
|
+
- Establish scale steps as tokens; reaching for an off-scale `font-size: 19px` is a smell.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-bug-repro
|
|
3
|
+
description: Turn a screenshot or screen recording of a UI bug into a deterministic, scripted reproduction
|
|
4
|
+
category: visual-test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Bug Repro
|
|
8
|
+
|
|
9
|
+
Reach for this when someone hands you a screenshot or recording of broken UI and you need to reproduce it reliably before you can fix it.
|
|
10
|
+
|
|
11
|
+
1. Extract the context from the artifact: read the visible URL/route, viewport dimensions (from image size + DPR), theme, locale, and any error text or console overlay.
|
|
12
|
+
2. Reconstruct the path: from a recording, step frame-by-frame to list the exact actions (clicks, inputs, scrolls, resizes) and the data state that triggered the bug.
|
|
13
|
+
3. Script those steps in the app's driver (browser automation / e2e runner) at the same viewport and DPR, seeding the same data, until you see the bug live.
|
|
14
|
+
4. Capture your reproduced screenshot and overlay/diff it against the reported one to confirm you've hit the *same* failure, not a lookalike.
|
|
15
|
+
5. Bisect the trigger: remove steps and vary one input (viewport, data length, font, async timing) to find the minimal condition that produces it.
|
|
16
|
+
6. Commit the repro as a failing test, then fix and watch it go green.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- The viewport, DPR, and theme are often the whole bug; derive them from the image (pixel dimensions ÷ DPR) before guessing.
|
|
20
|
+
- Reproduce with the reporter's *data shape* (long strings, empty states, RTL, huge numbers) — most "only on my screen" UI bugs are data-driven.
|
|
21
|
+
- Race conditions and animation-timing bugs need controlled async (fake timers, throttled network) to reproduce on demand.
|
|
22
|
+
- Confirm the repro by diffing against the original artifact; "looks similar" is how you fix the wrong bug.
|
|
23
|
+
- Land the failing repro test first — a UI bug without a reproducing test regresses within a sprint.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-polish
|
|
3
|
+
description: Elevate a rough but working UI — fix spacing, alignment, hierarchy, and the small details that read as quality
|
|
4
|
+
category: ui-design
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Polish
|
|
8
|
+
|
|
9
|
+
Reach for this on a UI that functions but feels amateur — cramped, misaligned, flat. Polish is mostly subtraction and precision, not adding more.
|
|
10
|
+
|
|
11
|
+
1. Establish a spacing rhythm: snap every margin/padding/gap to the 4px (or 8px) scale, and make whitespace intentional — generous around groups, tight within them. Inconsistent gaps are the #1 tell.
|
|
12
|
+
2. Fix alignment to an actual grid: align edges and baselines, give content a `max-width` and consistent gutters, and make optical adjustments (icons often need a nudge to look centered).
|
|
13
|
+
3. Sharpen hierarchy: there should be an obvious first, second, and third thing on every screen. Use size, weight, and `--text-muted` color to demote secondary text instead of cramming everything at one level.
|
|
14
|
+
4. Tame the details: soften pure-black text to a near-black, swap harsh `0 1px 2px #000` shadows for layered low-alpha ones, align radii across siblings, and ensure border colors are subtle (low-contrast neutrals).
|
|
15
|
+
5. Polish interaction: add `:focus-visible` rings, hover/active feedback, and tasteful transitions (120–200ms, `ease-out`) on color and transform — never on `width`/`height` (use `transform`).
|
|
16
|
+
6. Handle the real states: empty, loading (skeletons over spinners), error, and long-content overflow. Unpolished UIs only ever show the happy path.
|
|
17
|
+
7. Do a final squint test and a 50%-zoom pass — blurred vision exposes weak hierarchy and ragged alignment instantly.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Every spacing value is on the scale; an unexplained `padding: 13px` is a defect.
|
|
21
|
+
- Increase contrast in hierarchy, decrease it in chrome — borders and shadows should whisper.
|
|
22
|
+
- Animate `transform`/`opacity` only; transitions 120–250ms with `ease-out`/custom cubic-bezier.
|
|
23
|
+
- Never ship without focus-visible, hover, empty, and loading states.
|
|
24
|
+
- When in doubt, remove an element or add whitespace before adding decoration.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-review
|
|
3
|
+
description: Critique a UI for visual quality, consistency, and hierarchy, returning specific, prioritized fixes
|
|
4
|
+
category: ui-design
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Review
|
|
8
|
+
|
|
9
|
+
Use this to evaluate an existing screen with a senior designer's eye and produce concrete, actionable critique — not "looks good" but "the h2 and body are too close in size; bump the scale ratio to 1.25."
|
|
10
|
+
|
|
11
|
+
1. Read intent first: what is this screen for, what's the one primary action? Judge everything against whether the design serves that goal and points the eye to it.
|
|
12
|
+
2. Check hierarchy with the squint test: blur your vision (or zoom to 50%) and confirm the most important element dominates. If everything competes, that's finding #1.
|
|
13
|
+
3. Audit consistency: collect the distinct spacings, font sizes, colors, radii, and shadows in play. Off-scale or near-duplicate values (15px vs 16px, two almost-equal grays) are concrete defects to list.
|
|
14
|
+
4. Measure the fundamentals: contrast ratios on text (AA 4.5:1), body measure (60–75ch), alignment to a grid, and spacing rhythm. Flag exact violations with the failing value.
|
|
15
|
+
5. Inspect states and motion: are focus-visible, hover, empty, loading, and error handled? Are transitions tasteful (120–250ms, eased) or janky/missing?
|
|
16
|
+
6. Assess the aesthetic: is there a point of view, or does it read templated? Name the one change that would most raise perceived quality.
|
|
17
|
+
7. Return findings ranked by impact, each as observation → why it hurts → specific fix, separating must-fix from nice-to-have.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Every critique is specific and actionable — name the element, the failing value, and the fix.
|
|
21
|
+
- Lead with hierarchy and consistency; they drive perceived quality more than color choice.
|
|
22
|
+
- Cite measurable thresholds (contrast, measure, spacing scale) instead of vibes.
|
|
23
|
+
- Prioritize: 3 high-impact fixes beat 30 nitpicks.
|
|
24
|
+
- Acknowledge what works so good decisions survive the next iteration.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vendor
|
|
3
|
+
description: Vendor a tiny dependency into the repo to drop the package and its install/supply-chain cost
|
|
4
|
+
category: dependencies
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Vendor
|
|
8
|
+
|
|
9
|
+
Reach for this when a dependency is small enough that copying its source in beats carrying the package and its tree.
|
|
10
|
+
|
|
11
|
+
1. Confirm it's worth vendoring: the package is tiny, stable, and has few/no transitive deps — otherwise keep the dependency.
|
|
12
|
+
2. Check the license permits copying and note the requirement (attribution, header retention) for the vendored file.
|
|
13
|
+
3. Copy the minimal source you actually use into a clearly named `vendor/` (or `internal/`) path, preserving the license header.
|
|
14
|
+
4. Record provenance: a comment or NOTICE with the package name, version, source URL, and license.
|
|
15
|
+
5. Replace imports of the package with the local path, then remove the dependency from the manifest and lockfile.
|
|
16
|
+
6. Run tests and a build; reinstall clean to confirm the package is fully gone.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Only vendor small, slow-moving code — vendoring something that gets security patches means you now own those patches.
|
|
20
|
+
- Preserve the original license header and attribution; stripping it is a license violation.
|
|
21
|
+
- Pin the exact version you copied and write down where it came from for future updates.
|
|
22
|
+
- Trim to what you use, but don't refactor the vendored code — keep it diffable against upstream.
|
|
23
|
+
- After removing the dep, confirm nothing else (peer deps, types) still references it.
|