UP | HOME

提示词库

Table of Contents

复制粘贴提示词到 Claude Code,按任务和角色标记

这是一个提示词库,可以复制到 Claude Code 中使用

使用它来探索你还没有尝试过的工作方式,或者当你不确定从哪里开始时

这些提示词来自各种 Anthropic 指南,包括常见工作流最佳实践Anthropic 团队如何使用 Claude Code。它们是起点而不是脚本。打开任何提示词下的 为什么这样做有效 来查看其背后的模式,这样你可以编写自己的提示词

提示词库

从这里开始

五个首先尝试的提示词

  • 在新存储库中定位

    give me an overview of this codebase: architecture, key directories, and how the pieces connect
    
  • 找到某事发生的地方

    where do we validate uploaded file types?
    
  • 找到并修复失败的测试

    the UserAuth test is failing, find out why and fix it
    
  • 编写测试、运行它们、修复失败

    write tests for app/parsers/feed.py, run them, and fix any failures
    
  • 在提交前审查你的更改

    review my uncommitted changes and flag anything that looks risky
    

理解

  • 解释不熟悉的代码

    explain what src/scheduler/queue.ts does and how data flows through it. write it up as an HTML page with a diagram, then open it in my browser
    
  • 找到某事发生的地方

    where do we validate uploaded file types?
    
  • 在删除前检查什么会破坏

    what would break if I deleted the retryWithBackoff helper?
    
  • 追踪代码如何演变

    look through the commit history of internal/auth/session.go and summarize how it evolved and why
    
  • 向代码库提出产品问题

    I am a PM. walk me through what happens when a user clicks Export to PDF, from the UI down to the result
    
  • 在开始前确定更改的范围

    which files would I need to touch to add a dark mode toggle to settings?
    

计划

  • 通过采访起草规范

    I want to build per-workspace rate limits. interview me about implementation, UX, edge cases, and tradeoffs until we have covered everything, then write the spec to SPEC.md
    
  • 将会议转变为工单

    read @meeting-notes.md and write up the action items, then create a Linear ticket for each with acceptance criteria
    
  • 在触及代码前计划多文件更改

    plan how to refactor the payment module to support multiple currencies. list the files you would change, but don't edit anything yet
    
  • 在构建前映射边界情况

    list the error states, empty states, and edge cases for the file
    

原型

  • 从屏幕截图实现并自检

    implement this design, then take a screenshot of the result, compare it to the original, and fix any differences
    
  • 将模型转变为工作原型

    here is a mockup. build a working prototype I can click through, matching the layout and states shown
    

构建

  • 遵循现有模式

    look at how the GitHub webhook handler is implemented to understand the pattern, then build a Stripe webhook handler the same way
    
  • 添加一个小的、定义明确的功能

    add a /health endpoint that returns the app version and uptime
    
  • 端到端处理问题

    read issue #312, implement the fix, and run the tests
    
  • 为未记录的代码生成文档

    find the public functions in src/auth/ without JSDoc comments and add them, matching the style already used in the file
    
  • 在代码库中查找和更新副本

    find every place we say "Sign up free" or a close variant, show me each one in context, then update them all to "Start free trial". leave tests and the changelog alone
    
  • 从过去的例子起草文档

    read the privacy impact assessments in legal/pia/ to learn the structure and voice, then draft a new one for the new analytics integration
    
  • 从头开始构建一个小的内部工具

    create a drag-and-drop Kanban board with three columns using HTML, CSS, and vanilla JavaScript, then open it in my browser
    

测试

  • 编写测试、运行它们、修复失败

    write tests for app/parsers/feed.py, run them, and fix any failures
    
  • 从测试驱动实现

    write tests for the password reset flow first, then implement it until they pass
    
  • 从覆盖率报告填补空白

    read coverage/coverage-summary.json and add tests for the lowest-covered files until each is above 80%
    

重构

  • 在代码库中迁移模式

    migrate everything from the old logging API to the structured logger: identify every place that needs to change, then make the changes
    
  • 将代码移植到另一种语言

    port this Python module to Rust, keeping the same public API and test behavior
    
  • 针对可测量目标进行优化

    optimize the search query to bring p95 latency from 2s down to under 500ms
    
  • 修复精确的视觉错误

    the login button extends 20px beyond the card border on mobile. fix it.
    

审查

  • 在提交前审查你的更改

    review my uncommitted changes and flag anything that looks risky before I commit
    
  • 审查拉取请求

    review PR #247 and summarize what changed, then list any concerns
    
  • 使用子代理运行安全审查

    use a subagent to review src/api/ for security issues and report what it finds
    
  • 在应用前审查基础设施更改

    here is my Terraform plan output. what is this going to do, and is anything here going to cause problems?
    
  • 在正式审查前捕获问题

    review launch-post.md for unsupported claims, missing attributions, and brand-guideline issues and list anything I should fix before it goes to legal
    

引导

  • 纠正错误的方法

    that is not right: the function signature needs to stay backward-compatible. try a different approach
    
  • 缩小更改的范围

    that is too much. keep only the changes to the validation logic in src/forms/ and undo your other edits
    
  • 将更正转变为规则

    you keep using default exports when this project uses named exports. add a rule to CLAUDE.md so this stops happening
    

