on main help sign in
chore: improve initialize
commitec9f94fb6c48cc86f836e03c487c0670f212aeef authorKujtim Hoxha <kujtimii.h@gmail.com> dateMon 27 Oct 2025, 09:12 (1 year ago) parentca09597
1 file changed+24−6
internal/agent/templates/initialize.md+24−6
internal/agent/templates/initialize.md+24−6
@@ -1,9 +1,27 @@
1−Please analyze this codebase and create a **CRUSH.md** file containing:
1+Analyze this codebase and create/update **CRUSH.md** to help future agents work effectively in this repository.
22
3−- Build/lint/test commands - especially for running a single test
4−- Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
3+**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 CRUSH.md."
54
6−The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 20-30 lines long.
7−If there's already a **CRUSH.md**, improve it.
5+**Goal**: Document what an agent needs to know to work in this codebase - commands, patterns, conventions, gotchas.
86
9−If there are Cursor rules (in `.cursor/rules/` or `.cursorrules`) or Copilot rules (in `.github/copilot-instructions.md`), make sure to include them.
7+**Discovery process**:
8+
9+1. Check directory contents with `ls`
10+2. Look for existing rule files (`.cursor/rules/*.md`, `.cursorrules`, `.github/copilot-instructions.md`, `claude.md`, `agents.md`) - only read if they exist
11+3. Identify project type from config files and directory structure
12+4. Find build/test/lint commands from config files, scripts, Makefiles, or CI configs
13+5. Read representative source files to understand code patterns
14+6. If CRUSH.md exists, read and improve it
15+
16+**Content to include**:
17+
18+- Essential commands (build, test, run, deploy, etc.) - whatever is relevant for this project
19+- Code organization and structure
20+- Naming conventions and style patterns
21+- Testing approach and patterns
22+- Important gotchas or non-obvious patterns
23+- Any project-specific context from existing rule files
24+
25+**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.
26+
27+**Critical**: Only document what you actually observe. Never invent commands, patterns, or conventions. If you can't find something, don't include it.