You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+19-6Lines changed: 19 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,22 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Overview
6
6
7
-
This is a FastAPI-based service that provides AI-powered explanations of compiler assembly output for the Compiler Explorer website. The service uses Anthropic's Claude API to analyze source code and its compiled assembly, providing educational explanations of compiler transformations and optimizations.
7
+
This is a FastAPI-based service that provides AI-powered explanations of compiler assembly output for the Compiler
8
+
Explorer website. The service uses Anthropic's Claude API to analyze source code and its compiled assembly, providing
9
+
educational explanations of compiler transformations and optimizations.
10
+
11
+
There's a prompt testing framework that allows for us to explore and improve the prompts used to generate explanations.
12
+
This framework is designed to be extensible and allows for easy addition of new tests and prompt variations.
8
13
9
14
## Project Structure
10
15
11
-
This is a FastAPI-based service that can run locally for development or as an AWS Lambda function via Mangum adapter. See the source code for current project structure.
16
+
This is a FastAPI-based service that can run locally for development or as an AWS Lambda function via Mangum adapter.
17
+
See the source code for current project structure.
12
18
13
19
## Development Commands
14
20
15
21
### Setup
22
+
16
23
```bash
17
24
# Set up environment with .env file containing:
18
25
# ANTHROPIC_API_KEY=<your-key-here>
@@ -22,6 +29,7 @@ uv sync --group dev
22
29
```
23
30
24
31
### Running Locally
32
+
25
33
```bash
26
34
# Start development server
27
35
uv run fastapi dev
@@ -33,6 +41,7 @@ uv run fastapi dev
33
41
```
34
42
35
43
### Testing
44
+
36
45
```bash
37
46
# Run tests
38
47
uv run pytest
@@ -42,6 +51,7 @@ uv run pytest app/explain_test.py::test_process_request_success
42
51
```
43
52
44
53
### Code Quality
54
+
45
55
```bash
46
56
# Run pre-commit hooks (ruff linting/formatting, shellcheck)
47
57
uv run pre-commit run --all-files
@@ -53,17 +63,20 @@ uv run ruff format
53
63
54
64
## Key Architecture Details
55
65
56
-
## Architecture Overview
57
-
58
-
The service processes compiler output through a pipeline: input validation → smart assembly filtering → Claude API call → response with metrics. See `claude_explain.md` for detailed architecture documentation.
66
+
The service processes compiler output through a pipeline: input validation → smart assembly filtering → Claude API
67
+
call → response with metrics. See `claude_explain.md` for detailed architecture documentation.
59
68
60
69
## Code Style Guidelines
61
70
62
71
- Prefer using modern Python 3.13+ type syntax. Good: `a: list[str] | None`. Bad: `a: Optional[List[str]]`
63
72
- Use ruff for linting and formatting with line length of 120 characters
64
73
- Prefer pathlib.Path over old-fashioned io like naked `open` and `glob` calls. Always supply an encoding
74
+
- Always import at the top of the file, don't litter imports throughout the file
75
+
- Strive for simplicity and clarity in code. Avoid unnecessary complexity.
76
+
- Don't assume backwards compatibility is required unless explicitly stated. Ask if unsure.
65
77
66
78
## Development Workflow Notes
67
79
68
-
- The pre-commit hooks may modify the code and so: always run them before `git add`, and if a commit hook fails then it's probably you'll need to `git add` again if it indicated it fixed issues (e.g. `ruff`)
80
+
- The pre-commit hooks may modify the code and so: always run them before `git add`, and if a commit hook fails then
81
+
it's probably you'll need to `git add` again if it indicated it fixed issues (e.g. `ruff`)
69
82
- Ruff is configured for Python 3.13+ with 120 character line length
0 commit comments