Community写作与编辑github.com

trailofbits/goal-prompt

起草可直接复制粘贴的 /goal 命令,用于 Claude Code 和 Codex 的目标模式。当用户要求创建、编写、重写、改进、压缩、清理或准备目标提示、目标条件、/goal 命令、目标模式目标或可复制的长时间运行任务目标时使用。

goal-prompt 是什么?

该技能旨在帮助用户为 AI 编码助手(如 Claude Code 和 Codex)编写高质量、可终止的 /goal 命令。其核心价值在于提供一套系统化的“目标工程”方法,包含起草、检查、格式化三个步骤。起草时,它指导用户构建包含终止状态、阅读范围、验证检查、不变量和停止条件的复合条件,并强调每个约束都必须源于用户请求或代码库,严禁发明。在“关闭捷径”环节,它引导开发者识别模型可能偷懒的常见模式(如删除而非修复、只测试子集、声称完成但无输出),并设计约束来堵住这些漏洞。格式化步骤使用一个 Python 脚本将草稿规范化为单行、不超过 4000 字符的 /goal 命令。该技能还特别为安全研究目标提供了简化建议——聚焦于一个可验证的高严重性漏洞,并要求通过独立智能体二次验证。它支持 Claude Code 和 Codex 平台,其文档清晰地解释了目标评估器的工作原理(基于对话记录,不能运行命令),从而帮助用户编写能被正确评估的目标。

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/trailofbits/skills/tree/main/plugins/goal-prompt/skills/goal-prompt

Installed? Explore more 写作与编辑 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

目标提示

/goal 让代理持续工作直至满足完成条件。Claude Code 和 Codex 均将其视为单行命令,最多 4000 字符。在 Claude Code 中,一个小模型会在每次交互后仅根据对话记录重新判断条件——它无法运行命令。

起草一个可以终止的条件,然后对其进行格式化。一个目标应适用于超过一次交互的大任务,并带有可检查的终点;将小目标串联起来并在它们之间进行审查,而不是编写一个巨大的目标。

起草

包含以下内容,用 AND 连接——永远不要用 "or",否则循环会走更便宜的分支:

  1. 结束状态,而非活动——"所有 legacyAuth() 调用点都使用 auth.verify()",而不是"迁移认证代码"。活动可以被声称完成;结束状态要么为真要么为假。
  2. 先指定阅读范围——在行动前需要阅读的文件、问题、日志或计划。
  3. 明确的检查——确切的命令及其可观察的结果("npm test 退出码为 0"),加上运行该命令并展示输出的指令;一个从未出现在对话记录中的结果对评估器来说是不存在的。
  4. 不变条件——哪些不能改变("不修改 vendor/"),始终包括"不削弱、跳过或编辑检查本身"。
  5. 停止边界或阻塞子句——"或在 20 次交互后停止","如果被阻塞,停止并报告阻塞原因"。没有它,表述错误的条件会导致无限循环;格式化程序会在缺少时发出警告。(Claude Code 在会话恢复时重置交互计数器,因此交互边界会在恢复后静默延长。)

保持精简。 每个约束都会缩小模型可以探索的状态空间。尽可能简化为一个终止标准,将范围和定义移入引用的文件中,并删除非目标项——一个约束只有在其能堵住一个真正的"捷径"时才有存在的理由。

对于长目标,还要命名最终证据(差异、报告、工件)并要求日志文件——这是跨压缩和恢复的持久状态。如果描述超过 4000 字符,将详细信息放入 GOAL.md 并从目标中引用该文件。

切勿发明缺失元素。 每个元素都必须基于用户的请求、对话或仓库——查询信息而非猜测。如果无法根据可用信息填充某个元素,仍要优化和格式化用户提供的内容,省略该元素,并将其标记为缺失(参见“格式化”)。包含虚构成功条件的目标会终止于错误的合约。

堵住捷径

在格式化之前,以一个懒惰模型的角度重新阅读起草的条件:让每个检查都通过而不做预期工作的最便宜方法是什么?堵住最便宜的几条——首选将已有的检查配对,而不是添加约束,并且不要枚举所有可以想到的捷径变成一个非目标列表。常见的捷径:

  • 删除或存根而非修复——“搜索无输出”在调用者被删除时同样成立;将此类检查与一个证明功能仍可用的检查配对。
  • 在子集上通过——运行一个测试文件,缩小搜索路径,从检查中排除目录。
  • 欺骗门控——跳过/预失败测试,硬编码预期输出,对测试输入进行特例处理,编辑检查(即不变条件规则)。
  • 声称而不运行——仅声明完成或阻塞,但没有检查输出出现在对话记录中(即展示输出规则)。

与上述相同的纪律:一个你无法从可用信息中堵住的捷径将进入 Missing: 列表作为警告——一个虚构的或荒谬的约束比一个标记出的缺口更糟糕。

安全研究目标

将审计目标简化为一个终止标准,例如识别、触发并验证一个在引用的威胁模型文件下有效的高严重性漏洞。该文件(而非目标)承载范围、攻击者能力、严重性基线和需要跳过的已知发现。使用中性措辞(“触发并验证”,而非“证明这是可利用的”),要求展示先决条件——假设的攻击者访问权限是最常见的误报——并在每个发现后停止以进行人工审查,而不是堆积未经分类的报告。通过一个全新的代理(而非原始查找者)进行二次验证来确认发现。

