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.
Best use case
1k-coding-patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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.
Teams using 1k-coding-patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/1k-coding-patterns/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How 1k-coding-patterns Compares
| Feature / Agent | 1k-coding-patterns | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# OneKey Coding Patterns and Best Practices
## Quick Reference
| Topic | Guide | Key Points |
|-------|-------|------------|
| Promise handling | [promise-handling.md](references/rules/promise-handling.md) | Always await or use `void`, never floating promises |
| React components | [react-components.md](references/rules/react-components.md) | Named imports, functional components, no FC type |
| Restricted patterns | [restricted-patterns.md](references/rules/restricted-patterns.md) | Forbidden: `toLocaleLowerCase`, direct hd-core import |
## Critical Rules Summary
### Promise Handling
```typescript
// ❌ FORBIDDEN - floating promise
apiCall();
// ✅ CORRECT
await apiCall();
// or
void apiCall(); // intentionally not awaited
```
### React Components
```typescript
// ❌ FORBIDDEN
import React, { FC } from 'react';
const MyComponent: FC<Props> = () => {};
// ✅ CORRECT
import { useState, useCallback } from 'react';
function MyComponent({ prop }: { prop: string }) {}
```
### Restricted Patterns
```typescript
// ❌ 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 tasksRelated Skills
workflow-orchestration-patterns
Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running ...
settings-ui-patterns
Use when creating or modifying UI components, styling, or visual elements related to Settings in OpenChamber.
responsive-design-patterns
Mobile-first responsive design patterns with breakpoints, fluid layouts, and adaptive components
microservices-patterns
Design microservices architectures with service boundaries, event-driven communication, and resilience patterns. Use when building distributed systems, decomposing monoliths, or implementing micros...
MCP Widget Patterns
This skill should be used when the user asks to "design a widget", "what widget pattern should I use", "inline card design", "carousel widget", "fullscreen mode", "picture in picture", "widget layout", "card design for ChatGPT", or needs guidance on specific widget patterns and implementations for OpenAI Apps SDK.
hig-patterns
Apple Human Interface Guidelines interaction and UX patterns.
design-patterns
BK-CI 项目设计模式实践指南,涵盖工厂模式、策略模式、观察者模式、装饰器模式、模板方法等在项目中的实际应用。当用户学习设计模式、重构代码、设计可扩展架构或理解项目设计时使用。
architecture-patterns
Padrões de arquitetura de software - Decisões OBJETIVAS sobre design de sistemas
ai-interaction-patterns
AI-specific interaction design patterns covering wayfinding, prompt UX, human-in-the-loop controls, trust & transparency, AI identity, and context management. Based on Shape of AI (shapeof.ai). Use when asking about 'AI UX', 'AI interaction', 'prompt UX', 'AI trust', 'AI disclosure', 'AI avatar', 'AI personality', 'AI memory UX', 'action plan UX', 'stream of thought', 'AI citations', 'AI controls', 'AI wayfinding', 'AI suggestions', 'gallery pattern', 'follow-up pattern', 'draft mode', 'AI variations', 'AI consent', 'AI caveat', 'human-in-the-loop', 'AI transparency', 'AI state', 'prompt design', 'AI onboarding', or 'generative UI'.
refactoring-patterns
Safe refactoring workflow and common patterns. Invoke when extracting methods, renaming, moving code, or addressing code smells.
recursive-context-coding-agent
Use recursive context processing with grep/find/uv to handle large codebases. When working with codebases larger than your context window, treat the codebase as an external environment and recursively process it using symbolic execution.
multi-agent-patterns
Supervisor, swarm, and hierarchical multi-agent architectures with context isolation patterns.