1K

1k-coding-patterns

Provides standardization for OneKey coding styles and best practices.

Install

mkdir -p .claude/skills/1k-coding-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5300" && unzip -o skill.zip -d .claude/skills/1k-coding-patterns && rm skill.zip

Installs to .claude/skills/1k-coding-patterns

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

OneKey coding patterns for TypeScript, React, promises, date formatting, and error handling.
92 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Enforce promise handling patterns
  • Standardize React component definitions
  • Restrict forbidden coding patterns
  • Manage date formatting via utility modules

How it works

The skill provides a set of reference rules and code examples that define the required syntax and patterns for common development tasks.

Inputs & outputs

You give it
TypeScript or React code
You get back
Refactored code following project patterns

When to use 1k-coding-patterns

  • Reviewing component code
  • Standardizing promise logic
  • Applying TypeScript conventions

About this skill

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

When not to use it

  • When using native date formatting
  • When using floating promises

Limitations

  • Must follow specific reference files for each coding topic

How it compares

It explicitly forbids common patterns like floating promises and specific native methods to maintain project-wide consistency.

Compared to similar skills

1k-coding-patterns side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
1k-coding-patterns (this skill)11moNo flagsIntermediate
accessibility-compliance452moNo flagsIntermediate
typescript282moNo flagsBeginner
frontend-code-review112moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry