zhuxining/harness · Archived

code-principles

触发场景:编写新代码、重构现有代码、代码审查、添加功能、修复bug时。根据目标文件的编程语言类型,参考对应的代码规范原则。支持的语言?

First seen Apr 9, 2026

Installation

$ npx skills add zhuxining/harness --skill code-principles

Summary

触发场景:编写新代码、重构现有代码、代码审查、添加功能、修复bug时。根据目标文件的编程语言类型,参考对应的代码规范原则。支持的语言包括:Python (.py)、Rust (.rs)、TypeScript/JavaScript (.ts/.tsx/.js/.jsx)。框架相关代码决策需基于官方文档验证。

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from zhuxining/harness.

npx skills add zhuxining/harness

Browse all from zhuxining/harness

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Default branch main
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,231 B
  • docs SUMMARY.md 350 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 3 installs

SKILL.md

Code Principles

本技能提供多语言代码规范指导,帮助编写高质量、符合最佳实践的代码。

使用场景

当执行以下任务时参考对应语言的规范:

  • 编写新代码 - 创建新函数、类、模块时
  • 重构代码 - 改进现有代码结构和质量时
  • 代码审查 - 检查代码是否符合规范时
  • 添加功能 - 在现有代码基础上扩展功能时
  • 修复bug - 修改代码解决问题时

语言规范映射

根据文件扩展名选择对应的规范文件:

文件类型 参考文档 关键原则
.py [py-principles.md](references/py-principles.md) 类型安全、现代语法、不可变性、异常处理
.rs [rust-principles.md](references/rust-principles.md) 所有权安全、零成本抽象、惯用语法、并发安全
.ts, .tsx, .js, .jsx [ts-principles.md](references/ts-principles.md) 类型安全、现代JS/TS、React最佳实践、可访问性

核心原则

训练数据会过时。当对框架用法、API 特性或最佳实践存疑时,优先查阅官方文档而非凭记忆决策。

工作流程

  1. 识别语言 - 根据文件路径确定目标语言
  2. 读取规范 - 使用 Read 工具读取对应的参考文件
  3. 应用原则 - 根据规范确保代码满足类型安全、错误处理、命名规范等要求
  4. 自检 - 完成前检查是否符合该语言的最佳实践

核心检查点

所有语言通用的关注维度:

  • 类型注解/签名完整准确
  • 错误处理适当(捕获具体异常、不忽略错误)
  • 命名清晰,意图明确
  • 函数职责单一,复杂度可控
  • 无明显的性能或安全问题

框架/库特定代码需参考官方文档,详见各语言文件的「不确定时参考」小节。