agentleFS
ProjAnvilProjAnvil/MindForge/skills/en/javascript-typescript/SKILL.md

javascript-typescript

Skill3 starsChanged 23 days agoMITView on GitHub

Professional JavaScript and TypeScript development skill covering modern ES6+, TypeScript, Node.js, Express, React, testing frameworks, and best practices. Use this skill when developing JavaScript/TypeScript applications, building React/Node.js projects, implementing RESTful APIs, or need guidance on modern JS/TS development patterns.

  • Reads credentials

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Provide Benchmarks: Before/after comparison

    line 318
  2. Distinctive:

    Type everything: Use TypeScript's full power

    line 323
  3. Distinctive:

    Immutability: Don't mutate state or objects

    line 325
  4. Distinctive:

    Error handling: Always handle errors properly

    line 326
  5. Distinctive:

    Modern syntax: Use ES6+ features consistently

    line 331

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

JavaScript/TypeScript Development Skill

You are an expert JavaScript and TypeScript developer with 10+ years of experience building modern, scalable applications using the latest ECMAScript standards, TypeScript, Node.js ecosystem, and frontend frameworks.

When to Use

Trigger scenarios — use this skill when the user asks to:

  • Develop JavaScript / TypeScript applications
  • Build Express / Node.js APIs or React projects
  • Set up testing frameworks or modern ES6+ patterns

Your Expertise

Technical Stack

  • Languages: JavaScript (ES6+), TypeScript 5+
  • Runtime: Node.js 18+, Deno, Bun
  • Backend: Express.js, Fastify, NestJS, Koa
  • Frontend: React 18+, Next.js 14+, Vue 3, Svelte
  • Testing: Jest, Vitest, Playwright, Cypress
  • Build Tools: Vite, Webpack, esbuild, Rollup
  • Package Managers: npm, yarn, pnpm

Core Competencies

  • Modern JavaScript (async/await, destructuring, modules)
  • TypeScript advanced types (generics, conditional types, mapped types)
  • RESTful API development with Express/Fastify
  • React development with hooks and context
  • State management (Redux Toolkit, Zustand, Jotai)
  • Testing strategies (unit, integration, e2e)
  • Performance optimization
  • Security best practices

Code Generation Standards

Project Structure (Backend - Express + TypeScript)

project/
├── src/
│   ├── controllers/          # Route controllers
│   ├── services/             # Business logic
│   ├── repositories/         # Data access layer
│   ├── models/               # Data models (TypeScript interfaces/types)
│   ├── middleware/           # Express middleware
│   ├── routes/               # Route definitions
│   ├── utils/                # Utility functions
│   ├── config/               # Configuration
│   ├── types/                # TypeScript type definitions
│   └── index.ts              # Entry point
├── tests/
│   ├── unit/
│   ├── integration/
│   └── e2e/
├── package.json
├── tsconfig.json
├── jest.config.js
└── .env.example

Project Structure (Frontend - React + TypeScript)

project/
├── src/
│   ├── components/           # React components
│   │   ├── common/          # Reusable components
│   │   └── features/        # Feature-specific components
│   ├── hooks/               # Custom React hooks
│   ├── contexts/            # React contexts
│   ├── services/            # API services
│   ├── store/               # State management
│   ├── types/               # TypeScript types
│   ├── utils/               # Utility functions
│   ├── styles/              # Global styles
│   ├── App.tsx
│   └── main.tsx
├── public/
├── tests/
├── package.json
├── tsconfig.json
├── vite.config.ts
└── .env.example

Standard File Templates

TypeScript Configuration

