创建审计代理
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 安全
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 中等消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- Windows
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第 2 阶段:生成
构建代理`.md`文件:Frontmatter:描述要求:包括3个以上具有实际用户查询、助理响应的`<example>`块,以及`<commentary>`包括所有关键路由关键字:数据库名称、表名称、模式名称、首字母缩略词
第四阶段:验证
针对新代理运行完整的 17 点审核清单(来自下面的审核模式)。报告结果。在考虑技能完成之前修复任何失败的项目。审核模式四个阶段:读取→分析→报告→修复。
第一阶段:阅读
从`$ARGUMENTS`解析审计目标:`audit <name>`→读取`.claude/agents/{name}.md``audit all`→列出并读取`.claude/agents/`中的所有`.md`文件`audit`(无目标)→将所有代理列为编号列表,询问要审计(或提供) `all`)另请阅读:
第 2 阶段:分析
运行 17 项检查,分为 5 个类别。对于每个:通过、警告或失败。
第三阶段:报告
打印结构化报告:对于`all`模式,分别打印每个座席的报告,然后是汇总表:
第 4 阶段:修复(可选)
报告后,提出修复失败的项目:“您希望我修复 {N} 个失败的项目吗?我会在申请之前显示每项建议的更改。” A4/B7(路由关键字):建议更新描述,添加缺失的术语 D14(CLAUDE.md):建议向专家部分添加代理 D15(协调器):建议向调度表添加行
# Agent Creator & Auditor
Two modes: **Create** a new agent or **Audit** an existing one.
## Examples
- `/create-audit-agent my-data-expert` -- create a new agent
- `/create-audit-agent audit my-data-expert` -- audit a specific agent
- `/create-audit-agent audit all` -- audit all agents with summary table
## Mode Selection
Parse `$ARGUMENTS`:
- `audit`, `audit <name>`, or `audit all` → **Audit mode**
- Anything else (name, description, or empty) → **Create mode**
---
# CREATE MODE
Five phases: **Gather → Reference → Generate → Register → Verify**.
## Phase 1: Gather Requirements
### 1a. Scan existing agents
List all `.md` files in `.claude/agents/` to prevent name collisions and understand existing scope.
### 1b. Ask the user
If `$ARGUMENTS` contains a name or description, use it. Otherwise, use `AskUserQuestion` with all of the following:
1. **Name**: lowercase-with-hyphens identifier (e.g., `my-data-expert`)
2. **Purpose**: What domain does this agent cover? What databases, tables, or APIs does it work with?
3. **Key routing terms**: What keywords should trigger delegation? (database names, table names, acronyms, paper names)
4. **Tools needed**: What tools should the agent have? (read-only vs full access, specific tools)
5. **Skills**: Should any skills be injected at startup? (e.g., `wrds-psql`)
6. **Model**: `inherit` (default), `sonnet`, `opus`, or `haiku`?
### 1c. Skill vs Agent decision
Before proceeding, ask: "Is this a known, rigid workflow with fixed inputs?" If yes, recommend a **skill** (`/create-skill`) instead. Agents are for tasks requiring judgment, discovery, or error recovery. Skills run in the caller's context with zero spawn overhead (75-80% fewer tokens). See `docs/AGENT_LESSONS_LEARNED.md` for rationale.
### 1d. Check for overlap
Compare the user's answers against existing agents. If there's scope overlap (same tables, same databases), warn the user and ask whether to:
- Extend the existing agent instead
- Create a new focused agent with clear scope boundaries
- Proceed anyway
## Phase 2: Generate
Build the agent `.md` file:
**Frontmatter:**
```yaml
---
name: [validated name]
description: "[WHAT + WHEN statement with 3 <example> blocks including <commentary>]"
tools: [appropriate tool list]
model: [inherit unless specified]
---
```
**Description requirements:**
- Include 3+ `<example>` blocks with realistic user queries, assistant responses, and `<commentary>`
- Include ALL key routing keywords: database names, table names, schema names, acronyms
- State WHAT the agent does and WHEN to use it
- Under 1024 characters (but multi-line with examples can be longer in practice)
**Body structure:**
```markdown
You are [role description matching frontmatter scope].
**Before running any psql query, invoke the `wrds-psql` skill** [if applicable]
## Overview
[Domain knowledge, key paper references, data sources]
## Table(s)
[Schema.table names with brief descriptions]
## Database Connection
[Connection pattern]
## [Domain-Specific Sections]
[Filters, identifiers, signal names, etc.]
## Example Queries
[2+ tested query patterns with explanations]
## Gotchas
[Data quality issues, common mistakes, edge cases]
```
**Body rules:**
- Opening paragraph must match frontmatter description scope exactly
- Under 400 lines preferred (warn at 400, fail at 600). Every line costs tokens on every spawn.
- No Windows paths, no verbose fundamentals Claude already knows
- Every paragraph must earn its token cost — if content exists in `.claude/rules/`, reference it with a one-liner instead of duplicating
- **Routing rule**: Create a corresponding entry in `.claude/rules/workflow.md` (or similar) stating WHEN to use this agent. Description-based routing is opt-in; rule-based routing is enforced.
### 3b. Show draft
Print the complete agent file to the user before writing. Ask if they want changes.
### 3c. Write
Write to `.claude/agents/{name}.md`.
## Phase 3: Register
### 4a. CLAUDE.md
Add the agent to the specialist agent list in root `CLAUDE.md` under "WRDS Database Access" (for WRDS agents) or appropriate section.
### 4b. Orchestrator dispatch table
If this is a WRDS agent, add a row to `.claude/agents/wrds-query-orchestrator.md` in the "Specialized Agents Available" table.
Print confirmation:
```
Agent created: .claude/agents/{name}.md
Lines: {count}
Registered in: CLAUDE.md, wrds-query-orchestrator.md
```
## Phase 4: Verify
Run the full 17-point audit checklist (from Audit Mode below) against the new agent. Report results. Fix any FAIL items before considering the skill complete.
---
# AUDIT MODE
Four phases: **Read → Analyze → Report → Fix**.
## Phase 1: Read
Parse the audit target from `$ARGUMENTS`:
- `audit <name>` → read `.claude/agents/{name}.md`
- `audit all` → list and read all `.md` files in `.claude/agents/`
- `audit` (no target) → list all agents as a numbered list, ask which to audit (or offer `all`)
Also read:
- Root `CLAUDE.md` to check ecosystem integration (specialist agent section)
- `.claude/agents/wrds-query-orchestrator.md` to check dispatch table (for WRDS agents, if it exists)
## Phase 2: Analyze
Run 17 checks grouped in 5 categories. For each: **PASS**, **WARN**, or **FAIL**.
### A. Frontmatter Quality
#### A1. Name Valid
- **PASS**: `name` present, matches `^[a-z][a-z0-9-]{0,63}$`, no reserved words ("anthropic", "claude"), not generic
- **WARN**: Name valid but generic (e.g., `helper`, `data-agent`, `utils`)
- **FAIL**: Missing `name`, invalid characters, or contains reserved words
#### A2. Description Present
- **PASS**: `description` present, non-empty, under 1024 characters
- **WARN**: Present but under 50 characters (likely too vague for routing)
- **FAIL**: Missing or empty
#### A3. Description Has Examples
- **PASS**: 3+ `<example>` blocks with realistic user queries and `<commentary>`
- **WARN**: 1-2 `<example>` blocks
- **FAIL**: Zero `<example>` blocks
#### A4. Routing Keywords Present
Scan body for database names, `schema.table` patterns (e.g., `contrib.global_factor`, `crsp.dsf`), key acronyms, and paper/author names. Check if each appears in the description.
- **PASS**: All key domain terms from body appear in description
- **WARN**: 1-2 key terms in body missing from description
- **FAIL**: 3+ key terms in body not in description (routing will fail — the JKP problem)
#### A5. Tools Field
- **PASS**: `tools` field present with tool list appropriate for agent's role
- **WARN**: `tools` omitted (inherits all — may be intentional but worth noting)
- **FAIL**: Role mismatch — read-only agent with Write/Edit, or WRDS agent missing Bash
### B. Body-Frontmatter Alignment
#### B6. Scope Match
Compare body opening paragraph with frontmatter description scope.
- **PASS**: Body scope matches description (same databases, same domain, same capabilities)
- **WARN**: Minor drift (body mentions something not in description, but it's related)
- **FAIL**: Body documents completely different databases/tools than description claims
#### B7. Keyword Coverage
Extract all `schema.table` patterns, database identifiers, acronyms, and domain terms from body. Compute what percentage appear in description.
- **PASS**: 90%+ of body domain terms appear in description
- **WARN**: 70-90% coverage
- **FAIL**: Under 70% (high routing failure risk)
#### B8. No Orphan Knowledge
Check if body contains substantial documentation for databases/tools/workflows NOT mentioned in the description.
- **PASS**: All body content falls within description's stated scope
- **WARN**: One tangential topic (brief mention)
- **FAIL**: Body includes substantial content outside description scope
### C. Body Quality
#### C9. Skill Invocation
- **PASS**: Body includes explicit skill invocation (e.g., "Before running any psql query, invoke the `wrds-psql` skill")
- **WARN**: Skill referenced but not as an explicit "invoke" instruction
- **FAIL**: No skill invocation for an agent that should use skills (e.g., any WRDS agent)
- **N/A**: Agent doesn't use skills (mark as PASS)
#### C10. Structured Sections
Check for organized sections with headers.
- **PASS**: Has Overview, Tables/Schema, Examples, and Gotchas sections (or equivalent)
- **WARN**: Missing 1-2 expected sections
- **FAIL**: Unstructured wall of text or only 1 section
#### C11. Example Queries
- **PASS**: 2+ example queries or code blocks that are syntactically plausible
- **WARN**: Only 1 example
- **FAIL**: No examples in body
#### C12. Line Count & Token Efficiency
Every line in an agent body is loaded on every spawn. Treat agent definitions like hot code paths.
- **PASS**: Under 400 lines; no sections that duplicate `.claude/rules/` content
- **WARN**: 400-600 lines, or body contains sections that restate rules already in `.claude/rules/` (suggest replacing with one-liner references like "See `.claude/rules/api-gotchas.md` for parameter validation")
- **FAIL**: Over 600 lines, or >50 lines duplicating rules files (move to rules, reference them)
#### C13. Anti-Patterns
Check for: Windows-style backslash paths, verbose explanations of fundamentals Claude already knows, magic numbers without justification, menus without defaults.
- **PASS**: None found
- **WARN**: 1-2 minor instances
- **FAIL**: Systemic anti-pattern usage
### D. Ecosystem Integration
#### D14. CLAUDE.md Registration
Check root `CLAUDE.md` for the agent under the specialist agent section.
- **PASS**: Listed with name and description matching the agent's actual scope
- **WARN**: Listed but description differs from agent's actual description/scope
- **FAIL**: Not listed at all
#### D15. Orchestrator Dispatch Table
For WRDS agents only: check `.claude/agents/wrds-query-orchestrator.md` dispatch table.
- **PASS**: Listed in orchestrator with matching use-case description
- **WARN**: Listed but description/scope outdated
- **FAIL**: Not in dispatch table (orchestrator won't route to it)
- **N/A**: Not a WRDS agent (mark as PASS)
### E. Cross-Agent Consistency
#### E16. Scope Overlap
Compare this agent's documented tables/schemas against all other agents.
- **PASS**: No table or schema documented in multiple agents (or overlap is an intentional cross-reference with clear ownership)
- **WARN**: 1-2 tables appear in multiple agents without clear ownership designation
- **FAIL**: Substantial schema overlap with another agent (creates routing ambiguity)
#### E17. Tool Allocation Consistency & Minimality
Each unused tool adds ~200 tokens of JSON schema to every spawn. Start minimal, add only when needed.
- **PASS**: Tool set is minimal for the agent's role; every listed tool is actually used in the agent's workflows
- **WARN**: 1-2 unnecessary tools present (e.g., WebFetch on an agent that never fetches URLs, Edit on an agent that only generates scripts)
- **FAIL**: 3+ unused tools, missing essential tools, or dangerous allocation (Write on read-only agent)
## Phase 3: Report
Print structured report:
```
AGENT AUDIT: {name}
=============================
File: .claude/agents/{name}.md | Lines: {count} | Model: {model}
A. FRONTMATTER B. ALIGNMENT C. BODY QUALITY
[PASS] A1 Name [PASS] B6 Scope [PASS] C9 Skill invocation
[PASS] A2 Description [WARN] B7 Keywords [PASS] C10 Sections
[PASS] A3 Examples [PASS] B8 Orphans [PASS] C11 Examples
[FAIL] A4 Routing [PASS] C12 Lines ({n})
[PASS] A5 Tools [PASS] C13 Anti-patterns
D. ECOSYSTEM E. CONSISTENCY
[PASS] D14 CLAUDE.md [PASS] E16 Overlap
[PASS] D15 Orchestrator [PASS] E17 Tools
SUGGESTIONS:
1. [A4] Add "contrib.global_factor" and "JKP" to description — these
key body terms are missing from routing metadata.
2. [B7] Keyword coverage is 75% — consider surfacing "permno",
"gvkey" in description.
RESULT: 15/17 passed, 1 warning, 1 failure
```
For `all` mode, print each agent's report separately, then a summary table:
```
SUMMARY: {N} agents audited
==============================
| Agent | Pass | Warn | Fail |
|-----------------------------|------|------|------|
| crsp-wrds-expert | 16 | 1 | 0 |
| jkp-wrds-expert | 17 | 0 | 0 |
| bonds-wrds-expert | 15 | 1 | 1 |
| ff-wrds-expert | 16 | 0 | 1 |
| optionmetrics-wrds-expert | 17 | 0 | 0 |
| taq-wrds-expert | 16 | 1 | 0 |
| paper-reader | 15 | 2 | 0 |
| wrds-query-orchestrator | 16 | 1 | 0 |
```
## Phase 4: Fix (Optional)
After reporting, offer to fix FAIL items:
- "Would you like me to fix the {N} FAIL items? I'll show each proposed change before applying."
- **A4/B7 (routing keywords)**: propose updated description with missing terms added
- **D14 (CLAUDE.md)**: propose adding agent to specialist section
- **D15 (orchestrator)**: propose adding row to dispatch table
- **B6 (scope mismatch)**: propose updated body opening paragraph
- Other items: describe the fix, get approval, apply
Never auto-fix without showing the proposed change first.
---
# Communication Rules
- Before Phase 1 (either mode), print: `Reading agent configuration and reference material...`
- In Create mode, always show the complete draft before writing
- In Audit mode, if auditing multiple agents, print each report separately then the summary
- If a newly created agent fails its own audit, fix it before considering the skill complete
- Use the compact report format above — avoid walls of prose
---
> Source: [Alexander-M-Dickerson/ai-asset-pricing](https://github.com/Alexander-M-Dickerson/ai-asset-pricing) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->
章节与文件索引
按说明文件中的顺序排列。
示例
模式选择
1a.扫描现有代理
1b.询问用户
1c.技能与代理决策
文件/命令 -> /create-audit-agent my-data-expert · /create-audit-agent audit my-data-expert · /create-audit-agent audit all · $ARGUMENTS · audit · audit <name> · audit all · .md
内容校验值 -> 389957747c6c
当前原文的自动摘译,尚未人工审校。
示例
/create-audit-agent my-data-expert-- 创建一个新代理/create-audit-agent audit my-data-expert-- 审核特定代理/create-audit-agent audit all-- 使用汇总表审核所有代理模式选择
解析
$ARGUMENTS:audit、audit <name>或audit all→ 审核模式 其他任何内容(名称、描述或空) → 创建模式 CREATE MODE 五个阶段:收集 → 参考 → 生成 → 注册 → 验证。1a.扫描现有代理
列出
.claude/agents/中的所有.md文件,以防止名称冲突并了解现有范围。1b.询问用户
如果
$ARGUMENTS包含名称或描述,请使用它。否则,请将AskUserQuestion与以下所有内容一起使用: 名称:带连字符的小写标识符(例如my-data-expert) 目的:此代理涵盖哪些域?它与哪些数据库、表或 API 配合使用?关键路由术语:哪些关键字应触发委托? (数据库名称、表名称、缩写词、论文名称) 所需工具: 代理应该拥有哪些工具? (只读与完全访问,特定工具)1c.技能与代理决策
在继续之前,先问:“这是一个已知的、具有固定输入的严格工作流程吗?”如果是,请推荐一项技能(
/create-skill)。代理用于需要判断、发现或错误恢复的任务。技能在调用者的上下文中运行,生成开销为零(令牌减少 75-80%)。原理请参见docs/AGENT_LESSONS_LEARNED.md。