Agent Skills › classroomio/classroomio › writing-code

writing-code

GitHub

规定代码编写规范,核心为默认不写注释,仅允许记录外部约束的注释;函数文档仅使用JSDoc描述契约而非实现细节,禁止解释设计选择或叙述代码逻辑。

skills/writing-code/SKILL.md classroomio/classroomio

Trigger Scenarios

编写新代码时 编辑现有代码时 提交代码前检查

Install

npx skills add classroomio/classroomio --skill writing-code -g -y
More Options

Use without installing

npx skills use classroomio/classroomio@writing-code

指定 Agent (Claude Code)

npx skills add classroomio/classroomio --skill writing-code -a claude-code -g -y

安装 repo 全部 skill

npx skills add classroomio/classroomio --all -g -y

预览 repo 内 skill

npx skills add classroomio/classroomio --list

SKILL.md

Frontmatter
{
    "name": "writing-code",
    "description": "Mandatory code-writing rules for this repo, led by the comment policy: default to no comments, document functions with JSDoc only when the signature isn't enough, and never explain a design choice inline (refactor instead). Read this before writing or editing any code."
}

Writing Code

Read this before writing or editing code. The comment policy is the part agents get wrong most often, so it comes first and it is not optional.

The comment policy

Default: write no comments.

An inline comment is allowed only when it records an external constraint — something true about the world outside this file that the code cannot express. Platform behavior, a build-tool quirk, a third-party API's odd requirement, a legal or policy limit.

Everything else is banned:

  • Narrating what the code does.
  • Section headers.
  • Restating types, names, or obvious intent.
  • Explaining a design decision. If a reader needs the decision explained, the design is the problem — refactor until the code says it.
  • Commented-out code.
  • TODO / FIXME with no owner and no tracked issue.

When in doubt, delete it. A missing comment costs a reader one re-read; a wrong one costs them trust.

Documenting functions

Use JSDoc, and only when the signature doesn't already convey the contract. State the contract — inputs, side effects, what it returns or throws — not the implementation. One or two lines.

If a function needs a paragraph to explain, it is doing too much. Split it.

Examples

Bad — narrates the code and restates the obvious:

// increment the counter by one
counter += 1;

// check if the user is an admin
if (user.role === 'admin') {
  // ...
}

Bad — module block that enumerates the implementation:

/**
 * Shared cascade-deletion helpers used by org deletion scripts.
 *
 * `deleteOrganization` removes an organization and ALL associated data by
 * walking every child table (courses, lessons, exercises, submissions,
 * groupmembers, tags, assets, widgets, programs, cohorts, AI data,
 * analytics, etc.) in reverse dependency order before removing the org.
 */

The table list is a copy of the schema that will drift and then lie. Keep it out of the source.

Good — JSDoc states the contract:

/**
 * Removes an organization and every child row. Throws if the org is missing.
 */
export async function deleteOrganization(orgId: string): Promise<void> {

Good — the one allowed inline comment, one line, external constraint:

// SvelteKit prerender bakes the build-time fetch into static HTML; serve at runtime so the KV cache is read per request.
export const prerender = false;

Before you commit

  • No comment narrates what the code does.
  • No comment explains an internal design choice.
  • Every JSDoc states a contract, not an implementation.
  • The only inline comments left record an external constraint, in one line.

Version History

  • 45de074 Current 2026-09-23 02:28

Same Skill Collection

skills/add-docs-image/SKILL.md
skills/add-landing-template/SKILL.md
skills/animation-vocabulary/SKILL.md
skills/apple-design/SKILL.md
skills/create-issue/SKILL.md
skills/create-thumbnail/SKILL.md
skills/emil-design-eng/SKILL.md
skills/find-animation-opportunities/SKILL.md
skills/frontend-design/SKILL.md
skills/humanizer/SKILL.md
skills/i-have-adhd/SKILL.md
skills/improve-animations/SKILL.md
skills/pick-ui-library/SKILL.md
skills/prototype/SKILL.md
skills/public-api-review/SKILL.md
skills/review-animations/SKILL.md
skills/ship-feature/SKILL.md
skills/stage-and-commit/SKILL.md
skills/summarize-activity/SKILL.md
skills/write-changelog/SKILL.md
skills/write-docs/SKILL.md
skills/write-prd/SKILL.md
skills/brand-system/SKILL.md

Metadata

Files
0
Version
6630b73
Hash
15cd696d
Indexed
2026-09-23 02:28

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-09 01:02
浙ICP备14020137号-1