AgentSkillsCN

ensuring-prompt-quality

在 .agents/ 中创建或编辑规则、技能、代理、命令后,按照最佳实践进行验证,以确保质量。

SKILL.md
--- frontmatter
name: ensuring-prompt-quality
description: Validates prompt files against best practices. Use after creating or editing rules, skills, agents, commands in .agents/ for quality review.
compatibility: Claude Code
allowed-tools: Read Grep Glob WebFetch WebSearch

Prompt Quality Skill

プロンプトファイルの品質を検証するスキルです。

記載ルール

作成・編集時は以下のルールを参照:

検証観点

#観点概要
1明確性と具体性曖昧な表現を避け、具体的な指示
2構造化と可読性適切な見出し、500行以下
3具体例の提供Before/After 形式のコード例
4スコープの適切性タスク非依存、リポジトリレベル
5Progressive Disclosure参照1階層、100行超は目次
6重複と矛盾の回避DRY原則
7Workflow & Feedback Loopsチェックリスト、検証ループ
8命名とパス適用gerund形式、paths/globs
9アクション指向動詞から始まる指示
10メタデータの完全性第三人称、トリガー含む
11トーンと文体命令形、一貫性
12テンプレートと例出力形式テンプレート
13アンチパターン検出Windows パス、時間依存
14簡潔性既知情報の繰り返しなし

詳細は参照ファイルを確認:

Workflow

品質検証時にこのチェックリストをコピー:

code
Quality Validation:
- [ ] Step 1: ファイルタイプを特定(skill/rule/agent/command)
- [ ] Step 2: 対応するルールを参照
- [ ] Step 3: メタデータを検証
- [ ] Step 4: コンテンツを検証(14観点)
- [ ] Step 5: ファイルサイズを確認
- [ ] Step 6: レポートを生成

Step 1: ファイルタイプを特定

bash
# パスからタイプを判定
.agents/skills/    → Skill
.agents/rules/     → Rule
.agents/agents/    → Agent
.agents/commands/  → Command
.cursor/agents/    → Cursor Subagent

Step 2: 対応するルールを参照

bash
Read: references/writing-{type}.md

Step 3: メタデータを検証

bash
# 一人称・二人称チェック
grep -n "I can\|I will\|You can\|You should" [file]

# 第三人称 + トリガー確認
grep -n "description:" [file]

チェック項目:

  • name: 64文字以内、小文字・数字・ハイフン
  • description: 第三人称、トリガー含む、1024文字以内
  • paths/globs/allowed-tools: 適切に設定

Step 4: コンテンツを検証

bash
# 曖昧表現
grep -i "できれば\|なるべく\|maybe\|perhaps" [file]

# Windows パス
grep -n "\\\\" [file]

# 時間依存情報
grep -ni "before.*20[0-9][0-9]\|after.*20[0-9][0-9]" [file]

# Workflow チェックリスト
grep -n "- \[ \]" [file]

Step 5: ファイルサイズを確認

bash
wc -l [file]
# 500行以下推奨

Step 6: レポートを生成

report-template.md 形式で出力。

If validation fails, identify issues and recommend fixes.

クイック検証

単一ファイルの簡易チェック:

bash
# 行数
wc -l [file]

# メタデータ
head -10 [file]

# アンチパターン
grep -n "I can\|You can\|\\\\" [file]

エージェント固有機能

Claude Code Memory Hierarchy

メモリの優先度順(高い順):

  1. Enterprise Policy: 組織レベルの設定
  2. Project Memory: CLAUDE.md(プロジェクトルート)
  3. Project Rules: .claude/rules/*.md
  4. User Memory: ~/.claude/rules/*.md

再帰的読み込み: 親ディレクトリの CLAUDE.md も自動読み込み

CLAUDE.local.md: .gitignore 対象の個人用メモリ

インポート構文:

markdown
@docs/architecture.md        # 相対パス
@~/.claude/preferences.md    # ホームディレクトリ
  • 最大5階層まで

Quick Memory: # プレフィックスで即座にメモリに追加

code
# このプロジェクトでは pnpm を使用

Cursor Subagents

保存場所: .cursor/agents/ または ~/.cursor/agents/

メタデータ:

yaml
---
name: code-reviewer
description: Reviews code for quality and best practices
model: claude-3-opus         # 使用モデル
readonly: true               # ファイル編集不可
is_background: false         # バックグラウンド実行
---

特徴:

  • コンテキスト分離
  • 並列実行サポート
  • 特化した専門性

Cursor Team Rules

優先順位: Team Rules > Project Rules > User Rules

管理方法: Cursor ダッシュボードで設定

GitHub Copilot Custom Agents

テンプレートライブラリ (4種類):

  • Your first custom agent
  • Implementation planner
  • Bug fix teammate
  • Cleanup specialist

allowed-tools 構文詳細 (Agent Skills)

yaml
allowed-tools:
  - Read                     # 全ファイル読み取り可
  - Write                    # 全ファイル書き込み可
  - Bash(pattern:npm*)       # npm で始まるコマンドのみ
  - Bash(pattern:git*)       # git で始まるコマンドのみ

パターン構文: Bash(pattern:GLOB) 形式で許可するコマンドを制限

参照ファイル