本文へ移動
cccskills
無料GitHub で公開日本語紹介

clean-code

既存コードの役割や読みやすさを保ちながら、命名、関数分割、コメント、型、安全な編集前後の確認を判断するためのコーディング基準を示します。

原文原文の説明を見る

Coding standards for this repo - concise, direct, no over-engineering, and no comments that carry no knowledge. Use when writing or reviewing any code here, and whenever adding a comment.

Openpanel-dev/openpanelスター 7,217(GitHub 7,217 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • 既存コードをレビューしたいとき
  • 命名や関数分割を見直したいとき
  • コメントを追加するか判断したいとき
  • 変更前後の確認項目を整理したいとき

日本語での紹介

できること

コードを書くときやレビューするときに、簡潔さと分かりやすさを保つための基準を示します。関数やモジュールの責務、変数・関数・定数の命名、関数を分割する判断、コメントに残す情報を扱います。特にコメントは、コードの説明を繰り返すのではなく、制約や意図など読み手がコードだけでは分からない理由を短く記す方針です。不要な抽象化、深いネスト、未使用のconsole.logやdebuggerなど避けたい例も挙げています。編集前には依存元や公開API、関連テストを確認し、変更後には変更内容に応じた検証を行う流れも案内します。

こんなときに便利

既存リポジトリの書き方に合わせて実装したいときや、レビューで「読みやすさ」の判断基準をそろえたいときに向いています。コメントを追加するか迷う場合や、小さな変更に対してどこまで確認すべきか判断する際にも参照できます。

使い方の例

  • 「この関数を基準に沿ってレビューして」
  • 「このコメントが必要か、ルールに照らして判断して」
  • 「変更前に確認する依存関係と、実行すべき検証を整理して」

注意点

この基準とAGENTS.mdまたはpackages/core/AGENTS.mdが食い違う場合は、両ファイルの指示が優先されます。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md5.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Clean code

Adapted from davila7/claude-code-templates (MIT). The comment rules below are this repo's own, derived from what a 2026-09-28 cleanup actually found.

AGENTS.md and packages/core/AGENTS.md are the binding contract. Where this file and either of those disagree, they win.

Core principles

PrincipleRule
SRPOne responsibility per function. But see the size note below.
DRYAt the narrowest level that fits — the module first. Never invent a cross-module abstraction for two call sites.
KISSThe simplest thing that works.
YAGNINo abstraction, parameter or hook for a need that does not exist yet.
Boy ScoutLeave what you touch cleaner — inside the task's scope only.

Naming

ElementConvention
VariablesReveal intent: userCount, not n. No abbreviations unless universal.
FunctionsVerb + noun: getUserById(), not user().
BooleansQuestion form: isActive, hasPermission, canEdit.
ConstantsSCREAMING_SNAKE, at the top of the file or in the module's <name>.constants.ts. Never a magic number inline.

If you need a comment to explain a name, rename it.

Function size — read this before splitting anything

packages/core/AGENTS.md is explicit: "a coherent 100-line function beats twenty five-line fragments. Split where a reader benefits, not to satisfy a metric."

So: no line limit. Split when a reader benefits. Keep arguments few, prefer an options object over four positionals, use guard clauses and early returns, and avoid nesting past two levels.

Comments — the part that actually goes wrong here

Comment the why, briefly: an invariant, a non-obvious side effect, a constraint that bit someone, a reason the obvious spelling is wrong. Never narrate what the code does.

These five shapes are banned. Each one was found in bulk in this repo and deleted:

BannedWhyInstead
Restating a rule from AGENTS.md — // Isomorphic by the AGENTS.md rule: zod and nothing else.True of every file of that name, machine-enforced by the constants-stay-isomorphic cruiser rule, and visible from the imports. Zero knowledge.Nothing. Delete it.
Citing a document the repo does not contain — // Cluster note (docs/ENVIRONMENT.md): …479 ADR-nnn and ~90 doc links pointed into a checkout that never ships. An unresolvable citation reads as authority it cannot back.State the fact itself, with no citation.
Provenance — // Moved from packages/db/src/services/x.service.tsSays nothing about the file you have open, and rots the moment the path moves.Nothing. git log knows.
Referring to a system that no longer exists — // exactly as V1 does, // V1's twinJustifies current behaviour by a reference point the reader cannot check.State the rule the code follows.
Task ids — // M10-005:, // P11:Meaningless outside the tracker that issued them.Nothing.

A comment that survives those five says something a careful reader could not have got from the code. That is the bar.

Anti-patterns

Don'tDo
Comment every lineDelete the obvious ones
Helper for a one-linerInline it
Factory for two objectsConstruct them directly
A utils.ts holding one functionPut it where it is used
Deep nestingGuard clauses
Magic numbersNamed constants
God functionsSplit by responsibility, not by line count
anyunknown, then narrow
as assertionsNarrowing
console.log / debugger left behindRemove before finishing

Before editing a file

AskBecause
What imports this?They may break — grep -rn "from '.*<name>'"
What does it import?An interface change ripples
What tests cover it?Run them, not the whole suite
Is it on a package's public surface?packages/core/src/index.ts and the exports map are contracts

Edit the file and every dependent in the same change. Never leave a broken import or a half-applied rename.

Before saying it is done

Run what the change warrants, from AGENTS.md's verification table — not the whole suite for a one-line fix, and always the full one for a query or ingest change:

bun run typecheck                      # always
npx ultracite fix <files you changed>  # always; they must come out clean
bun test --isolate                     # in packages/core, for backend changes
bunx vitest run                        # in apps/start, for dashboard changes
bun run check:deps                     # if you touched a package boundary

Report what you ran and what you saw. A screenshot or a query result is evidence; "should work" is not.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

merge

無料概要あり

GitHub PRの差分を確認し、変更点やアップグレード時の注意をまとめたコミットメッセージを作って、条件に応じてスカッシュマージするスキルです。

  • PRの変更点をリリースノート向けに整理したいとき
  • レビュー済みPRをスカッシュマージしたいとき
  • 必須チェックの状態を確認してからマージしたいとき
Openpanel-dev/openpanel7,2172026年10月29日 更新

pr

無料概要あり

現在のブランチをPRにし、CodeRabbitのレビューコメントを確認して妥当な指摘を修正し、判断理由の返信や再レビューへの対応まで進めます。

  • 現在のブランチをPRにしたいとき
  • 既存PRのレビュー対応を進めたいとき
  • CodeRabbitの指摘を修正・返信したいとき
Openpanel-dev/openpanel7,2172026年10月29日 更新

sdk-testbed

無料概要あり

JavaScript SDKの変更をテスト用ショップで実際に操作し、ローカルAPIを経由してClickHouseに保存されたイベントや属性を確かめます。

  • SDKイベントの保存を確かめたいとき
  • イベントのパスや属性を検証したいとき
  • 識別やセッション処理をテストしたいとき
Openpanel-dev/openpanel7,2172026年10月29日 更新

Openpanel-dev のスキルをすべて見る

このスキルの問題を報告する