Claude-skill-registry 1k-coding-patterns
Coding patterns and best practices for OneKey development. Use when writing React components, handling promises, error handling, or following code conventions. Triggers on react, component, hooks, promise, async, await, error, pattern, convention, typescript.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/1k-coding-patterns" ~/.claude/skills/majiayu000-claude-skill-registry-1k-coding-patterns && rm -rf "$T"
manifest:
skills/data/1k-coding-patterns/SKILL.mdsource content
OneKey Coding Patterns and Best Practices
Quick Reference
| Topic | Guide | Key Points |
|---|---|---|
| Promise handling | promise-handling.md | Always await or use , never floating promises |
| React components | react-components.md | Named imports, functional components, no FC type |
| Restricted patterns | restricted-patterns.md | Forbidden: , direct hd-core import |
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
- Date and time formatting/1k-date-formatting
- Internationalization and translations/1k-i18n
- Error handling patterns/1k-error-handling
- Platform-specific code/1k-cross-platform
- Linting and code quality/1k-code-quality
- Performance optimization/1k-performance
- Jotai atom patterns/1k-state-management
- Project structure and import rules/1k-architecture
- Lint fixes, pre-commit tasks/1k-code-quality