Overseas access: www.kdjingpai.com
Bookmark Us
Current Position:fig. beginning " AI Answers

如何自定义Grok CLI的项目特定行为?

2025-08-21 349

Grok CLI提供了灵活的自定义机制,允许用户针对不同项目设置特定的行为规则。配置方式如下:

1. 配置文件位置:

In the project root directory, create the.grok/GROK.mdfile

2. 配置内容格式:

使用Markdown格式编写配置规则,例如:

# Custom Instructions for Grok CLI
- Always use TypeScript for new code files.
- Use functional components with hooks for React.
- Add JSDoc comments for public functions.

3. 常见配置项:

  • 代码风格规范(缩进、命名约定等)
  • 首选技术栈(如React函数组件)
  • 文档标准(如JSDoc格式)
  • 项目特有命令别名

4. 生效方式:

Grok CLI会自动检测项目目录下的配置文件,并优先应用这些规则。例如,当在React项目中输入”创建新组件”时,Grok CLI会根据配置自动生成函数组件而非类组件。

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish