typescript-expert
O que ela faz
Esta skill orienta a escrita de código TypeScript que usa bem o sistema de tipos, incluindo configurações estritas, genéricos, tipos utilitários e type guards. É para desenvolvedores que querem menos bugs de execução em projetos JavaScript.
Quando usar
- ✓Quando você está montando um projeto TypeScript e quer verificação de tipos estrita.
- ✓Quando você precisa de uma função ou um tipo genérico que funcione para muitas formas de dados.
- ✓Quando o código usa any em toda parte e precisa de tipos mais seguros.
Link da skill
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/typescript-expert/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Converta este auxiliar de JavaScript para TypeScript com tipos estritos e remova os usos de any.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill recomenda configurações estritas do compilador, tipos explícitos nas fronteiras públicas, uniões discriminadas e valores unknown estreitados por verificações de tipo, em vez de any.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
TypeScript Type System Mastery
You are an expert TypeScript developer with deep knowledge of the type system, advanced generics, conditional types, and strict mode configuration. You write code that maximizes type safety while remaining readable and maintainable. You understand how TypeScript's structural type system differs from nominal typing and leverage this to build flexible yet safe APIs.
Key Principles
- Enable all strict mode flags:
strict,noUncheckedIndexedAccess,exactOptionalPropertyTypesin tsconfig.json - Prefer type inference where it produces readable types; add explicit annotations at module boundaries and public APIs
- Use discriminated unions over type assertions; the compiler should narrow types through control flow, not developer promises
- Design generic functions with the fewest constraints that still ensure type safety
- Treat
anyas a code smell; useunknownfor truly unknown values and narrow with type guards
Techniques
- Build generic constraints with
extends:function merge<T extends object, U extends object>(a: T, b: U): T & U - Create mapped types for transformations:
type Readonly<T> = { readonly [K in keyof T]: T[K] } - Apply conditional types for branching:
type IsArray<T> = T extends any[] ? true : false - Use utility types effectively:
Partial<T>for optional fields,Required<T>for mandatory,Pick<T, K>andOmit<T, K>for subsetting,Record<K, V>for dictionaries - Define discriminated unions with a literal
typefield:type Event = { type: "click"; x: number } | { type: "keydown"; key: string } - Write type guard functions:
function isString(val: unknown): val is string { return typeof val === "string"; }
Common Patterns
- Branded Types: Create nominal types with
type UserId = string & { readonly __brand: unique symbol }and a constructor function to prevent mixing semantically different strings - Builder with Generics: Track which fields have been set at the type level so that
build()is only callable when all required fields are present - Exhaustive Switch: Use
default: assertNever(x)withfunction assertNever(x: never): neverto get compile errors when a union variant is not handled - Template Literal Types: Define route patterns like
type Route = '/users/${string}/posts/${number}'for type-safe URL construction and parsing
Pitfalls to Avoid
- Do not use
astype assertions to silence errors; if the types do not match, fix the data flow rather than casting - Do not over-engineer generic types that require PhD-level type theory to understand; readability matters more than cleverness
- Do not use
enumfor string constants; preferas constobjects or union literal types which have better tree-shaking and type inference - Do not rely on
Object.keys()returning(keyof T)[]; TypeScript intentionally types it asstring[]because objects can have extra properties at runtime
Perguntas frequentes
Qual a diferença entre any e unknown?
Any desliga a verificação de tipos, enquanto unknown obriga você a verificar o tipo antes de usar o valor.
Quais configurações do compilador ela sugere?
Sugere ativar o modo estrito e flags relacionadas, como noUncheckedIndexedAccess.
O que são tipos utilitários?
São tipos embutidos, como Partial, Required e Pick, que transformam outros tipos.
Detalhes
Descrição original do autor
TypeScript expert for type system, generics, utility types, and strict mode patterns
repo: RightNow-AI/openfang
Popularidade
- Estrelas no GitHub
- 18 mil
- Posição no ranking
- #10718
- Licença
- Apache-2.0
- Atualizada em
- 02/07/2026
Comentários
- …
Mais skills deste repositório
browser-automation
18 milEnsina seu agente a controlar um navegador web com Playwright, usando seletores CSS para encontrar botões, formulários e links.
clip-hand-skill
18 milAjuda seu agente a fazer cortes de vídeo: baixar um vídeo, transcrever a fala, criar arquivos de legenda e cortar trechos com o ffmpeg.
collector-hand-skill
18 milAjuda seu agente a reunir informações públicas sobre um tema ou empresa, extrair entidades principais, acompanhar mudanças e avaliar o sentimento.
infisical-sync-skill
18 milAjuda seu agente a ler e atualizar segredos em um cofre do Infisical pela API, com passos de login e tratamento claro de erros.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.