Skip to content

Commit c274c12

Browse files
Add CLAUDE.md for project guidance and setup
This file provides comprehensive guidance for developers working with the DSPy Code repository, including project structure, setup instructions, development commands, code style guidelines, and documentation references.
1 parent c8b9580 commit c274c12

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed

Claude.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code when working with this repository.
4+
5+
## Project Overview
6+
7+
**DSPy Code** is an AI-powered interactive development environment (IDE) for building and optimizing DSPy applications. It provides a specialized CLI that helps developers:
8+
9+
- Develop DSPy applications using natural language
10+
- Optimize with GEPA (Genetic Pareto) workflows
11+
- Validate code against DSPy best practices
12+
- Deploy production-ready applications using MCP integration
13+
14+
**Status:** Beta (v0.1.5)
15+
**Python:** 3.10, 3.11, 3.12, 3.13
16+
17+
## Project Structure
18+
19+
```
20+
dspy-code/
21+
├── dspy_code/ # Main package
22+
│ ├── commands/ # Interactive slash commands
23+
│ ├── core/ # Core utilities and exceptions
24+
│ ├── execution/ # Code execution engine
25+
│ ├── export/ # Export/import workflows
26+
│ ├── generators/ # Code generators
27+
│ ├── mcp/ # Model Context Protocol client
28+
│ ├── models/ # LLM connection handling
29+
│ ├── optimization/ # GEPA optimization workflows
30+
│ ├── project/ # Project management
31+
│ ├── rag/ # Retrieval-Augmented Generation indexing
32+
│ ├── session/ # Session state management
33+
│ ├── templates/ # Pre-built DSPy patterns (20+)
34+
│ ├── ui/ # Terminal UI components
35+
│ ├── validation/ # DSPy code validation
36+
│ └── main.py # CLI entry point
37+
├── tests/ # Test suite
38+
├── docs/ # MkDocs documentation
39+
└── examples/ # Example scripts
40+
```
41+
42+
## Development Commands
43+
44+
### Setup
45+
46+
```bash
47+
# Using uv (recommended)
48+
uv venv
49+
source .venv/bin/activate
50+
uv pip install -e ".[dev,test,docs]"
51+
52+
# Install pre-commit hooks
53+
pre-commit install
54+
```
55+
56+
### Testing
57+
58+
```bash
59+
# Run all tests
60+
pytest
61+
62+
# Run with coverage
63+
pytest --cov=dspy_code --cov-report=html
64+
65+
# Run specific test file
66+
pytest tests/test_specific_file.py
67+
68+
# Run in parallel
69+
pytest -n auto
70+
71+
# Run by marker
72+
pytest -m unit # Unit tests only
73+
pytest -m integration # Integration tests only
74+
pytest -m "not slow" # Skip slow tests
75+
```
76+
77+
### Linting and Formatting
78+
79+
```bash
80+
# Run linter
81+
ruff check .
82+
83+
# Fix linting issues
84+
ruff check --fix .
85+
86+
# Run formatter
87+
ruff format .
88+
89+
# Type checking
90+
mypy dspy_code
91+
```
92+
93+
### Building
94+
95+
```bash
96+
# Build package
97+
python -m build
98+
99+
# Check package
100+
twine check dist/*
101+
```
102+
103+
## Code Style
104+
105+
- **Linter/Formatter:** Ruff
106+
- **Line length:** 100 characters
107+
- **Type hints:** Required for function signatures
108+
- **Docstrings:** Google-style format
109+
- **Imports:** Organized by Ruff (stdlib, third-party, local)
110+
111+
## Commit Conventions
112+
113+
Use [Conventional Commits](https://www.conventionalcommits.org/):
114+
115+
- `feat:` - New features
116+
- `fix:` - Bug fixes
117+
- `docs:` - Documentation changes
118+
- `style:` - Formatting changes
119+
- `refactor:` - Code restructuring
120+
- `test:` - Test additions/changes
121+
- `chore:` - Maintenance tasks
122+
123+
## Key Dependencies
124+
125+
- **dspy>=3.0.4** - Core DSPy framework
126+
- **click>=8.0.0** - CLI framework
127+
- **rich>=13.7.0** - Terminal UI
128+
- **mcp>=1.2.1** - Model Context Protocol
129+
- **pydantic>=2.11.0** - Data validation
130+
131+
## Important Notes
132+
133+
- This project uses `hatchling` as the build backend (no setup.py)
134+
- Entry point: `dspy-code` command maps to `dspy_code.main:main`
135+
- Tests use pytest with markers: `unit`, `integration`, `slow`
136+
- Pre-commit hooks enforce quality standards
137+
- CI requires passing all Python versions (3.10-3.13)
138+
139+
## Documentation
140+
141+
- **Main docs:** `docs/` directory (MkDocs)
142+
- **API reference:** Docstrings in source code
143+
- **Changelog:** `CHANGELOG.md` (Keep a Changelog format)
144+
- **Contributing:** `CONTRIBUTING.md`
145+
146+
## LLM Providers
147+
148+
Optional dependencies for different providers:
149+
- `dspy-code[openai]` - OpenAI support
150+
- `dspy-code[anthropic]` - Anthropic support
151+
- `dspy-code[gemini]` - Google Gemini support
152+
- `dspy-code[llm-all]` - All providers

0 commit comments

Comments
 (0)