typescript-and-javascript

Enforce strict TypeScript and JavaScript style and type-safety policies.

2|Updated Jun 1, 2017
One-click install
npx skills add https://github.com/carlos-algms/dotfiles --skill typescript-and-javascript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-and-javascript
Source: https://github.com/carlos-algms/dotfiles/tree/main/AI-configs/skills/typescript-and-javascript
Command: npx skills add https://github.com/carlos-algms/dotfiles --skill typescript-and-javascript

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves inconsistent or error-prone TypeScript and JavaScript code quality by enforcing strict style and type safety requirements across all TS/JS file operations.

Core Features & Use Cases

  • Consistent Type Safety: Prohibits any, requires strict equality, and prefers traceable typing using satisfies over type casting.
  • Readable, Predictable Code: Encourages early returns, named functions (instead of arrow functions) where appropriate, and consistent control-flow formatting with curly braces.
  • Scalable Code Organization: Discourages barrel exports and accidental logic in entry-point files (like index.ts(x)), improving maintainability and tree-shaking.

Quick Start

Use this skill when creating or editing any TypeScript or JavaScript files to ensure code follows the repository’s strict style and type-checking expectations.

Frequently Asked Questions about typescript-and-javascript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce strict type safety and avoid 'any' in TypeScript?

To enforce strict type safety in TypeScript, you must prohibit the use of 'any', mandate strict equality operators like '===' and '!==', and prefer traceable typing using the 'satisfies' operator over type casting. This approach ensures predictable code and prevents unsafe typing errors.

What is the best way to improve tree-shaking in JavaScript projects?

Improving tree-shaking in JavaScript involves discouraging barrel exports and preventing accidental logic in entry-point files like 'index.ts'. By organizing code this way, you reduce side effects and ensure that unused modules are safely eliminated during the bundling process.

Why should I use 'satisfies' instead of type casting in TypeScript?

You should use 'satisfies' instead of type casting in TypeScript because it provides traceability and validates that an object matches a type without losing its specific literal types. This prevents unsafe type assertions and maintains strict type-checking expectations.

How do I format readable control-flow patterns in TypeScript?

To format readable control-flow patterns in TypeScript, use early returns, prefer named functions over arrow functions where appropriate, and consistently apply curly braces. This creates predictable control flow and ensures the generated code remains maintainable.

Does this strict TypeScript style guide apply to configuration files and tests?

Yes, this strict TypeScript style guide applies to configuration files, tests, scripts, components, hooks, services, utilities, classes, interfaces, types, and schemas. It enforces style and type-safety policies across all TS/JS file operations and agent-authored content.