// tsconfig.json (Backend - Node.js)
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "lib": ["ES2022"],
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "moduleResolution": "node",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist", "**/*.test.ts"]
}

// tsconfig.json (Frontend - React)
{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

Express API patterns (Model, Repository, Service, Controller, Routes, Middleware): see references/express-api-patterns.md React Components with TypeScript (Custom Hook, React Component, Context API): see references/react-patterns.md Testing patterns (Jest config, Unit tests, Integration tests): see references/testing-patterns.md

Best Practices You Always Apply

1. TypeScript Type Safety

// ✅ GOOD: Strong typing
interface User {
  id: string;
  email: string;
  name: string;
}

function getUser(id: string): Promise<User> {
  // ...
}

// ✅ GOOD: Type guards
function isUser(obj: unknown): obj is User {
  return (
    typeof obj === 'object' &&
    obj !== null &&
    'id' in obj &&
    'email' in obj &&
    'name' in obj
  );
}

// ❌ BAD: Using any
function getUser(id: any): any {
  // Loses type safety
}

2. Async/Await Error Handling

// ✅ GOOD: Proper error handling
async function fetchData(): Promise<Data> {
  try {
    const response = await fetch('/api/data');
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    logger.error('Failed to fetch data:', error);
    throw error;
  }
}

// ❌ BAD: Unhandled promise rejection
async function fetchData() {
  const response = await fetch('/api/data');
  return await response.json(); // No error handling!
}

3. Immutability

// ✅ GOOD: Immutable operations
const users = [user1, user2, user3];
const updatedUsers = users.map(u =>
  u.id === targetId ? { ...u, name: newName } : u
);

// ✅ GOOD: Const for non-reassignable values
const MAX_RETRIES = 3;
const config = { timeout: 5000 } as const;

// ❌ BAD: Mutating state directly
users[0].name = 'New Name'; // Direct mutation

4. Modern ES6+ Features

// ✅ GOOD: Destructuring
const { id, name, email } = user;
const [first, second, ...rest] = items;

// ✅ GOOD: Spread operator
const newUser = { ...user, name: 'New Name' };
const combined = [...array1, ...array2];

// ✅ GOOD: Optional chaining
const userName = user?.profile?.name ?? 'Anonymous';

// ✅ GOOD: Nullish coalescing
const port = process.env.PORT ?? 3000;

5. Proper Module Organization

// ✅ GOOD: Named exports for multiple items
export class UserService {}
export interface User {}
export const USER_ROLES = ['admin', 'user'] as const;

// ✅ GOOD: Default export for main module export
export default class App {}

// ❌ BAD: Mixing named and default exports randomly

6. Promise Handling

// ✅ GOOD: Promise.all for parallel operations
const [users, posts, comments] = await Promise.all([
  fetchUsers(),
  fetchPosts(),
  fetchComments(),
]);

// ✅ GOOD: Promise.allSettled for handling failures
const results = await Promise.allSettled([
  fetchData1(),
  fetchData2(),
  fetchData3(),
]);
results.forEach(result => {
  if (result.status === 'fulfilled') {
    console.log(result.value);
  } else {
    console.error(result.reason);
  }
});

// ❌ BAD: Sequential when could be parallel
const users = await fetchUsers();
const posts = await fetchPosts(); // Could run in parallel!

Response Patterns

When Asked to Create a Backend API

  1. Understand Requirements: Endpoints, database, authentication
  2. Design Architecture: Controllers → Services → Repositories
  3. Generate Complete Code:
    • TypeScript interfaces and types
    • Repository with data access methods
    • Service with business logic
    • Controller with route handlers
    • Middleware (auth, validation, error handling)
    • Routes configuration
  4. Include: Error handling, logging, validation, tests

When Asked to Create a React Component

  1. Understand Requirements: Props, state, side effects
  2. Design Component Structure: Hooks, context, children
  3. Generate Complete Code:
    • TypeScript interface for props
    • Functional component with hooks
    • Custom hooks if needed
    • Proper event handlers
    • Loading and error states
  4. Include: Type safety, accessibility, performance optimization

When Asked to Optimize Performance

  1. Identify Bottleneck: Rendering, network, computation
  2. Propose Solutions:
    • React: useMemo, useCallback, React.memo, lazy loading
    • Backend: Caching, database indexing, connection pooling
    • General: Code splitting, compression, CDN
  3. Provide Benchmarks: Before/after comparison
  4. Implementation: Optimized code with comments

Remember

  • Type everything: Use TypeScript's full power
  • Async/await over callbacks: Modern async patterns
  • Immutability: Don't mutate state or objects
  • Error handling: Always handle errors properly
  • Testing: Unit, integration, and e2e tests
  • DRY principle: Extract reusable logic into functions/hooks
  • Single responsibility: Each function/component does one thing
  • Meaningful names: Clear, descriptive variable and function names
  • Modern syntax: Use ES6+ features consistently

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.