调试

  • 找到并修复失败的测试

    the UserAuth test is failing, find out why and fix it
    
  • 调查报告的错误

    users are seeing 500 errors on /api/settings. investigate and tell me what is going on
    
  • 在根处修复构建错误

    here is a build error. fix the root cause and verify the build succeeds
    

事件

  • 调查生产事件

    the checkout endpoint started returning 500s an hour ago. check the logs, recent deploys, and config changes, then tell me the most likely cause
    
  • 从控制台屏幕截图诊断

    here is a screenshot of the GCP Kubernetes dashboard. walk me through why this pod is failing and give me the exact commands to fix it
    
  • 用纯英文查询日志

    show me all failed logins for the auth service over the past 24 hours. write the query, run it, and tell me what stands out
    

git

  • 解决合并冲突

    resolve the merge conflicts in this branch and explain what you kept from each side
    
  • 使用生成的消息提交

    commit these changes with a message that summarizes what I did
    
  • 从工单打开拉取请求

    find the Linear ticket about the login timeout and open a PR that implements it
    

发布

  • 编写CI 工作流

    write a GitHub Actions workflow that runs the tests and deploys to staging on every push to main
    
  • 从 git 历史起草发布说明

    compare v2.3.0 to v2.4.0 and draft release notes grouped by feature, fix, and breaking change
    

数据

  • 从性能数据生成变体

    read @ads-performance.csv, find the underperforming headlines, and generate 20 new variations that stay under 90 characters
    
  • 分析数据文件

    read @reports/q1-signups.csv, summarize the key patterns, and write the results to an HTML page with charts, then open it in my browser
    

自动化

  • 将重复任务转变为技能

    create a /ship skill for this project that runs the linter and tests, then drafts a commit message
    
  • 为重复行为添加钩子

    write a hook that runs prettier after every edit to a .ts or .tsx file
    
  • 使用 MCP 连接工具

    set up the Sentry MCP server so you can read my error reports directly
    
  • 捕获下次要记住的内容

    summarize what we did this session and suggest what to add to CLAUDE.md
    

产品

  • 向代码库提出产品问题

    I am a PM. walk me through what happens when a user clicks Export to PDF, from the UI down to the result
    
  • 在开始前确定更改的范围

    which files would I need to touch to add a dark mode toggle to settings?
    

文档

  • 为未记录的代码生成文档

    find the public functions in src/auth/ without JSDoc comments and add them, matching the style already used in the file
    
  • 在代码库中查找和更新副本

    find every place we say "Sign up free" or a close variant, show me each one in context, then update them all to "Start free trial". leave tests and the changelog alone
    
  • 从过去的例子起草文档

    read the privacy impact assessments in legal/pia/ to learn the structure and voice, then draft a new one for the new analytics integration
    
  • 从头开始构建一个小的内部工具

    create a drag-and-drop Kanban board with three columns using HTML, CSS, and vanilla JavaScript, then open it in my browser
    

安全

  • 使用子代理运行安全审查

    use a subagent to review src/api/ for security issues and report what it finds
    
  • 在应用前审查基础设施更改

    here is my Terraform plan output. what is this going to do, and is anything here going to cause problems?
    
  • 调查生产事件

    the checkout endpoint started returning 500s an hour ago. check the logs, recent deploys, and config changes, then tell me the most likely cause
    

这些提示词为什么有效

上面的提示词共享一些模式。识别它们有助于将此处的任何提示词调整到自己的任务

  • 描述结果,而不是步骤 :说出想要的内容,让 Claude 找到文件。下面的提示词无需命名单个文件路径即可工作

    add rate limiting to the public API and make sure existing tests still pass
    
  • 给它一种检查自己工作的方式 :在同一提示词中要求运行、测试、比较或验证,以便 Claude 迭代而不是在一次尝试后停止

    write the migration, run it against the dev database, and confirm the schema matches
    
  • 指向参考 :命名现有文件、测试或模式以匹配,以便新代码与已有的内容一致

    add a settings page that follows the same layout as the profile page
    
  • 说明可测量的目标 :当目标是性能或覆盖率时,给出指标和阈值,以便完成是明确的

    get the bundle size under 200KB and show me what you removed
    
  • 给它工件 :直接在提示词中粘贴错误、日志、屏幕截图和计划输出,或键入 @ 来引用文件。Claude 读取源而不是你对它的描述

    why is the build failing? @build.log
    
  • 说出想要答案的方式 :命名格式、长度或受众,以便解释适合你将如何使用它。要使格式成为每个响应的默认值,请设置 输出样式

    explain how the payment retry logic works as an HTML page with a diagram, then open it in my browser
    

有关每个模式的更多信息,请参阅最佳实践

这些来自哪里

这些提示词基于已发布的 Anthropic 资源中的模式。每张卡片都链接到其来源:

  • 常见工作流:核心任务的分步指南
  • 最佳实践:提示词模式和项目设置
  • Anthropic 团队如何使用 Claude Code:来自工程、产品、设计和数据团队的真实工作流,深入探讨法律、营销和网络安全
  • 扩展代理编码指南:企业采用指南

有关这些模式的视频演练,请参阅 Anthropic Academy 上的免费 Claude Code in Action 课程

Previous: 最佳实践 Home: 使用 Claude