push_rules

A project rule requiring checks before code is committed and pushed. For this Deno project, the required checks are formatting, linting, and the full test suite; new functions also need documentation and tests.

In plain words
What is it for?
Use it while changing the Slack utilities project to run `deno fmt --check`, `deno lint`, and `deno test --allow-all`, and to guide function comments and test files.
Why use it?
It reduces the chance of sending code that fails automated checks or lacks coverage for normal and error cases.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/leaveanest/slack-utils-channel/push_rules
Clone the repo
git clone --depth 1 https://github.com/leaveanest/slack-utils-channel

Made for: Cursor.

Per session 2,210 This file is loaded in full into every session.
When invoked 2,210 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02210 $0.02210
Opus 5 $0.01105 $0.01105
Sonnet 5 $0.00442 $0.00442
Haiku 4.5 $0.00221 $0.00221

Measured 2d ago against content hash f4eaa7a38cda, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

push_rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/push_rules.mdc · 260 lines

How it starts

The opening of the file, as written. The whole thing — 260 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cursor Rules for slack-utils

コミット前の必須チェックリスト

重要: git push する前に必ず以下のコマンドをローカルで実行し、全てがパスすることを確認してください。

必須実行コマンド

# 1. フォーマットチェック
deno fmt --check

# 2. リントチェック
deno lint

# 3. 全テスト実行
deno test --allow-all

ワークフロー

  1. コードを変更
  2. 上記3つのコマンドを実行
  3. 全てパスしたことを確認
  4. git add .
  5. git commit -m "..."
  6. git push

理由

CIでのフォーマットエラーやテスト失敗を防ぐため、ローカルで事前に全てのチェックを実行する必要があります。

プロジェクト情報

  • このプロジェクトはDenoプロジェクトです
  • package.json は存在しません
  • 改行コードはLF(Unix形式)に統一されています
  • Slackチャンネル名は #05-miyazawa です

新規関数作成時のルール

重要: 新しい関数やモジュールを作成する際は、必ず以下を実施してください。

必須事項

  1. 関数にJSDocコメントを追加

    • 関数の目的と動作を説明する
    • パラメータの説明を @param で記載
    • 戻り値の説明を @returns で記載
    • エラーの場合は @throws で記載
    /**
     * Slackチャンネルの情報を取得します
     *
     * @param client - Slack APIクライアント
     * @param channelId - 取得対象のチャンネルID
     * @returns チャンネルの概要情報
     * @throws {Error} チャンネル情報の取得に失敗した場合
     */
    export async function retrieveChannelSummary(
      client: SlackAPIClient,
      channelId: string,
    ): Promise<ChannelSummary> {
      // ...
    }
    
  2. テストファイルを作成

    • 関数と同じディレクトリに test.ts を配置
    • 正常系と異常系の両方をテスト
    • テスト名は日本語で明確に記述(例: "正常にチャンネル情報を取得できる")
    • モックを使用して外部依存を排除
  3. テストカバレッジ

    • 主要な処理パスをカバーする
    • エッジケースやエラーハンドリングもテスト
    • 最低限、正常系1つ・異常系1つを含める

テストファイルの命名規則

  • 関数ファイル: mod.ts または {function_name}.ts
  • テストファイル: test.ts または {function_name}_test.ts
  • テストファイルは関数ファイルと同じディレクトリに配置

参考例

functions/get_channel_info/ を参照してください:

  • mod.ts: JSDocコメント付きの関数実装
  • test.ts: 正常系・異常系のテストケース

I18n(多言語対応)ルール

重要: エラーメッセージやユーザー向けメッセージを記述する際は、必ず以下を実施してください。

必須事項

  1. 直接文字列を使わず t() 関数を使用

    • ハードコードされた文字列は避ける
    • 全てのユーザー向けメッセージは翻訳可能にする
    // ❌ 悪い例
    throw new Error("Failed to load channel info");
    
    // ✅ 良い例
    import { t } from "../../lib/i18n/mod.ts";
    throw new Error(t("errors.channel_not_found", { error }));
    
  2. 英語をベース言語として locales/en.json に追加

    • 新しいメッセージは必ず locales/en.json に追加
    • 適切なカテゴリ(errors, messages, logs)に配置
    • プレースホルダーは {変数名} の形式で記述

Read the full file on GitHub · 260 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 260 lines · 2,210 tokens per session scan A f4eaa7a38cda

Subscribe to this mod's changes

push_rules is a cursor rule published in the GitHub repository leaveanest/slack-utils-channel (4 stars, last pushed 2mo ago), licensed MIT. It adds 2,210 tokens to every session, about $0.0111 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.