Skip to content

Commit f397f4f

Browse files
authored
Merge pull request #1121 from codeflash-ai/claude-MD
bring Claude.md in
2 parents 6b996da + f35723f commit f397f4f

File tree

3 files changed

+93
-78
lines changed

3 files changed

+93
-78
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,4 @@ WARP.MD
258258

259259
.mcp.json
260260
.tessl/
261-
CLAUDE.md
262261
tessl.json

AGENTS.md

Lines changed: 0 additions & 77 deletions
This file was deleted.

CLAUDE.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
CodeFlash is an AI-powered Python code optimizer that automatically improves code performance while maintaining correctness. It uses LLMs to generate optimization candidates, verifies correctness through test execution, and benchmarks performance improvements.
8+
9+
## Common Commands
10+
11+
```bash
12+
# Package management (NEVER use pip)
13+
uv sync # Install dependencies
14+
uv sync --group dev # Install dev dependencies
15+
uv add <package> # Add a package
16+
17+
# Running tests
18+
uv run pytest tests/ # Run all tests
19+
uv run pytest tests/test_foo.py # Run specific test file
20+
uv run pytest tests/test_foo.py::test_bar -v # Run single test
21+
22+
# Type checking and linting
23+
uv run mypy codeflash/ # Type check
24+
uv run ruff check codeflash/ # Lint
25+
uv run ruff format codeflash/ # Format
26+
27+
# Pre-commit (run before committing)
28+
uv run pre-commit run --all-files
29+
30+
# Running the CLI
31+
uv run codeflash --help
32+
uv run codeflash init # Initialize in a project
33+
uv run codeflash --all # Optimize entire codebase
34+
```
35+
36+
## Architecture
37+
38+
```
39+
codeflash/
40+
├── main.py # CLI entry point
41+
├── cli_cmds/ # Command handling, console output (Rich)
42+
├── discovery/ # Find optimizable functions
43+
├── context/ # Extract code dependencies and imports
44+
├── optimization/ # Generate optimized code via AI
45+
│ ├── optimizer.py # Main optimization orchestration
46+
│ └── function_optimizer.py # Per-function optimization logic
47+
├── verification/ # Run deterministic tests (pytest plugin)
48+
├── benchmarking/ # Performance measurement
49+
├── github/ # PR creation
50+
├── api/ # AI service communication
51+
├── code_utils/ # Code parsing, git utilities
52+
├── models/ # Pydantic models and types
53+
├── tracing/ # Function call tracing
54+
├── lsp/ # IDE integration (Language Server Protocol)
55+
├── telemetry/ # Sentry, PostHog
56+
├── either.py # Functional Result type for error handling
57+
└── result/ # Result types and handling
58+
```
59+
60+
### Key Patterns
61+
62+
**Either/Result pattern for errors:**
63+
```python
64+
from codeflash.either import is_successful, Success, Failure
65+
result = some_operation()
66+
if is_successful(result):
67+
value = result.unwrap()
68+
else:
69+
error = result.failure()
70+
```
71+
72+
**Use libcst, not ast** - Always use `libcst` for code parsing/modification to preserve formatting.
73+
74+
## Code Style
75+
76+
- **Line length**: 120 characters
77+
- **Python**: 3.9+ syntax
78+
- **Tooling**: Ruff for linting/formatting, mypy strict mode, pre-commit hooks
79+
- **Comments**: Minimal - only explain "why", not "what"
80+
- **Docstrings**: Do not add unless explicitly requested
81+
- **Naming**: Prefer public functions (no leading underscore) - Python doesn't have true private functions
82+
- **Paths**: Always use absolute paths, handle encoding explicitly (UTF-8)
83+
84+
## Git Commits & Pull Requests
85+
86+
- Use conventional commit format: `fix:`, `feat:`, `refactor:`, `docs:`, `test:`, `chore:`
87+
- Keep commits atomic - one logical change per commit
88+
- Commit message body should be concise (1-2 sentences max)
89+
- PR titles should also use conventional format
90+
91+
# Agent Rules <!-- tessl-managed -->
92+
93+
@.tessl/RULES.md follow the [instructions](.tessl/RULES.md)

0 commit comments

Comments
 (0)