@ericrisco/rsc 4.2.0 → 4.2.2

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.
Files changed (38) hide show
  1. package/manifest.json +1 -1
  2. package/package.json +1 -1
  3. package/scripts/lib/review-ledger.js +14 -3
  4. package/scripts/rsc.js +4 -2
  5. package/skills/gcp-essentials/SKILL.md +11 -8
  6. package/skills/gcp-essentials/references/networking-and-sql.md +4 -4
  7. package/skills/github-actions/SKILL.md +12 -12
  8. package/skills/github-actions/evals/cases.yaml +1 -1
  9. package/skills/github-actions/references/caching-and-matrix.md +5 -5
  10. package/skills/github-actions/references/oidc-deploys.md +4 -4
  11. package/skills/google-workspace/SKILL.md +15 -11
  12. package/skills/google-workspace/references/api-recipes.md +2 -2
  13. package/skills/google-workspace/references/auth-setup.md +1 -1
  14. package/skills/harness/references/providers.yaml +1 -1
  15. package/skills/hetzner/SKILL.md +13 -12
  16. package/skills/hetzner/references/cloud-init.md +4 -2
  17. package/skills/hetzner/references/plans-and-locations.md +15 -14
  18. package/skills/huggingface/SKILL.md +15 -15
  19. package/skills/huggingface/evals/cases.yaml +1 -1
  20. package/skills/huggingface/references/endpoints-and-spaces.md +5 -3
  21. package/skills/huggingface/references/hub-and-cli.md +4 -4
  22. package/skills/huggingface/references/inference-providers.md +1 -1
  23. package/skills/huggingface/scripts/verify.sh +3 -2
  24. package/skills/instagram-api/SKILL.md +9 -9
  25. package/skills/instagram-api/evals/cases.yaml +1 -1
  26. package/skills/instagram-api/references/insights-metrics.md +1 -1
  27. package/skills/instagram-api/references/publish-reel.md +8 -7
  28. package/skills/linkedin-api/SKILL.md +3 -3
  29. package/skills/linkedin-api/evals/cases.yaml +1 -1
  30. package/skills/linkedin-api/references/api-reference.md +3 -3
  31. package/skills/review/SKILL.md +1 -1
  32. package/skills/typescript/SKILL.md +67 -20
  33. package/skills/typescript/evals/README.md +3 -3
  34. package/skills/typescript/evals/cases.yaml +4 -1
  35. package/skills/typescript/references/build-and-monorepo.md +82 -26
  36. package/skills/typescript/references/type-system.md +15 -4
  37. package/skills/typescript/scripts/verify.sh +20 -10
  38. package/targets/asdd-gate.mjs +9 -1
@@ -9,10 +9,11 @@ when you need fixed latency/SLA or the router's pay-as-you-go cost stops being p
9
9
 
10
10
  | Tier | From |
11
11
  |---|---|
12
- | CPU | ~$0.032 / core / hr |
12
+ | CPU | ~$0.033 / core / hr |
13
13
  | GPU (entry) | ~$0.50 / hr |
14
14
  | GPU A10G | ~$1.00 / hr |
15
- | GPU H100 | ~$6.40–8.00 / hr |
15
+ | GPU H200 (AWS) | ~$5.00 / hr |
16
+ | GPU H100 (GCP) | ~$10.00 / hr |
16
17
 
17
18
  ### Scale-to-zero
18
19
 
@@ -78,7 +79,8 @@ A Space hosts a demo app at a public `*.hf.space` URL. Pick the SDK by need:
78
79
 
79
80
  ### ZeroGPU
80
81
 
81
- Dynamic GPU allocation: an **H200 MIG slice (3g.71gb, ~70GB)** is grabbed only while a decorated
82
+ Dynamic GPU allocation: **half an NVIDIA RTX Pro 6000 Blackwell (48GB)** by default — or the full
83
+ 96GB card with `@spaces.GPU(size="xlarge")`, at 2x quota cost — is grabbed only while a decorated
82
84
  function runs and released when idle. **Gradio SDK only.**
83
85
 
84
86
  ```python
@@ -1,7 +1,7 @@
1
1
  # Hub & the `hf` CLI
2
2
 
3
- The CLI was renamed `huggingface-cli` → **`hf`**, shaped `hf <resource> <action>`. The legacy
4
- name still works but prints a deprecation warning — use `hf` in all new scripts.
3
+ The CLI is **`hf`**, shaped `hf <resource> <action>`. `huggingface_hub` 2.0 removed the
4
+ `huggingface-cli` entry point and the singular `hf repo` group (now `hf repos`) — use `hf` everywhere.
5
5
 
6
6
  ## Command map
7
7
 
@@ -10,7 +10,7 @@ hf auth login # interactive token store; or export HF_TOKEN=...
10
10
  hf auth whoami # confirm identity + token scope
11
11
  hf download <repo> # pull a repo (model/dataset/space) to the local cache
12
12
  hf upload <repo> <path> # push files to a repo
13
- hf repo create <repo> # create a new repo (--repo-type model|dataset|space)
13
+ hf repos create <repo> # create a new repo (--repo-type model|dataset|space)
14
14
  hf jobs run <image> -- <cmd> # run a containerized/uv job on HF infra (PRO)
15
15
  ```
