2
0

initialize.md.tpl 2.2 KB

1234567891011121314151617181920212223242526272829
  1. Analyze this codebase and create/update **{{.Config.Options.InitializeAs}}** to help future agents work effectively in this repository.
  2. **First**: Check if directory is empty or contains only config files. If so, stop and say "Directory appears empty or only contains config. Add source code first, then run this command to generate {{.Config.Options.InitializeAs}}."
  3. **Goal**: Document what an agent needs to know to work in this codebase - commands, patterns, conventions, gotchas, overall architecture, how components fit together
  4. **Discovery process**:
  5. 1. Check directory contents with `ls`
  6. 2. Look for existing rule files (`.cursor/rules/*.md`, `.cursorrules`, `.github/copilot-instructions.md`, `claude.md`, `agents.md`) - only read if they exist
  7. 3. Identify project type from config files and directory structure
  8. 4. Find build/test/lint commands from config files, scripts, Makefiles, or CI configs
  9. 5. Read representative source files to understand code patterns, architecture, control/data flow
  10. 6. If {{.Config.Options.InitializeAs}} exists, read and improve it
  11. **Content to include**:
  12. - Essential commands (build, test, run, deploy, etc.) - whatever is relevant for this project
  13. - Code organization and structure, application architecture and control/data flow
  14. - Naming conventions and style patterns
  15. - Testing approach and patterns
  16. - Important gotchas or non-obvious patterns
  17. - Any project-specific context from existing rule files
  18. **Note:** LLM agents learn and adapt to their context as they obtain it, so mentioning obvious details they would immediately pick up from reading a file or two is actively detrimental. Keep the principles of progressive disclosure in mind and focus primarily on non-obvious knowledge that saves the agent from trial-and-error discovery: gotchas, implicit conventions, commands with surprising flags, and context that isn't self-evident from the code in a single file.
  19. **Format**: Clear markdown sections. Use your judgment on structure based on what you find. Aim for completeness over brevity - include everything an agent would need to know.
  20. **Critical**: Only document what you actually observe. Never invent commands, patterns, or conventions. If you can't find something, don't include it.