enhance-agent-prompts by avifenesh/awesome-slash
npx skills add https://github.com/avifenesh/awesome-slash --skill enhance-agent-prompts分析智能体提示文件,遵循提示工程最佳实践。
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';
const fix = args.includes('--fix');
const verbose = args.includes('--verbose');
| 平台 | 全局 | 项目 |
|---|---|---|
| Claude Code | ~/.claude/agents/*.md | .claude/agents/*.md |
| OpenCode | ~/.config/opencode/agents/*.md | .opencode/agents/*.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Codex | ~/.codex/skills/ | AGENTS.md |
--fix 标志,则应用自动修复---
name: agent-name # 必需:kebab-case
description: "What and when" # 必需:何时使用(参见"实习生测试")
tools: Read, Glob, Grep # 必需:受限列表
model: sonnet # 可选:opus | sonnet | haiku
---
模型选择:
工具语法: Read, Read(src/**), Bash(git:*), Bash(npm:*)
"实习生测试" - 是否有人仅凭描述就能调用此智能体?
# 差
description: Reviews code
# 好 - 触发条件、能力、排除范围
description: Reviews code for security vulnerabilities. Use for PRs touching auth, API, data handling. Not for style reviews.
必需部分: 角色("你是...")、输出格式、约束
位置感知顺序(LLM 对开头/结尾的记忆优于中间部分):
使用肯定而非否定:
使用强约束性语言:
对于重要规则,说明原因 - 动机能提高遵守率。
最小权限原则:
| 智能体类型 | 工具 |
|---|---|
| 只读 | Read, Glob, Grep |
| 代码修改器 | Read, Edit, Write, Glob, Grep |
| Git 操作 | Bash(git:*) |
| 构建/测试 | Bash(npm:*), Bash(node:*) |
问题:
Bash 无作用域 → 应为 Bash(git:*)Task → 子智能体不能生成子智能体20 个工具 → 增加错误率("少即是多")
context: fork # 用于详细输出的隔离上下文
Task)跨平台模式:
| 平台 | 主智能体 | 子智能体 |
|---|---|---|
| Claude Code | 默认 | 通过 Task 工具 |
| OpenCode | mode: primary | mode: subagent |
| Codex | 技能 | MCP 服务器 |
当有 5 个以上部分、混合列表/代码或多个阶段时,使用 XML 标签:
<role>You are...</role>
<workflow>1. Read 2. Analyze 3. Report</workflow>
<constraints>- Only analyze, never modify</constraints>
不必要: 简单任务(<500 词)、单步、机械性任务 缺失: 复杂分析(>1000 词)、多步推理、"分析/评估/评定"
最佳:2-5 个示例。<2 个不足,>5 个造成令牌膨胀。
对于迭代智能体:最大迭代次数、完成标准、退出条件。
## 错误处理
- 暂时性错误:最多重试 3 次
- 验证错误:报告,不重试
- 工具失败:在失败前尝试替代方案
Bash 和用户参数的智能体:验证输入| 问题 | 修复 |
|---|---|
| 缺少前置元数据 | 添加 name, description, tools, model |
| 无限制的 Bash | Bash → Bash(git:*) |
| 缺少角色 | 添加"## 你的角色"部分 |
| 弱约束 | "should" → "MUST" |
## Agent Analysis: {name}
**File**: {path} | **Model**: {model} | **Tools**: {tools}
| Certainty | Count |
|-----------|-------|
| HIGH | {n} |
| MEDIUM | {n} |
### Issues
| Issue | Fix | Certainty |
| 类别 | 模式数量 | 确定性 |
|---|---|---|
| 前置元数据 | 5 | 高 |
| 结构 | 3 | 高 |
| 指令 | 3 | 高 |
| 工具 | 4 | 高 |
| 安全性 | 2 | 高 |
| 子智能体 | 3 | 中 |
| XML/思维链/示例 | 4 | 中 |
| 错误/循环 | 3 | 中 |
| 反模式 | 3 | 低 |
| 总计 | 30 | - |
<bad_example>
description: Reviews code
</bad_example> <good_example>
description: Reviews code for security. Use for PRs touching auth, API, data. Not for style.
</good_example>
<bad_example>
name: json-formatter
model: opus # 对于机械性任务来说过于强大
</bad_example> <good_example>
name: json-formatter
model: haiku # 简单,机械性
</good_example>
<bad_example>
- Try to validate inputs when possible
</bad_example> <good_example>
- MUST validate all inputs before processing
</good_example>
<bad_example>
context: fork
tools: Read, Glob, Task # 不允许使用 Task
</bad_example> <good_example>
context: fork
tools: Read, Glob, Grep
</good_example>
agent-docs/PROMPT-ENGINEERING-REFERENCE.md - 指令、XML、示例agent-docs/CLAUDE-CODE-REFERENCE.md - 前置元数据、工具、子智能体agent-docs/FUNCTION-CALLING-TOOL-USE-REFERENCE.md - "实习生测试"、安全性agent-docs/OPENCODE-REFERENCE.md - 模式、权限agent-docs/CODEX-REFERENCE.md - 技能触发每周安装数
1
代码仓库
GitHub 星标数
550
首次出现
1 天前
安全审计
安装于
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1
Analyze agent prompt files for prompt engineering best practices.
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';
const fix = args.includes('--fix');
const verbose = args.includes('--verbose');
| Platform | Global | Project |
|---|---|---|
| Claude Code | ~/.claude/agents/*.md | .claude/agents/*.md |
| OpenCode | ~/.config/opencode/agents/*.md | .opencode/agents/*.md |
| Codex | ~/.codex/skills/ | AGENTS.md |
---
name: agent-name # Required: kebab-case
description: "What and when" # Required: WHEN to use (see "Intern Test")
tools: Read, Glob, Grep # Required: restricted list
model: sonnet # Optional: opus | sonnet | haiku
---
Model Selection:
Tool Syntax: Read, Read(src/**), Bash(git:*), Bash(npm:*)
The "Intern Test" - Can someone invoke this agent given only its description?
# Bad
description: Reviews code
# Good - triggers, capabilities, exclusions
description: Reviews code for security vulnerabilities. Use for PRs touching auth, API, data handling. Not for style reviews.
Required sections: Role ("You are..."), Output format, Constraints
Position-aware order (LLMs recall START/END better than MIDDLE):
Positive over negative:
Strong constraint language:
Include WHY for important rules - motivation improves compliance.
Principle of Least Privilege:
| Agent Type | Tools |
|---|---|
| Read-only | Read, Glob, Grep |
| Code modifier | Read, Edit, Write, Glob, Grep |
| Git ops | Bash(git:*) |
| Build/test | Bash(npm:*), Bash(node:*) |
Issues:
Bash without scope → should be Bash(git:*)Task in subagent → subagents cannot spawn subagents20 tools → increases error rates ("Less-is-More")
context: fork # Isolated context for verbose output
Task in tools)Cross-platform modes:
| Platform | Primary | Subagent |
|---|---|---|
| Claude Code | Default | Via Task tool |
| OpenCode | mode: primary | mode: subagent |
| Codex | Skills | MCP server |
Use XML tags when 5+ sections, mixed lists/code, or multiple phases:
<role>You are...</role>
<workflow>1. Read 2. Analyze 3. Report</workflow>
<constraints>- Only analyze, never modify</constraints>
Unnecessary: Simple tasks (<500 words), single-step, mechanical Missing: Complex analysis (>1000 words), multi-step reasoning, "analyze/evaluate/assess"
Optimal: 2-5 examples. <2 insufficient, >5 token bloat.
For iterating agents: max iterations, completion criteria, escape conditions.
## Error Handling
- Transient errors: retry up to 3 times
- Validation errors: report, do not retry
- Tool failure: try alternative before failing
Bash + user params: validate inputs| Issue | Fix |
|---|---|
| Missing frontmatter | Add name, description, tools, model |
| Unrestricted Bash | Bash → Bash(git:*) |
| Missing role | Add "## Your Role" section |
| Weak constraints | "should" → "MUST" |
## Agent Analysis: {name}
**File**: {path} | **Model**: {model} | **Tools**: {tools}
| Certainty | Count |
|-----------|-------|
| HIGH | {n} |
| MEDIUM | {n} |
### Issues
| Issue | Fix | Certainty |
| Category | Patterns | Certainty |
|---|---|---|
| Frontmatter | 5 | HIGH |
| Structure | 3 | HIGH |
| Instructions | 3 | HIGH |
| Tools | 4 | HIGH |
| Security | 2 | HIGH |
| Subagent | 3 | MEDIUM |
| XML/CoT/Examples | 4 | MEDIUM |
| Error/Loop | 3 | MEDIUM |
| Anti-Patterns | 3 | LOW |
| Total | 30 |
<bad_example>
description: Reviews code
</bad_example> <good_example>
description: Reviews code for security. Use for PRs touching auth, API, data. Not for style.
</good_example>
<bad_example>
name: json-formatter
model: opus # Overkill for mechanical task
</bad_example> <good_example>
name: json-formatter
model: haiku # Simple, mechanical
</good_example>
<bad_example>
- Try to validate inputs when possible
</bad_example> <good_example>
- MUST validate all inputs before processing
</good_example>
<bad_example>
context: fork
tools: Read, Glob, Task # Task not allowed
</bad_example> <good_example>
context: fork
tools: Read, Glob, Grep
</good_example>
agent-docs/PROMPT-ENGINEERING-REFERENCE.md - Instructions, XML, examplesagent-docs/CLAUDE-CODE-REFERENCE.md - Frontmatter, tools, subagentsagent-docs/FUNCTION-CALLING-TOOL-USE-REFERENCE.md - "Intern Test", securityagent-docs/OPENCODE-REFERENCE.md - Modes, permissionsagent-docs/CODEX-REFERENCE.md - Skill triggersWeekly Installs
1
Repository
GitHub Stars
550
First Seen
1 day ago
Security Audits
Gen Agent Trust HubPassSocketFailSnykPass
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
60,400 周安装
| - |