16
16
 
@@ -37,7 +37,7 @@ cfg = hf_hub_download("BAAI/bge-small-en-v1.5", filename="config.json")
37
37
  ## Upload patterns
38
38
 
39
39
  ```bash
40
- hf repo create my-org/my-model --repo-type model
40
+ hf repos create my-org/my-model --repo-type model
41
41
  hf upload my-org/my-model ./checkpoints --commit-message "v1 weights"
42
42
  ```
43
43
 
@@ -95,7 +95,7 @@ resp = client.chat.completions.create(
95
95
 
96
96
  ## Billing & org headers
97
97
 
98
- - Monthly Inference-Providers credits: **Free $0.10**, **PRO $2.00**, **Team/Enterprise $2.00 per
98
+ - Monthly Inference-Providers credits: **Free none** (buy credits first), **PRO $2.00**, **Team/Enterprise $2.00 per
99
99
  seat** (shared across the org). Past credits → pay-as-you-go (you must purchase credits).
100
100
  - A **Custom Provider Key** (your own key for a partner) bypasses HF billing — the provider bills
101
101
  you directly and HF credits do not apply.
@@ -107,11 +107,12 @@ if printf '%s' "$URLHITS" | grep -q .; then
107
107
  fi
108
108
  fi
109
109
 
110
- # --- SOFT: legacy huggingface-cli in shell/scripts ---
110
+ # --- HARD: huggingface-cli was removed in huggingface_hub 2.0 ---
111
111
  CLIHITS="$(scan 'huggingface-cli ' || true)"
112
112
  if printf '%s' "$CLIHITS" | grep -q .; then
113
- warn_msg "legacy 'huggingface-cli' is deprecated — prefer 'hf <resource> <action>':"
113
+ fail_msg "'huggingface-cli' was removed in huggingface_hub 2.0 — use 'hf <resource> <action>':"
114
114
  printf '%s\n' "$CLIHITS"
115
+ HARD=1
115
116
  fi
116
117
 
117
118
  if [ "$HARD" -ne 0 ]; then
@@ -32,7 +32,7 @@ You cannot publish from a personal account. Confirm these before writing any cal
32
32
  - Facebook Login for Business → IG account linked to a FB Page → host `graph.facebook.com`.
33
33
  - Instagram Login (direct) → host `graph.instagram.com`.
34
34
  Why: the host is not interchangeable per call; mixing tokens and hosts throws auth errors.
35
- - **Scopes (current names):** `instagram_business_content_publish` to publish, `instagram_business_manage_insights` to read metrics. Why: the old `instagram_basic` / `instagram_content_publish` were deprecated 2025-01-27 and silently grant nothing now.
35
+ - **Scopes depend on the login path:** Instagram Login uses `instagram_business_basic`, `instagram_business_content_publish` and `instagram_business_manage_insights`; Facebook Login for Business uses `instagram_basic`, `instagram_content_publish`, `instagram_manage_insights` and `pages_read_engagement`. Why: on Instagram Login the old `business_basic` / `business_content_publish` / `business_manage_insights` names were deprecated 2025-01-27 — requesting a scope from the wrong path grants nothing.
36
36
  - **Long-lived token = 60 days**, refreshable before expiry. A short-lived user token lasts ~1h. Why: anything in a script needs the long-lived token or it dies within the hour.
37
37
 
38
38
  Env block — generate code that reads these, never hard-code the token:
@@ -133,22 +133,22 @@ Full container field reference (reels / carousel / story), cover & thumb handlin
133
133
  | `ERROR` | Failed (bad url, bad codec, eligibility) | Stop; read `status`, fix source |
134
134
  | `EXPIRED` | Container unpublished too long | Stop; recreate from step 1 |
135
135
 
136
- Why the 5-min ceiling: containers expire. If you poll forever you will eventually publish an `EXPIRED` id and get an error. Cap retries.
136
+ Why the 5-min ceiling: Meta's guidance is to poll once per minute for no more than 5 minutes; a container still not `FINISHED` by then is stuck, so stop and inspect `status`. Containers left unpublished for 24h become `EXPIRED`. Cap retries.
137
137
 
138
138
  ## Limits — check before a batch
139
139
 
140
140
  | Rule | How |
141
141
  |---|---|
142
- | **50 API-published posts per rolling 24h** per IG account | `GET /{IG_USER_ID}/content_publishing_limit?fields=quota_usage,config` |
143
- | Over the cap | `media_publish` rejects with **error subcode #51** ("publishing limit reached") |
142
+ | **100 API-published posts per rolling 24h** per IG account | `GET /{IG_USER_ID}/content_publishing_limit?fields=quota_usage,config` |
143
+ | Over the cap | `media_publish` rejects with **error code 9, subcode 2207042** ("maximum number of posts") |
144
144
 
145
145
  ```bash
146
146
  curl -s "https://$GRAPH_HOST/$GRAPH_VERSION/$IG_USER_ID/content_publishing_limit?fields=quota_usage" \
147
147
  -d "access_token=$IG_ACCESS_TOKEN"
148
- # -> {"data":[{"quota_usage": 12, "config": {"quota_total": 50}}]}
148
+ # -> {"data":[{"quota_usage": 12, "config": {"quota_total": 100}}]}
149
149
  ```
150
150
 
151
- Why check first: in a batch, hitting #51 mid-run leaves half your queue unpublished and no clean resume point. Read `quota_usage` and stop early.
151
+ Why check first: in a batch, hitting the cap (subcode 2207042) mid-run leaves half your queue unpublished and no clean resume point. Read `quota_usage` and stop early.
152
152
 
153
153
  ## Fetch insights
154
154
 
@@ -229,10 +229,10 @@ current valid Reels set; no deprecated names requested.
229
229
  | Requesting `plays` / `impressions` | 400s the whole insights call | Use `views`; consult the trap table |
230
230
  | Leaving `GRAPH_VERSION` blank / using default | Metric set silently shifts on Meta's rollout | Pin `v25.0` in every call |
231
231
  | Signed/auth-gated `video_url` | Container stalls in `ERROR` | Plain public MP4 for the full window |
232
- | Batch publishing without cap check | Hit #51 mid-run, half-published queue | `content_publishing_limit` before the loop |
233
- | Old scopes (`instagram_basic`, `instagram_content_publish`) | Grant nothing since 2025-01-27 | `instagram_business_basic` / `instagram_business_content_publish` |
232
+ | Batch publishing without cap check | Hit the cap (subcode 2207042) mid-run, half-published queue | `content_publishing_limit` before the loop |
233
+ | Pre-2025 Instagram Login scopes (`business_basic`, `business_content_publish`), or scopes from the other login path | Grant nothing (IG Login names deprecated 2025-01-27) | IG Login: `instagram_business_*`; FB Login: `instagram_basic` / `instagram_content_publish` |
234
234
  | Storing the container id as "the post" | It's not the published media id | Persist the `media_publish` id |
235
235
  | Sending a `graph.instagram.com` token to `graph.facebook.com` | Host is fixed by the login path, not chosen per call | Pick the host with the auth path and stay on it |
236
236
  | Letting the 60-day long-lived token lapse | Every call fails with an auth error, not a 404 | Refresh before expiry |
237
- | A source video outside Reel eligibility | Surfaces as container `ERROR`, not a clean validation message | 9:16, 5–90s, H.264/HEVC |
237
+ | A source video outside Reel eligibility | Surfaces as container `ERROR`, not a clean validation message | 3 s–15 min, ≤300 MB, H.264/HEVC + AAC, 9:16 recommended |
238
238
  | Requesting the 2025–2026 additions (Reels skip rate, repost counts, crossposted views) blind | Version-gated — trips the same 400 trap as a deprecated name | Confirm they exist on `GRAPH_VERSION` first |
@@ -8,7 +8,7 @@ should_trigger:
8
8
  - prompt: "My /insights call started returning an error when I ask for metric=plays"
9
9
  why: Non-obvious — the deprecated-metric trap; plays was retired 2025-04-21, swap to views.
10
10
  - prompt: "How many posts do we have left in the 24-hour Instagram publish window?"
11
- why: content_publishing_limit check before a batch; the 50/24h cap.
11
+ why: content_publishing_limit check before a batch; the 100/24h cap.
12
12
  - prompt: "Ingesta el rendimiento de los Reels en el wiki de shortform"
13
13
  why: Spanish — ingest IG performance into 02-DOCS/wiki/shortform, the checkable artifact.
14
14
  - prompt: "My media container is stuck IN_PROGRESS and never publishes"
@@ -48,7 +48,7 @@ Symptom of requesting any of these: the whole `/insights` call returns a 400, no
48
48
 
49
49
  Added late 2025 / early 2026; present only on recent versions. Confirm against `GRAPH_VERSION` before requesting, or they trip the same 400:
50
50
 
51
- - Reels **skip rate** / swipe-away signal.
51
+ - Reels **skip rate** / swipe-away signal (`reels_skip_rate`).
52
52
  - **Repost** counts (`reposts`).
53
53
  - **Crossposted** Reel views (`crossposted_views`, `facebook_views`).
54
54
 
@@ -39,7 +39,7 @@ Why the extra stage: children must each finish before the parent can be publishe
39
39
  - `IN_PROGRESS` — keep polling (~60s cadence).
40
40
  - `FINISHED` — publish now.
41
41
  - `ERROR` — read `status` for the reason; do not retry the same source blindly.
42
- - `EXPIRED` — container sat unpublished too long; recreate from step 1.
42
+ - `EXPIRED` — container sat unpublished for 24h; recreate from step 1.
43
43
 
44
44
  Poll ceiling ~5 minutes. Containers are not permanent.
45
45
 
@@ -47,10 +47,11 @@ Poll ceiling ~5 minutes. Containers are not permanent.
47
47
 
48
48
  | Subcode | Meaning | Fix |
49
49
  |---|---|---|
50
- | 51 | 24h publish limit reached (50/account) | Wait or read `content_publishing_limit` |
51
- | 9007 | Media not ready / not `FINISHED` | Poll until `FINISHED` first |
52
- | 2207003 | Media download failed | Make `video_url` truly public |
53
- | 2207026 | Unsupported video format | Re-encode H.264/HEVC, 9:16, 5–90s |
50
+ | 2207042 (code 9) | 24h publish limit reached (100/account) | Wait or read `content_publishing_limit` |
51
+ | 2207027 (code 9007) | Media not ready / not `FINISHED` | Poll until `FINISHED` first |
52
+ | 2207003 (code -2) | Media download took too long | Serve `video_url` from a fast, public host |
53
+ | 2207052 (code 9004) | Media could not be fetched | Make `video_url` truly public |
54
+ | 2207026 (code 352) | Unsupported video format | Re-encode H.264/HEVC + AAC, 3 s–15 min, ≤300 MB, 9:16 recommended |
54
55
 
55
56
  ## Retry / backoff snippet
56
57
 
@@ -77,13 +78,13 @@ def remaining_quota(base, uid, tok):
77
78
  d = requests.get(f"{base}/{uid}/content_publishing_limit",
78
79
  params={"fields": "quota_usage,config", "access_token": tok}
79
80
  ).json()["data"][0]
80
- return d.get("config", {}).get("quota_total", 50) - d.get("quota_usage", 0)
81
+ return d.get("config", {}).get("quota_total", 100) - d.get("quota_usage", 0)
81
82
 
82
83
  def publish_batch(base, uid, tok, jobs):
83
84
  published = []
84
85
  for video_url, caption in jobs:
85
86
  if remaining_quota(base, uid, tok) <= 0:
86
- break # stop cleanly; don't trip subcode 51
87
+ break # stop cleanly; don't trip subcode 2207042
87
88
  cid = requests.post(f"{base}/{uid}/media", data={
88
89
  "media_type": "REELS", "video_url": video_url,
89
90
  "caption": caption, "access_token": tok}).json()["id"]
@@ -80,13 +80,13 @@ Before publishing as an org, confirm the authed member holds an eligible **page
80
80
  Current organic endpoint: `POST https://api.linkedin.com/rest/posts`. The legacy `/v2/ugcPosts` and `/v2/shares` are deprecated — migrate to the versioned `/rest/posts`. Pin the version **once**:
81
81
 
82
82
  ```bash
83
- LINKEDIN_VERSION=202605 # supported until 2027-05-15; 202505 is sunset — pinning a sunset version breaks
83
+ LINKEDIN_VERSION=202611 # supported until 2027-11-16; 202511 is sunset — pinning a sunset version breaks
84
84
  ```
85
85
 
86
86
  Every versioned call carries **two** headers (omit either and you get 426/400):
87
87
 
88
88
  ```text
89
- Linkedin-Version: 202605
89
+ Linkedin-Version: 202611
90
90
  X-Restli-Protocol-Version: 2.0.0
91
91
  ```
92
92
 
@@ -200,7 +200,7 @@ CTR ~4.4%. The "common 403 causes" hook outperformed the plain howto.
200
200
 
201
201
  | Anti-pattern | Why it breaks | Do instead |
202
202
  |---|---|---|
203
- | Pinning `Linkedin-Version: 202505` | That version is sunset; calls start failing on cutover | Pin `202605` in one constant; bump deliberately |
203
+ | Pinning `Linkedin-Version: 202511` | That version is sunset; calls start failing on cutover | Pin `202611` in one constant; bump deliberately |
204
204
  | Sending only `Linkedin-Version`, dropping `X-Restli-Protocol-Version` | Versioned endpoints reject the request (426/400) | Always send both headers together |
205
205
  | Expecting the API to scrape an article URL | Posts API never fetches OG tags; you get a bare link | Set `source`/`title`/`description` + an uploaded Image URN |
206
206
  | Reading the new post id from the response body | The URN is in `x-restli-id`, body has no id | Read the `x-restli-id` response header |
@@ -32,7 +32,7 @@ capability:
32
32
  - scenario: "Take an app from zero to a logged result: complete 3-legged OAuth, resolve the org author URN, publish a document post (Documents API upload -> document URN -> Posts API), pull organizationalEntityShareStatistics, and write 02-DOCS/wiki/linkedin/<post-id>.md with the metric front-matter."
33
33
  must_include:
34
34
  - "sends both required headers: Linkedin-Version and X-Restli-Protocol-Version: 2.0.0"
35
- - "pins version 202605 (not the sunset 202505)"
35
+ - "pins version 202611 (not the sunset 202511)"
36
36
  - "sets lifecycleState: PUBLISHED in the post body"
37
37
  - "reads the new post URN from the x-restli-id response header"
38
38
  - "uploads the document via the Documents API to get urn:li:document: then references it in content.media.id"
@@ -4,11 +4,11 @@ Offloaded depth for `linkedin-api`. All paths assume the two versioned headers f
4
4
 
5
5
  ```text
6
6
  Authorization: Bearer $LINKEDIN_TOKEN
7
- Linkedin-Version: 202605
7
+ Linkedin-Version: 202611
8
8
  X-Restli-Protocol-Version: 2.0.0
9
9
  ```
10
10
 
11
- `202605` (`li-lms-2026-05`) is a supported version, sunset 2027-05-15; newer monthly versions exist — check the [API migration status](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/migrations#api-migration-status) table before pinning. `202505` is sunset — do not pin it.
11
+ `202611` (`li-lms-2026-11`) is the latest version, sunset 2027-11-16. LinkedIn ships a version each month and supports it for at least one year — check the [API migration status](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/migrations#api-migration-status) table before pinning or bumping. `202511` is sunset — do not pin it.
12
12
 
13
13
  ## Publish payloads — `POST /rest/posts`
14
14
 
@@ -83,7 +83,7 @@ Images / Documents / Videos use the same two-step shape: register an upload to g
83
83
  # Images example
84
84
  curl -X POST "https://api.linkedin.com/rest/images?action=initializeUpload" \
85
85
  -H "Authorization: Bearer $LINKEDIN_TOKEN" \
86
- -H "Linkedin-Version: 202605" \
86
+ -H "Linkedin-Version: 202611" \
87
87
  -H "X-Restli-Protocol-Version: 2.0.0" \
88
88
  -H "Content-Type: application/json" \
89
89
  -d '{ "initializeUploadRequest": { "owner": "urn:li:organization:12345" } }'
@@ -11,7 +11,7 @@ origin: risco
11
11
 
12
12
  Tests prove the code works, not that it does what was asked. Review answers that other question: **is the diff correct, well-scoped and faithful to the spec — or did it pass for the wrong reasons?** In ASDD (`../asdd/SKILL.md`) it runs in two modes:
13
13
 
14
- - **Per task** — called from `implement`'s loop after each task's self-check. Depth comes from `npx @ericrisco/rsc risk [--base <ref>] [paths…]` (same path table as the sello, works with the sello off): **tier 0** → no review; **tier 1** → one fresh-context reviewer (a subagent that never saw the implementation conversation); **tier 2** → the three-refuter panel below, recorded after it runs with `npx @ericrisco/rsc review ledger panel <slug>/<task> --lenses correctness,security,tests` (the ship guard refuses to push a tier-2 branch without it — one reviewer is not a panel), and the branch will wait for human approval at ship. The tier reads the diff's content too: auth code in a generic file is tier 2.
14
+ - **Per task** — called from `implement`'s loop after each task's self-check. Depth comes from `npx @ericrisco/rsc risk [--base <ref>] [paths…]` (same path table as the sello, works with the sello off): **tier 0** → no review; **tier 1** → one fresh-context reviewer (a subagent that never saw the implementation conversation); **tier 2** → the three-refuter panel below, recorded after it runs with `npx @ericrisco/rsc review ledger panel <slug>/<task> --lenses correctness,security,tests` (the ship guard refuses to push a tier-2 branch without it — one reviewer is not a panel; when the code lives in a child repo or its worktree and the specs in the workspace, run it from the workspace root with `--repo <path to the reviewed checkout>`, so the panel binds that checkout's commit), and the branch will wait for human approval at ship. The tier reads the diff's content too: auth code in a generic file is tier 2.
15
15
  - **Closing review** — once, before `ship`: the whole branch against the spec. Forty individually-correct tasks can still fail to be the feature together: a criterion nobody owned, two tasks that each assumed the other handled an edge, scope that crept in a slice at a time. Read the spec's acceptance criteria and "must respect" list against `git diff <base>...HEAD`, not the task reviews. Its record — tier, counts, verdict, each finding with its outcome — goes to `02-DOCS/wiki/sdd/reviews/<slug>.md`.
16
16
 
17
17
  This skill owns **two roles that share one discipline**:
@@ -11,18 +11,19 @@ origin: risco
11
11
  Express data and contracts precisely in the TypeScript type system, and configure the
12
12
  compiler so the types actually hold.
13
13
 
14
- Written against **TypeScript 5.9**: redesigned `tsc --init` defaults
15
- (`module: nodenext`, `target: esnext`, `moduleDetection: force`, strict on), `import defer`
16
- for deferred module evaluation, expandable editor hovers. The **TypeScript 7 native
17
- compiler** (the Go port) type-checks roughly 10x faster (VS Code's 1.5M LOC: 89s -> 8.74s);
18
- `typescript` 7.x on npm ships it as `tsc`, and `@typescript/native-preview` ships it as `tsgo`.
19
- Read the project's version first (`npx tsc -v`) and check its release notes before advising on
20
- a version newer than 5.9.
14
+ Written against **TypeScript 7** (`typescript` 7.0.2 on npm, the stable line since
15
+ 2026-07-08): the native compiler written in Go, shipped by the `typescript` package as the
16
+ `tsc` binary. Full builds are typically 8-12x faster than 6.0 (VS Code's repo: 125.7s ->
17
+ 10.6s), with parallel checking (`--checkers`, default 4) and parallel project builds
18
+ (`--builders`). TypeScript 7 turns every option deprecated in 6.0 into a hard error and ships
19
+ no programmatic API yet (that is planned for 7.1). Read the project's version first
20
+ (`npx tsc -v`); on a 5.x project, follow "Coming from 5.x" below before changing anything else.
21
21
 
22
22
  ## Boundary: language vs runtime vs framework
23
23
 
24
24
  Three layers, three owners. **Language + compiler config lives here** — generics, narrowing,
25
- `.d.ts`, `tsconfig`, and the build toolchain (`tsc` vs `tsgo`, `tsx`, resolution mode).
25
+ `.d.ts`, `tsconfig`, and the build toolchain (`tsc`, the `tsc6` compatibility package, `tsx`,
26
+ resolution mode).
26
27
  **Runtime behavior** (how a stream backpressures, how the event loop schedules) is `nodejs`.
27
28
  **Framework idioms** (component props, route maps, server-component typing) are
28
29
  `react`/`nextjs`/`nestjs` — those *borrow* this skill's type mechanics but own their wiring.
@@ -52,7 +53,7 @@ Apply these on every TypeScript edit:
52
53
  ### Generics + constraints, and `const` type parameters
53
54
 
54
55
  Constrain type parameters so callers get errors at the call site, and use a `const` type
55
- parameter (TS 5.0+) to preserve literal inference without `as const` everywhere:
56
+ parameter to preserve literal inference without `as const` everywhere:
56
57
 
57
58
  ```ts
58
59
  // Bad: unconstrained T, and the literal "a"|"b" widens to string.
@@ -141,7 +142,7 @@ function load(id: UserId) { /* a bare string is now a compile error */ }
141
142
 
142
143
  `Partial<T>` `Required<T>` `Readonly<T>` `Pick<T,K>` `Omit<T,K>` `Record<K,V>`
143
144
  `Exclude<U,M>` `Extract<U,M>` `NonNullable<T>` `ReturnType<F>` `Parameters<F>`
144
- `Awaited<T>` `NoInfer<T>` (TS 5.4+, blocks a type param from inferring at one site).
145
+ `Awaited<T>` `NoInfer<T>` (blocks a type param from inferring at one site).
145
146
 
146
147
  ### Mapped / conditional / template-literal one-liners
147
148
 
@@ -157,26 +158,38 @@ overloads) live in [references/type-system.md](references/type-system.md).
157
158
 
158
159
  ## tsconfig: strict base
159
160
 
160
- Copy-paste base. Every package `extends` this and overrides only paths/references:
161
+ TypeScript 7 already defaults `strict: true`, `module: esnext`, `target` to the newest
162
+ finished ES edition, `noUncheckedSideEffectImports: true`, `types: []` and `rootDir` to the
163
+ tsconfig's folder. Write the important ones anyway: an explicit base survives `extends`
164
+ chains and tells the reader what the project relies on. Copy-paste base; every package
165
+ `extends` it and overrides only paths/references:
161
166
 
162
167
  ```jsonc
163
168
  {
164
169
  "compilerOptions": {
165
- "strict": true, // the whole strict family, non-negotiable
170
+ "strict": true, // default in TS 7; keep it explicit
166
171
  "noUncheckedIndexedAccess": true, // arr[i] / rec[k] are T | undefined
167
172
  "verbatimModuleSyntax": true, // explicit import type; safe single-file transpile
168
173
  "isolatedModules": true, // each file transpilable alone (esbuild/swc/babel)
169
174
  "skipLibCheck": true, // don't type-check node_modules .d.ts (speed)
170
175
  "resolveJsonModule": true, // import data.json with types
171
176
  "target": "esnext",
172
- "module": "nodenext", // or "esnext" + "moduleResolution": "bundler"
177
+ "module": "nodenext", // or "preserve"/"esnext" + "moduleResolution": "bundler"
173
178
  "moduleResolution": "nodenext",
174
179
  "moduleDetection": "force",
180
+ "rootDir": "./src", // default is the tsconfig folder; name src explicitly
181
+ "types": ["node"], // default is []: list every @types package you use
175
182
  "noEmit": true // a bundler/tsc -b emits; the base just checks
176
- }
183
+ },
184
+ "include": ["src"]
177
185
  }
178
186
  ```
179
187
 
188
+ `types` defaulting to `[]` means globals from `@types/*` (`process`, `describe`, `Buffer`)
189
+ are not visible until listed; the error says "Cannot find name 'process'". Under `nodenext`
190
+ the nearest `package.json` decides ESM vs CJS: without `"type": "module"`, `.ts` files are
191
+ CommonJS and `verbatimModuleSyntax` rejects their `export` statements (TS1287).
192
+
180
193
  ### moduleResolution: bundler vs nodenext
181
194
 
182
195
  | Aspect | `bundler` | `nodenext` |
@@ -184,11 +197,12 @@ Copy-paste base. Every package `extends` this and overrides only paths/reference
184
197
  | Use when | Vite / Next / Remix / esbuild build the code | Code runs directly in Node (no bundler) |
185
198
  | Relative import extensions | omit (`./util`) | required (`./util.js`) |
186
199
  | `package.json` `exports`/`imports` | resolved | resolved |
187
- | `module` setting | `esnext`/`preserve` | `nodenext` |
200
+ | `module` setting | `preserve` (or `esnext`/`commonjs`) | `nodenext` |
188
201
  | Emits runnable JS itself | no (the bundler does) | yes |
189
202
 
190
203
  Pick `bundler` when a bundler owns resolution; pick `nodenext` for libraries and scripts
191
- that Node executes directly. Field-by-field reference and the full matrix are in
204
+ that Node executes directly. These are the only two modes to use: `node10`/`node` and
205
+ `classic` are removed in TypeScript 7. Field-by-field reference and the full matrix are in
192
206
  [references/build-and-monorepo.md](references/build-and-monorepo.md).
193
207
 
194
208
  ## Monorepo & build
@@ -196,14 +210,45 @@ that Node executes directly. Field-by-field reference and the full matrix are in
196
210
  Use **project references** so packages type-check independently and in dependency order. A
197
211
  shared `tsconfig.base.json` holds the strict flags; each package extends it, sets
198
212
  `composite: true`, `outDir`/`rootDir`, and lists upstream packages under `references`. Build
199
- the graph with `tsc -b` (or `tsgo -b`).
213
+ the graph with `tsc -b`; TypeScript 7 builds independent projects in parallel (`--builders`)
214
+ and checks each with several checkers (`--checkers`, default 4; lower it on memory-tight CI,
215
+ or use `--singleThreaded`).
200
216
 
201
217
  For declaration emit and publishing a library, set `declaration: true`,
202
- `declarationMap: true`, and an `exports` map in `package.json`. For fast local checks prefer
203
- `tsgo` (TS7 preview: `npx @typescript/native-preview`); run scripts with `tsx` instead of
204
- `ts-node`. Depth, build-order graph, path aliases, and the `tsgo` adoption steps are in
218
+ `declarationMap: true`, and an `exports` map in `package.json`. Run scripts with `tsx` or
219
+ Node's type stripping instead of `ts-node`. Tools that import the `typescript` JS API
220
+ (typescript-eslint, Vue/Svelte/Astro/MDX/Angular template tooling, webpack loaders) need 6.0
221
+ alongside 7: install `@typescript/typescript6` (binary `tsc6`). Depth, build-order graph, path
222
+ aliases, and the side-by-side setup are in
205
223
  [references/build-and-monorepo.md](references/build-and-monorepo.md).
206
224
 
225
+ ## Coming from 5.x
226
+
227
+ TypeScript 6.0 is the bridge release: it deprecated what 7 removes. Code that compiles on 6.0
228
+ with no `ignoreDeprecations` and `stableTypeOrdering: true` compiles the same on 7. Migrate in
229
+ that order: 5.x -> 6.0 clean -> 7.
230
+
231
+ | In the old config | TypeScript 7 | Do instead |
232
+ | --- | --- | --- |
233
+ | `baseUrl` | removed (TS5102) | `paths` entries relative to the tsconfig (`"@core/*": ["./packages/core/src/*"]`) |
234
+ | `moduleResolution: node`/`node10`/`classic` | removed | `nodenext` (Node runs it) or `bundler` (a bundler runs it) |
235
+ | `module: amd`/`umd`/`system`/`none` | removed | `esnext`/`preserve`, or `nodenext` |
236
+ | `outFile` | removed | a bundler (esbuild, Rollup, Vite) |
237
+ | `target: es5`, `downlevelIteration` | removed | `target` es2015 or later; a bundler/Babel for older engines |
238
+ | `esModuleInterop`/`allowSyntheticDefaultImports: false` | cannot be `false` | delete the line; interop is always on |
239
+ | `alwaysStrict: false` | cannot be `false` | rename identifiers that strict mode reserves |
240
+ | `module Foo {}` namespace | error (TS1540) | `namespace Foo {}`; `declare module "pkg"` is fine |
241
+ | `import x from "./a.json" assert { type: "json" }` | error | `with { type: "json" }` |
242
+ | `tsc file.ts` beside a `tsconfig.json` | error (TS5112) | `tsc -p .`, or `--ignoreConfig` on purpose |
243
+ | relying on implicit `@types/*` globals | `types` defaults to `[]` | list them: `"types": ["node", "vitest/globals"]` |
244
+ | sources under `src/` with no `rootDir` | `rootDir` defaults to the tsconfig folder | `"rootDir": "./src"` |
245
+
246
+ `ignoreDeprecations: "6.0"` silences the deprecations on 6.0 only; TypeScript 7 still errors. The
247
+ experimental `ts5to6` codemod rewrites `baseUrl` and `rootDir`. In JS files checked via JSDoc,
248
+ TypeScript 7 drops Closure-era forms (`@enum`, `@class`, `function(string): void`, postfix
249
+ `!`, standalone `?`); write `typeof value` where a type is expected. Template-literal `infer`
250
+ splits strings by code point, so a string-length utility type built on UTF-16 halves changes.
251
+
207
252
  ## Anti-patterns
208
253
 
209
254
  | Anti-pattern | Why it bites | Do instead |
@@ -218,6 +263,8 @@ For declaration emit and publishing a library, set `declaration: true`,
218
263
  | One giant `tsconfig` for a monorepo | can't express per-package targets; breaks references | `tsconfig.base.json` + per-package `extends` |
219
264
  | `// @ts-ignore` | swallows the error even after the line is fixed, masking new ones | `// @ts-expect-error` (errors if the line later type-checks) |
220
265
  | Default-importing in a CJS-emit file under `verbatimModuleSyntax` | blocked / wrong emit | use `export =`/named, or set the right `module` |
266
+ | `baseUrl`, `node10`, `outFile` or `ignoreDeprecations` in a TS 7 config | hard error, or a no-op that hides the real fix | the "Coming from 5.x" replacements |
267
+ | Forcing a JS-API tool onto `typescript` 7 | 7.0 ships no programmatic API, so the tool fails to load it | keep `@typescript/typescript6` for that tool, `tsc` 7 for checking |
221
268
 
222
269
  ## Project grounding
223
270
 
@@ -6,10 +6,10 @@ non-obvious narrowing symptoms and Spanish/Catalan phrasings) that must select t
6
6
  `react`, `drizzle-orm`, `python`, `testing-web`) instead. **Capability**: the scenario gives a
7
7
  loosely-typed module with no tsconfig and grades the output against the `must_include` rubric
8
8
  (any -> precise types, discriminated union with a literal discriminant, exhaustive `never`
9
- guard, a strict tsconfig, `import type` usage, no error-silencing casts).
9
+ guard, a strict tsconfig valid on TypeScript 7, `import type` usage, no error-silencing casts).
10
10
 
11
11
  To run, feed each prompt to the skill router and confirm the trigger/route decision, then run
12
12
  the capability scenario through an agent loaded with this skill and score the result by hand
13
13
  against the rubric. There is no automated runner here; the rigor is the rubric plus
14
- `scripts/verify.sh`, which independently proves the toolchain enforces strictness and
15
- exhaustiveness on a sample project.
14
+ `scripts/verify.sh`, which runs TypeScript 7 `tsc` and independently proves the toolchain
15
+ enforces strictness, exhaustiveness and unchecked-index safety on sample files.
@@ -13,6 +13,8 @@ should_trigger:
13
13
  why: Spanish trigger — strict config plus replacing any with precise types, language/compiler scope.
14
14
  - prompt: "Convert these magic-string statuses into a discriminated union with an exhaustiveness check."
15
15
  why: Discriminated unions + never guard, the canonical modeling pattern here.
16
+ - prompt: "We upgraded to TypeScript 7 and tsc now says Option 'baseUrl' has been removed. How do I migrate the tsconfig?"
17
+ why: Compiler config migration to TS 7 (removed options, paths without baseUrl) — owned here.
16
18
  - prompt: "Por que no estrecha el tipo despues del if? sigue siendo string | undefined."
17
19
  why: Catalan/Spanish non-obvious narrowing question — type-system diagnosis.
18
20
 
@@ -36,11 +38,12 @@ should_not_trigger:
36
38
  capability:
37
39
  - scenario: >
38
40
  Given a loosely-typed module (any-heavy, string-keyed state object, no tsconfig),
39
- produce strict types plus a tsconfig that compiles under `tsc --noEmit`.
41
+ produce strict types plus a tsconfig that compiles under TypeScript 7 `tsc --noEmit`.
40
42
  must_include:
41
43
  - "Replaces every `any` with `unknown`, a generic, or a precise type."
42
44
  - "Models the state as a discriminated union with a literal discriminant (not string)."
43
45
  - "Adds an exhaustive `never` guard so a new union member is a compile error."
44
46
  - "Ships a strict tsconfig: strict, noUncheckedIndexedAccess, verbatimModuleSyntax, isolatedModules."
47
+ - "The tsconfig is valid on TypeScript 7: no baseUrl, outFile, node10/classic resolution or esModuleInterop false; moduleResolution is nodenext or bundler; any needed @types are listed in `types`."
45
48
  - "Uses `import type` for type-only imports where applicable."
46
49
  - "Uses no `as` casts to silence errors (each remaining `as` is justified, e.g. `as const` or a validated boundary)."