pi --tools read,grep,find,ls -p "Review this codebase. Focus on: correctness, readability, performance, security. For each issue, provide: file:line, problem, suggested fix, severity (high/medium/low)."
pi -p "I have a bug: [describe symptom]. Find the root cause and propose a fix. Do not modify code yet, just explain the issue."
确认后再让它改:
1
pi -p "Apply the fix we discussed. Run npm run check after the change."
工作流 3:重构(Refactoring)
1
pi -p "Refactor the function calculateTotal() in src/utils.ts. Goals: improve readability, add type safety, reduce cyclomatic complexity. Keep behavior unchanged."
验证步骤:
1
pi -p "Run npm test and confirm all tests pass."
工作流 4:测试补全
1
pi -p "Add unit tests for src/services/userService.ts. Use the existing test framework (Jest). Cover: happy path, edge cases, error handling."
工作流 5:文档生成
1
pi -p "Generate API documentation for src/routes/*.ts. Use Markdown format. Include: endpoint, method, parameters, response example, error codes."
工作流 6:日志分析
1
pi -p "Analyze the last 100 lines of logs/app.log. Find the top 3 most frequent errors and their root causes."
工作流 7:依赖升级
1
pi -p "Check package.json for outdated dependencies. List: package, current version, latest version, breaking changes (if any). Do not upgrade yet."
确认后:
1
pi -p "Upgrade the dependencies we discussed. Run npm run check after each major upgrade."
工作流 8:新功能开发
1
pi -p "Implement a new feature: user profile page. Requirements: display user info, allow avatar upload, show activity history. Follow the existing code style. Create necessary files and update routing."
工作流 9:数据库迁移审查
1
pi -p "Review the migration file migrations/20260810_add_users.sql. Check for: data loss risks, missing indexes, backward compatibility."
工作流 10:生产事故排查
1
pi --tools read,grep,find,ls -p "We have a production issue: users report 500 errors on /api/checkout. Analyze the code path and logs. Do not modify code, just diagnose."