mcpField
1
1k-coding-patterns

1k-coding-patterns

github.com/onekeyhqDevelopment2.5k73 installsUpdated today
Repository

About 1k-coding-patterns

A OneKey repository skill that documents coding patterns and rules for promises, React components, restricted APIs, date formatting, and error handling. It is intended for contributors and coding agents implementing or reviewing OneKey code.

Key features

  1. 01Promise handling rules
  2. 02React component conventions
  3. 03Restricted API and import patterns
  4. 04OneKey date formatting guidance
  5. 05Error handling across RPC and runtime boundaries

Use cases

  1. 01Check promise handling during implementation
  2. 02Follow repository conventions for React components
  3. 03Choose the approved date formatting approach
  4. 04Review imports and error propagation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/onekeyhq/app-monorepo --skill 1k-coding-patterns

After installing, type/1k-coding-patternsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
date-formatting.md
error-handling.md
references/rules/
date-formatting.md
error-handling.md
promise-handling.md
react-components.md
restricted-patterns.md

Details

From the project README

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

Comments

Markdown supported