AgentSkillsCN

wontak

个人在TypeScript、Kotlin、Swift与Python开发中的编码理念与模式。适用于Wontak项目中的代码编写、审查或重构工作。触发时机包括:涉及分层架构设计、Manager/Client模式、以测试为导向的设计、错误处理策略(优雅降级 vs 快速失败)、命名规范,或项目结构的决策。也适用于新建项目、配置构建工具,或确立编码标准。

SKILL.md
--- frontmatter
name: wontak
description: Personal coding philosophy and patterns for TypeScript, Kotlin, Swift, and Python development. Use when writing, reviewing, or refactoring code in Wontak's projects. Triggers on tasks involving layered architecture design, Manager/Client patterns, testability-focused design, error handling strategies (graceful degradation vs fail-fast), naming conventions, or project structure decisions. Also use when setting up new projects, configuring build tools, or establishing coding standards.
license: Apache-2.0
metadata:
  author: wontak
  version: "1.0.0"

Wontak Developer Style

Note: Preferences evolve over time. This guide reflects current standards. When working on older projects, check project-specific configurations.


Core Philosophy

Pragmatism Over Purity

Working solutions take priority over theoretical perfection. This doesn't mean cutting corners, but rather choosing practical approaches that deliver value without unnecessary complexity.

Principles:

  • Allow escape hatches (like any type) when genuinely necessary rather than fighting the type system
  • Don't enforce async/await on every function if it adds no value
  • Allow unused parameters in callback signatures to maintain API compatibility
  • Choose the simpler solution when multiple approaches are equally valid

Safety First

Despite embracing pragmatism, safety remains non-negotiable:

  • Strict type checking enabled by default in all TypeScript projects
  • Mutex/lock patterns for any shared mutable state
  • Fail-fast approach for required configuration (crash early, crash loudly)
  • Graceful degradation for optional features (don't crash, log and continue)
  • Design for testability from the start

Clear Intent

Code should communicate its purpose without requiring extensive comments:

  • Use descriptive names that reveal purpose, not implementation
  • Implement explicit state machines with clear guard clauses
  • Use logging as execution documentation
  • Write comments only to explain WHY something is done, never WHAT

Platform Abstraction

When building software that may run on multiple platforms:

  • Core business logic lives in platform-agnostic modules
  • Platform-specific code implements well-defined interfaces
  • Use the Strategy pattern to swap implementations at runtime

Testability by Design

Code should be designed for testability from the beginning. This is more valuable than any coverage metric.

  • Depend on abstractions (interfaces), not concretions
  • Inject dependencies through constructors
  • Avoid static methods and singletons that can't be mocked
  • Keep side effects at the edges of the system
  • Separate pure logic from I/O operations

Quick Reference

Always Do

  • Write all code, comments, and documentation in English
  • Enable strict TypeScript configuration
  • Design for testability from the start
  • Separate platform-agnostic from platform-specific code
  • Specify explicit return types on public methods
  • Use singular folder names
  • Follow conventional commit format
  • Use mutex for shared mutable state
  • Graceful degradation for optional features
  • Fail-fast for required configuration
  • Inject dependencies through constructors
  • Use double quotes in TypeScript/JavaScript

Never Do

  • Chase coverage metrics over meaningful tests
  • Skip return types on public API methods
  • Use plural folder names
  • Commit without conventional format
  • Access platform globals in core code
  • Put business logic in controllers
  • Ignore lint/type errors
  • Use default exports (prefer named exports)
  • Create singletons that can't be mocked

Testing Priority

PriorityWhat to Test
HighCore business logic, state management, error handling
MediumIntegration points, API boundaries, data transformations
LowSimple utility functions, configuration
SkipTrivial views, simple getters/setters, framework boilerplate

Pattern Selection Guide

ScenarioRecommended Pattern
Complex domain coordinationManager class
External API integrationClient class
Cross-platform codeInterface + Strategy
Shared mutable stateMutex/Lock
Optional feature unavailableGraceful degradation
Required config missingFail-fast
Multiple implementationsStrategy pattern
Object creation complexityFactory pattern
Event broadcastingObserver pattern

Reference Guide

Load additional references based on your current task:

By Language

Working withLoad
TypeScript/JavaScriptreferences/typescript-patterns.md
Kotlin/Androidreferences/kotlin-patterns.md
Swift/iOSreferences/swift-patterns.md
Pythonreferences/python-patterns.md

By Concern

Need help withLoad
Architecture design, layers, Manager/Client patternsreferences/architecture.md
File/class/function naming, code stylereferences/naming-and-style.md
Error handling, graceful degradation, fail-fastreferences/error-handling.md
Writing tests, mocks, test structurereferences/testing.md
Folder structure, monorepo layoutreferences/project-structure.md
Package managers, CI/CD, build toolsreferences/tooling.md

Common Combinations

TaskLoad these references
New TypeScript featuretypescript-patterns.md + architecture.md
New Kotlin SDK featurekotlin-patterns.md + architecture.md
New Swift/iOS SDK featureswift-patterns.md + architecture.md
Setting up new projectproject-structure.md + tooling.md
Writing teststesting.md + (language-specific patterns)
Code reviewnaming-and-style.md + (language-specific patterns)

Personal development patterns for consistent, maintainable, and testable code.