TypeScript Code Review Skill for Windsurf
Review a TypeScript change for unsafe assertions, missing runtime checks, and compiler-API assumptions. Use for a TypeScript code review. Do not use for a non-TypeScript repository or to turn on a new compiler unasked.
name: "typescript-code-review" description: "Review a TypeScript change for unsafe assertions, missing runtime checks, and compiler-API assumptions. Use for a TypeScript code review. Do not use for a non-TypeScript repository or to turn on a new compiler unasked."
TypeScript Code Review Skill for Windsurf
Devin skill typescript-code-review for TypeScript. Invoke it with /typescript-code-review. Install only .devin/skills. This file is not a subagent.
When to run
Run this review on a TypeScript change, a pull request, or a request to "check the types". Look for holes in the checker and for runtime data that was never parsed.
When to leave it
Stop for a repository without TypeScript, or for a formatting-only diff. Do not upgrade the compiler unless the user asked.
Steps
- Read the installed
typescriptversion and whetherstrictis on. A script that imports compiler APIs from the 7.0typescriptpackage is a high finding: 7.0 does not ship that API. Point it at@typescript/typescript6, or wait for a real 7.1 API. A plan to jump majors without a request is a finding, not a task you start. - Search the diff for
any,as,!, and@ts-ignoreor@ts-expect-errorwithout a reason. Each one at a boundary is a finding. An assertion immediately after a proper parse can stay. - Find functions that accept
unknownor external JSON and return a typed value without a parser. That is a finding. - Check unions. A
switchthat falls through to a default which returnsanyis a finding. An exhaustive switch can stay. - If the diff touches a script that imports
typescriptas a library, confirm the calls exist on the installed major. Missing methods are a high finding. - Run the project's typecheck when the user asked for a check. Record the command. Otherwise write
not run.
Output
Findings first, with file, line, the unsafe construct, and a narrower type or a parser. Then the compiler version and no file edits unless a fix was requested.
## Findings
- high | path:line | what is wrong | what to do instead
## No findings
Say "No findings" and list the files you opened. A search you skipped is not a clean result.
## Example
Input: `src/area.ts` imports `typescript` from the 7.0 package and calls `ts.createProgram`.
Output: high | src/area.ts:1 | TypeScript 7.0 has no stable compiler API | import `@typescript/typescript6` until 7.1, or run `tsc --noEmit` instead.
Do not flag the valid pattern named in the standards. Flag the mistake next to it.
Stop
Stop when the project is not TypeScript, or when the user asks you to disable strict to get a green build.
Severity
high is a bug a caller can hit or a secret that leaks. medium is a broken contract that needs a specific input. low is a cleanup that does not change behaviour.