coding-standards

Provide coding standards and best practices for TypeScript, JavaScript, React, and Node.js.

1|Updated Oct 14, 2023
One-click install
npx skills add https://github.com/walterfan/lazy-ai-primer --skill coding-standards-walterfan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coding-standards
Source: https://github.com/walterfan/lazy-ai-primer/tree/main/assets/skills/coding-standards
Command: npx skills add https://github.com/walterfan/lazy-ai-primer --skill coding-standards-walterfan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive set of universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development, ensuring code consistency, readability, and maintainability across projects.

Core Features & Use Cases

  • Code Quality Principles: Enforces principles like Readability First, KISS, DRY, and YAGNI.
  • Language-Specific Standards: Detailed guidelines for TypeScript/JavaScript (naming, immutability, error handling, async/await, type safety) and React (component structure, custom hooks, state management, conditional rendering).
  • API Design Standards: Covers REST conventions, response formats, and input validation using Zod.
  • File Organization & Naming: Recommends project structure and file naming conventions.
  • Comments & Documentation: Guidelines on when to comment and how to use JSDoc.
  • Performance Best Practices: Covers memoization, lazy loading, and efficient database queries.
  • Testing Standards: Emphasizes AAA pattern and descriptive test naming.
  • Code Smell Detection: Identifies and advises on avoiding long functions, deep nesting, and magic numbers.
  • Use Case: A new developer joins a project and needs to understand the established coding conventions. They can refer to this Skill to quickly get up to speed on the team's best practices for writing clean, efficient, and maintainable code.

Quick Start

Apply the coding standards to the provided TypeScript code snippet.

Frequently Asked Questions about coding-standards

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

FAQPage Schema
What are the best practices for React component structure and state management?

Best practices for React component structure and state management include organizing components efficiently, using custom hooks for reusable logic, and applying conditional rendering to ensure maintainability and readability across your project.

How do I enforce TypeScript type safety and immutability in my code?

To enforce TypeScript type safety and immutability, apply coding standards that cover strict type definitions, naming conventions, and error handling, ensuring consistent and maintainable JavaScript and TypeScript development.

How should I design REST API responses and validate inputs in Node.js?

Design REST API responses and validate inputs in Node.js by following REST conventions, standardizing response formats, and using Zod for input validation to ensure robust API design and data integrity.

What coding standards help detect code smells like long functions and magic numbers?

Coding standards that help detect code smells like long functions, deep nesting, and magic numbers rely on principles like KISS, DRY, and YAGNI to identify and advise on avoiding these patterns for better code quality.

What is the recommended file organization and JSDoc documentation approach for JavaScript?

The recommended file organization approach for JavaScript involves specific project structures and file naming conventions, while documentation guidelines dictate when to comment and how to effectively use JSDoc for clarity.

How do I optimize React and Node.js performance using memoization and lazy loading?

Optimize React and Node.js performance using memoization, lazy loading, and efficient database queries, following established performance best practices to reduce load times and improve application responsiveness.