coding-standard-javascript

JavaScript/TypeScript Coding Standards

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "coding-standard-javascript" with this command: npx skills add jdubray/puffin/jdubray-puffin-coding-standard-javascript

JavaScript/TypeScript Coding Standards

When reviewing or generating JavaScript/TypeScript code, follow these rules:

File Naming

  • Source files: Use kebab-case (e.g., user-service.js , api-client.ts )

  • Component files: Use kebab-case (e.g., user-profile.js , data-table.tsx )

  • Test files: Use .test.js or .spec.js suffix (e.g., user-service.test.js )

  • Type definition files: Use .d.ts suffix (e.g., api-types.d.ts )

Variable Naming

  • Variables: camelCase (e.g., userName , isActive , totalCount )

  • Constants: UPPER_SNAKE_CASE for true constants (e.g., MAX_RETRIES , API_BASE_URL )

  • Boolean variables: Prefix with is , has , can , should (e.g., isLoading , hasError )

Function Naming

  • Functions: camelCase (e.g., calculateTotal() , fetchUserData() )

  • Async functions: Consider prefixing with action verb (e.g., loadUsers() , saveDocument() )

  • Event handlers: Prefix with handle or on (e.g., handleClick , onSubmit )

  • Factory functions: Prefix with create (e.g., createUser() , createConnection() )

Class/Constructor Naming

  • Classes: PascalCase (e.g., UserService , DataProcessor , ApiClient )

  • Interfaces (TS): PascalCase, optionally prefix with I (e.g., IUserService or UserService )

  • Type aliases (TS): PascalCase (e.g., UserResponse , ConfigOptions )

  • Enums (TS): PascalCase for enum name, UPPER_SNAKE_CASE for values

Private Members

  • Private fields: Prefix with underscore (e.g., _privateData , _internalState )

  • Private methods: Prefix with underscore (e.g., _validateInput() , _processData() )

Module Organization

  • Group imports: external packages first, then internal modules

  • Export public API at the bottom of the file

  • One class/component per file when possible

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

coding-standard-python

No summary provided by upstream source.

Repository SourceNeeds Review
General

coding-standard-cpp

No summary provided by upstream source.

Repository SourceNeeds Review
General

coding-standard-java

No summary provided by upstream source.

Repository SourceNeeds Review
General

modularity-patterns

No summary provided by upstream source.

Repository SourceNeeds Review