CtrlK
BlogDocsLog inGet started
Tessl Logo

1k-coding-patterns

OneKey coding patterns for TypeScript, React, promises, date formatting, and error handling.

58

Quality

68%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./.skillshare/skills/1k-coding-patterns/SKILL.md
SKILL.md
Quality
Evals
Security

OneKey Coding Patterns and Best Practices

Quick Reference

TopicGuideKey Points
Promise handlingpromise-handling.mdAlways await or use void, never floating promises
React componentsreact-components.mdNamed imports, functional components, no FC type
Restricted patternsrestricted-patterns.mdForbidden: toLocaleLowerCase, direct hd-core import
Date formattingdate-formatting.mdUse OneKey dateUtils, not native date formatting
Error handlingerror-handling.mdPreserve errors across RPC/runtime boundaries

Critical Rules Summary

Promise Handling

// ❌ FORBIDDEN - floating promise
apiCall();

// ✅ CORRECT
await apiCall();
// or
void apiCall(); // intentionally not awaited

React Components

// ❌ FORBIDDEN
import React, { FC } from 'react';
const MyComponent: FC<Props> = () => {};

// ✅ CORRECT
import { useState, useCallback } from 'react';
function MyComponent({ prop }: { prop: string }) {}

Restricted Patterns

// ❌ FORBIDDEN
string.toLocaleLowerCase()
import { x } from '@onekeyfe/hd-core';
import { localDbInstance } from '...';

// ✅ CORRECT
string.toLowerCase()
const { x } = await CoreSDKLoader();
import { localDb } from '...';

Related Skills

  • /1k-i18n - Internationalization and translations
  • /1k-cross-platform - Platform-specific code
  • /1k-code-quality - Linting and code quality
  • /1k-performance - Performance optimization
  • /1k-state-management - Jotai atom patterns
  • /1k-architecture - Project structure and import rules
Repository
OneKeyHQ/app-monorepo
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.