Skip to content
Back to skills

Comparison Operator

ASecurity

Prefer left-to-right ascending comparisons with less-than operators over greater-than operators, so values read in number-line order. Use when writing or reviewing comparison or range-check expressions.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
data-aiexpress

Security analysis

A100/100

Scanned November 28, 2026

npx -y skills add ncaq/konoka --skill comparison-operator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Comparison Operator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Comparison Operator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ncaq-comparison-operator/badge)](https://www.skillsdirectory.com/skills/ncaq-comparison-operator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: comparison-operator
description: Prefer left-to-right ascending comparisons with less-than operators over greater-than operators, so values read in number-line order. Use when writing or reviewing comparison or range-check expressions.
user-invocable: false
---

# 比較演算子の向き

比較を書くときは、`x > y`の形より`x < y`の形を優先してください。
`<`や`<=`を使い、左から右に向かって値が大きくなるように書きます。
頭の中の数直線上に数字を左から右へ並べて考えるので、左の方が大きいと違和感を覚えるためです。

範囲チェックでは、下限と上限を数直線の並び順に書けるので、特に読みやすくなります。

```text
// 好ましい
if (min <= x && x <= max)

// 避ける
if (x >= min && x <= max)
```

## 例外

この規則にそこまで執着はしません。
特に理由がなければ`<`や`<=`を好む、という程度の優先度です。

書いている言語で広く普及しているリンターが、
変数を右に書くのをヨーダ記法として拒否する場合などは、リンターに従ってください。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.