格式化

在草稿(文件或标准输入)上运行 uv run --no-project {baseDir}/scripts/format_goal_prompt.py --fenced。它会将空白符压缩为一行,移除 /goal 前缀、引号和围栏,在缺少停止子句时发出警告,并拒绝长度超过 4000 字符的输出——缩短或将细节移至文件后重新运行。

仅返回一个围栏的 text 代码块,一行:

/goal <单一规范化的目标>

不要在其周围添加任何散文——除非检查列表元素无法被具体化:这种情况下,在代码块后跟一个 Missing: 列表,每行一个缺口,告知用户需要提供什么。

示例

草案:

/goal 迁移认证模块:
  - 用 auth.verify() 替换 legacyAuth()
  - 确保测试仍然可用

重新起草并格式化后:

/goal 所有 legacyAuth() 调用点都使用 auth.verify():`rg "legacyAuth\(" -t ts` 打印无结果 AND `npm test` 退出码为 0(运行两者,展示输出),不修改 vendor/ 或不削弱任何测试。如果被阻塞,停止并报告尝试的路径和阻塞原因,或在 20 次交互后停止。

这里的 npm test 来自仓库的 package.json——不是猜测——并且将其与零匹配检查配对堵住了最便宜的捷径:删除调用点而不是迁移它们。当没有任何元素可以具体化时,格式化存在的内容并标记缺口:

草案:让结账更快,上下文中没有任何指标或基准:

/goal 让结账更快

缺失:

  • 可测量的结束状态——哪个指标和阈值算作“更快”
  • 验证——证明其更快的基准或命令
  • 停止边界——例如“或在 20 次交互后停止”

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

trailofbits/address-sanitizer

AddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.

trailofbits/aflpp

AFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.

trailofbits/agentic-actions-auditor

Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI Inference. Detects attack vectors where attacker-controlled input reaches AI agents running in CI/CD pipelines, including env var intermediary patterns, direct expression injection, dangerous sandbox configurations, and wildcard user allowlists. Use when reviewing workflow files that invoke AI coding agents, auditing CI/CD pipeline security for prompt injection risks, or evaluating agentic action configurations.

trailofbits/algorand-vulnerability-scanner

Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access control issues. Use when auditing Algorand projects (TEAL/PyTeal).

trailofbits/ask-questions-if-underspecified

Clarify requirements before implementing. Use when serious doubts arise.

trailofbits/atheris

Atheris is a coverage-guided Python fuzzer based on libFuzzer. Use for fuzzing pure Python code and Python C extensions.

trailofbits/audit-augmentation

Augments Trailmark code graphs with external audit findings from SARIF static analysis results and weAudit annotation files. Maps findings to graph nodes by file and line overlap, creates severity-based subgraphs, and enables cross-referencing findings with pre-analysis data (blast radius, taint, etc.). Use when projecting SARIF results onto a code graph, overlaying weAudit annotations, cross-referencing Semgrep or CodeQL findings with call graph data, or visualizing audit findings in the context of code structure.

trailofbits/audit-context-building

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

trailofbits/audit-prep-assistant

Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes dead code, ensures accessibility, and generates documentation (flowcharts, user stories, inline comments).

trailofbits/burpsuite-project-parser

Searches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting security audit findings, dumping proxy history or site map data, or analyzing HTTP traffic captured in a Burp project.

trailofbits/cairo-vulnerability-scanner

Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects.

trailofbits/cargo-fuzz

cargo-fuzz is the de facto fuzzing tool for Rust projects using Cargo. Use for fuzzing Rust code with libFuzzer backend.

trailofbits/chrome-mcp-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/claude-in-chrome-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/code-improver

Runs an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using a reviewer the user names: any installed skill or agent. Keeps a cross-round findings ledger, escalates when fixes stop converging, and guards scope mechanically. Use when asked to 'improve this code until review passes', 'run an improvement loop with <reviewer>', or to iterate review-and-fix with a specific reviewer. For skills prefer the skill-improver entry; for a branch prefer pr-improver.

trailofbits/code-maturity-assessor

Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls, complexity, decentralization, documentation, MEV risks, low-level code, and testing. Produces professional scorecard with evidence-based ratings and actionable recommendations.

trailofbits/codeql

Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "codeql analysis", "build codeql database", or "find vulnerabilities with codeql". Supports "run all" (security-and-quality + security-experimental suites) and "important only" (high-precision security findings) scan modes. Also handles creating data extension models and processing CodeQL SARIF output.

trailofbits/constant-time-analysis

Detects timing side-channel vulnerabilities in cryptographic code. Use when implementing or reviewing crypto code, encountering division on secrets, secret-dependent branches, or constant-time programming questions in C, C++, Go, Rust, Swift, Java, Kotlin, C#, PHP, JavaScript, TypeScript, Python, or Ruby.

trailofbits/constant-time-testing

Constant-time testing detects timing side channels in cryptographic code. Use when auditing crypto implementations for timing vulnerabilities.

trailofbits/cosmos-vulnerability-scanner

Scans Cosmos SDK blockchain modules and CosmWasm contracts for consensus-critical vulnerabilities — chain halts, fund loss, state divergence. 25 core + 16 IBC + 10 EVM + 3 CosmWasm patterns. Use when auditing custom x/ modules, reviewing IBC integrations, or assessing pre-launch chain security. Updated for SDK v0.53.x.

相关技能