Chat 示例提示

用自然语言和你的代码库互动,开启了一种全新的工作方式。以下是一些示例提示,帮你更高效地使用 Chat。

和代码库对话的意义

Augment 的 Chat 对你的代码库、依赖和最佳实践有深入理解。你不仅可以用它来提问代码相关的问题,它还可以帮你解答通用的软件工程问题、思考技术决策、探索新库等等。以下是一些可以用来上手的示例提示。

解释代码

  • Explain this codebase to me
    跟我解释一下这个代码库

  • How do I use the Twilio API to send a text message?
    我怎么用 Twilio API 来发送短信?

  • Explain how generics work in TypeScript and give me a simple example
    跟我讲讲 TypeScript 里的泛型是怎么工作的,并给个简单例子

查找代码

  • Where are all the useEffect hooks that depend on the ‘currentUser’ variable?
    哪些 useEffect hook 是依赖 currentUser 变量的?

  • Find the decorators that implement retry logic across our microservices
    找找我们微服务里实现重试逻辑的那些装饰器

  • Find coroutines that handle database transactions without a timeout parameter
    查一下哪些 coroutine 处理数据库事务时没有设置 timeout 参数

生成代码

  • Write a function to check if a string is a valid email address
    写一个函数,用来判断字符串是不是合法的邮箱地址

  • Generate a middleware function that rate-limits API requests using a sliding window algorithm
    生成一个中间件函数,用滑动窗口算法来限制 API 请求频率

  • Create a SQL query to find the top 5 customers who spent the most money last month
    写一条 SQL 语句,找出上个月消费最多的前五位客户

编写测试

  • Write integration tests for this API endpoint
    给这个 API endpoint 写集成测试

  • What edge cases have I not included in this test?
    这个测试还漏掉了哪些边界情况?

  • Generate mock data for testing this customer order processing function
    帮我生成些 mock 数据,用来测试这个客户订单处理函数

重构和优化代码

  • This function is running slowly with large collections - how can I optimize it?
    这个函数在处理大型集合时变慢了,有什么优化建议?

  • Refactor this callback-based code to use async/await instead
    把这段基于 callback 的代码改成用 async/await 的写法

  • Rewrite this function in Rust
    把这个函数改写成 Rust 版本

查找并修复错误

  • This endpoint sometimes returns a 500 error. Here’s the error log - what’s wrong?
    这个 endpoint 偶尔会返回 500 错,日志在这里,出什么问题了?

  • I’m getting ‘TypeError: Cannot read property ‘length’ of undefined’ in this component.
    这个组件报了一个 TypeError: Cannot read property 'length' of undefined,咋回事?

  • Getting CORS errors when my frontend tries to fetch from the API
    我前端请求 API 时遇到 CORS 错误,怎么办?