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.
npx agentmods add rules/showcase-gig-platform/cursor-rules-initializer/test-rulegit clone --depth 1 https://github.com/showcase-gig-platform/cursor-rules-initializerWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02238 |
| Opus 5 | $0.00000 | $0.01119 |
| Sonnet 5 | $0.00000 | $0.00448 |
| Haiku 4.5 | $0.00000 | $0.00224 |
Grade A, and why
test-rule 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.
How it starts
The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.
テスト規則
テストファイルの命名規則
- テストファイルは実装ファイルと同じディレクトリに配置する
- ファイル名は
{実装ファイル名}_test.goとする - 例:
order_service.go→order_service_test.go
テスト関数の命名規則
- テスト関数名は
Testで始める - 構造体のメソッドをテストする場合:
Test_{構造体名}_{メソッド名}- 例:
Test_orderService_CreateOrder
- 例:
- パッケージ関数をテストする場合:
Test{関数名}- 例:
TestNewOrderState
- 例:
- 複数のテストケースを持つ場合は、
t.Run()のサブテスト名に日本語で説明的な名前を付ける- 例:
"正常系: 注文作成"、"異常系: 在庫不足"
- 例:
テスト構造
- テーブル駆動テスト(Table-Driven Tests)を推奨する
- テストケースを構造体のスライスとして定義
- 各テストケースに名前 (
name)、入力 (args)、期待される出力 (want*)、期待されるエラー (wantErr) を含める
t.Run()を使用して各テストケースをサブテストとして実行する- 複雑なセットアップやアサーションはヘルパー関数に切り出す
テーブル駆動テストの例
func TestOrderService_CreateOrder(t *testing.T) {
type fields struct { // モック化する依存関係
orderRepo repository.OrderRepository
itemRepo repository.ItemRepository
}
type args struct { // テスト対象メソッドの引数
ctx context.Context
req *usecase.CreateOrderRequest
}
tests := []struct {
name string
fields fields // モックの期待動作設定用
args args
want *usecase.CreateOrderResponse
wantErr bool // エラー発生を期待するかどうか
// wantErrIs as error // 特定のエラー型を期待する場合 (errors.Is)
// wantErrMsg string // 特定のエラーメッセージを期待する場合 (strings.Contains)
}{
{
name: "正常系: 注文作成",
fields: fields{
// モックリポジトリのEXPECT設定
},
args: args{
ctx: context.Background(),
req: &usecase.CreateOrderRequest{ /* ... */ },
},
want: &usecase.CreateOrderResponse{ /* ... */ },
wantErr: false,
},
// 他のテストケース...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
// モックの準備 (tt.fields を使用)
mockOrderRepo := mock_repository.NewMockOrderRepository(ctrl)
// mockOrderRepo.EXPECT()...
// テスト対象のサービス/メソッドを初期化
s := &OrderService{
orderRepo: mockOrderRepo,
// ...
}
// テスト実行
got, err := s.CreateOrder(tt.args.ctx, tt.args.req)
// アサーション
if (err != nil) != tt.wantErr {
t.Errorf("CreateOrder() error = %v, wantErr %v", err, tt.wantErr)
return
}
// if tt.wantErrIs != nil && !errors.Is(err, tt.wantErrIs) {
// t.Errorf("CreateOrder() error = %v, wantErrIs %v", err, tt.wantErrIs)
// }
// if tt.wantErrMsg != "" && !strings.Contains(err.Error(), tt.wantErrMsg) {
// t.Errorf("CreateOrder() error = %v, wantErrMsg %q", err, tt.wantErrMsg)
//}
// 戻り値の比較 (ポインタや複雑な構造体は go-cmp を推奨)
if diff := cmp.Diff(tt.want, got, cmpopts.IgnoreUnexported(/* 必要に応じて */)); diff != "" {
t.Errorf("CreateOrder() mismatch (-want +got):\n%s", diff)
}
})
}
}
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.
- 2d ago First seen · 169 lines · 2,238 tokens per session scan A ae8514ec5139
test-rule is a cursor rule published in the GitHub repository showcase-gig-platform/cursor-rules-initializer (7 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,238 tokens. 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.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.