Agent skill
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 this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/1k-coding-patterns
SKILL.md
OneKey Coding Patterns and Best Practices
Quick Reference
| Topic | Guide | Key Points |
|---|---|---|
| Promise handling | promise-handling.md | Always await or use void, never floating promises |
| React components | react-components.md | Named imports, functional components, no FC type |
| Restricted patterns | restricted-patterns.md | Forbidden: toLocaleLowerCase, 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
/1k-date-formatting- Date and time formatting/1k-i18n- Internationalization and translations/1k-error-handling- Error handling patterns/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/1k-code-quality- Lint fixes, pre-commit tasks
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?