Skip to content

Commit 17caa5c

Browse files
authored
Merge pull request #47 from chainstacklabs/add-agents-md
Add AGENTS.md
2 parents 5517bb5 + bc61396 commit 17caa5c

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

AGENTS.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# AGENTS Guidelines for This Repository
2+
3+
This repository contains a Python-based Vercel Functions application for monitoring RPC node response times. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below to ensure smooth development and testing.
4+
5+
## 1. Use Test Scripts for Local Development
6+
7+
* **Always use the test scripts** (`test_api_read.py`, `test_api_write.py`, `test_update_state.py`) for local testing and development.
8+
* **Do _not_ deploy to Vercel during the agent session** unless explicitly requested. Deployments should be handled outside of the interactive workflow to avoid disrupting production services.
9+
* **Create a `.env.local` file** with the necessary environment variables before testing locally.
10+
11+
## 2. Keep Dependencies in Sync
12+
13+
If you add or update dependencies:
14+
15+
1. Update `requirements.txt` with the new package and version.
16+
2. Reinstall dependencies in your virtual environment with `pip install -r requirements.txt`.
17+
3. Verify compatibility with Python 3.9+ as specified in the project.
18+
19+
## 3. Coding Conventions
20+
21+
* Follow PEP 8 style guidelines.
22+
* Use type hints for all function parameters and return values.
23+
* Include Google-style docstrings for all functions and classes.
24+
* Keep cyclomatic complexity below 10 (enforced by Ruff).
25+
* Prefer composition over inheritance when designing metric classes.
26+
27+
## 4. Code Quality Checks
28+
29+
Before completing any task, run these quality checks:
30+
31+
| Command | Purpose |
32+
| --------------------- | ------------------------------------------------- |
33+
| `black .` | Format code to project standards |
34+
| `ruff check .` | Run linting checks |
35+
| `ruff check . --fix` | Auto-fix linting issues where possible |
36+
| `mypy .` | Run type checking |
37+
38+
## 5. Testing Guidelines
39+
40+
* Test new metrics locally using the appropriate test script:
41+
- `python tests/test_api_read.py` for read metrics
42+
- `python tests/test_api_write.py` for write metrics
43+
- `python tests/test_update_state.py` for state updates
44+
* Ensure `endpoints.json` is properly configured before testing.
45+
* Mock external API calls when writing unit tests.
46+
47+
## 6. Project Structure
48+
49+
When adding new features, maintain the existing structure:
50+
51+
* `/api/` - Vercel Functions entry points only
52+
* `/common/` - Shared utilities and base classes
53+
* `/metrics/` - Blockchain-specific metric implementations
54+
* `/tests/` - Test scripts
55+
56+
## 7. Environment Variables
57+
58+
Never commit credentials or secrets. Always use environment variables:
59+
60+
* Development: `.env.local` (git-ignored)
61+
* Production: Configured in Vercel dashboard
62+
* Metrics are automatically prefixed using the `METRIC_PREFIX` constant from `config/defaults.py` which reads `os.getenv("VERCEL_ENV")` (e.g., "dev_" for non-production and "" for production)
63+
64+
---
65+
66+
Following these practices ensures reliable development and prevents disruption to the production monitoring system. When in doubt, test locally before making any deployment-related changes.

0 commit comments

Comments
 (0)