Skip to content

Commit d6248ac

Browse files
committed
Add AGENTS.md
1 parent 7bf2fdb commit d6248ac

File tree

1 file changed

+218
-0
lines changed

1 file changed

+218
-0
lines changed

AGENTS.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# AGENTS Guidelines for This Repository
2+
3+
This repository contains a Next.js application for listing Avalanche subnets, validators, and projects. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below for efficient development and community contributions.
4+
5+
## 1. Use Development Server for Testing
6+
7+
* **Always use `npm run dev`** for local development.
8+
* **Test changes** at http://localhost:3000.
9+
* **Do _not_ deploy to production** during agent development sessions.
10+
* **Verify JSON validity** before committing changes.
11+
12+
## 2. Keep Dependencies in Sync
13+
14+
If you update dependencies:
15+
16+
1. Install packages with `npm install`.
17+
2. Update specific packages with `npm update <package>`.
18+
3. Verify compatibility with Next.js 12 and React 17.
19+
4. Test Material-UI components after updates.
20+
21+
## 3. Development Workflow
22+
23+
Follow the Next.js workflow:
24+
25+
1. **Start dev server**: Run with hot-reload
26+
```bash
27+
npm run dev
28+
```
29+
30+
2. **Build production**: Create optimized build
31+
```bash
32+
npm run build
33+
```
34+
35+
3. **Export static**: Generate static site
36+
```bash
37+
npm run export
38+
```
39+
40+
4. **Build and export**: Combined command
41+
```bash
42+
npm run build2
43+
```
44+
45+
## 4. Adding Content
46+
47+
### Add New Subnet
48+
Edit `components/chain/subnets.json`:
49+
```json
50+
{
51+
"name": "SubnetName",
52+
"chain": "chain-identifier",
53+
"title": "Display Name",
54+
"description": "Max 150 characters",
55+
"projectURL": "https://project.com",
56+
"isLive": true,
57+
"nativeCurrency": {
58+
"name": "Token",
59+
"symbol": "TKN",
60+
"decimals": 18
61+
},
62+
"chainId": "0x12345",
63+
"rpc": "https://rpc-endpoint.com",
64+
"blockchain": "Avalanche",
65+
"subnetId": "subnet-id",
66+
"validators": 10,
67+
"faucets": ["https://faucet.com"],
68+
"explorers": ["https://explorer.com"]
69+
}
70+
```
71+
72+
### Add New Validator
73+
Edit `components/validator/validators.json`:
74+
```json
75+
{
76+
"nodeID": "NodeID-xxxxxxx",
77+
"totalStake": 23496,
78+
"feePercentage": 2,
79+
"openToValidate": true,
80+
"contactURL": "https://contact.com"
81+
}
82+
```
83+
84+
### Add New Project
85+
Edit `components/project/projects.json`:
86+
```json
87+
{
88+
"name": "Project Name",
89+
"description": "Brief description",
90+
"logo": "/logos/project.jpg",
91+
"website": "https://project.com"
92+
}
93+
```
94+
95+
## 5. File Management
96+
97+
When adding logos or images:
98+
99+
1. Place logos in `public/logos/`.
100+
2. Use JPG or PNG format.
101+
3. Optimize images for web (< 100KB preferred).
102+
4. Reference as `/logos/filename.jpg` in JSON.
103+
104+
## 6. JSON Validation
105+
106+
Before committing JSON changes:
107+
108+
* Validate JSON syntax.
109+
* Check required fields are present.
110+
* Verify chainId is in hex format (0x prefix).
111+
* Ensure URLs are valid and use HTTPS.
112+
* Test MetaMask integration if adding RPC.
113+
114+
## 7. Component Development
115+
116+
When modifying components:
117+
118+
* Follow existing structure in `components/`.
119+
* Use Material-UI components consistently.
120+
* Maintain CSS modules for styling.
121+
* Keep components modular and reusable.
122+
* Test responsive design.
123+
124+
## 8. Testing Checklist
125+
126+
Before creating PR:
127+
128+
- [ ] JSON files are valid
129+
- [ ] New subnets display correctly
130+
- [ ] MetaMask add button works
131+
- [ ] Validators list properly
132+
- [ ] Projects page loads
133+
- [ ] Mobile responsive
134+
- [ ] No console errors
135+
- [ ] Build completes successfully
136+
137+
## 9. Pull Request Guidelines
138+
139+
When submitting PR:
140+
141+
1. Fork the repository
142+
2. Create feature branch
143+
3. Make minimal changes
144+
4. Test thoroughly locally
145+
5. Submit PR with clear description
146+
6. Include relevant subnet/project details
147+
148+
## 10. Common Development Tasks
149+
150+
### Test MetaMask Integration
151+
1. Add subnet to subnets.json
152+
2. Include valid RPC and chainId
153+
3. Test "Add to MetaMask" button
154+
4. Verify network switches correctly
155+
156+
### Update Validator Information
157+
1. Edit validators.json
158+
2. Verify nodeID format
159+
3. Test contact URL
160+
4. Check display on validators page
161+
162+
### Add Project Logo
163+
1. Optimize image (< 100KB)
164+
2. Save to public/logos/
165+
3. Reference in projects.json
166+
4. Verify display on projects page
167+
168+
## 11. Code Quality Checks
169+
170+
| Command | Purpose |
171+
| ------- | ------- |
172+
| `npm run build` | Verify build succeeds |
173+
| JSON validators | Check JSON syntax |
174+
| Browser DevTools | Check for errors |
175+
| Network tab | Verify asset loading |
176+
177+
## 12. Deployment Process
178+
179+
The site auto-deploys on merge to main:
180+
181+
1. Create and test changes locally
182+
2. Submit PR with changes
183+
3. Wait for review
184+
4. Merge triggers deployment
185+
5. Verify at https://subnetlist.org
186+
187+
## 13. Useful Commands Recap
188+
189+
| Command | Purpose |
190+
| ------- | ------- |
191+
| `npm install` | Install dependencies |
192+
| `npm run dev` | Start dev server |
193+
| `npm run build` | Build production |
194+
| `npm run export` | Export static site |
195+
| `npm run build2` | Build and export |
196+
197+
## 14. Troubleshooting
198+
199+
### Common Issues
200+
201+
**"JSON parse error"**
202+
- Validate JSON syntax
203+
- Check for trailing commas
204+
- Verify quotes are proper
205+
206+
**"Build failed"**
207+
- Check all imports exist
208+
- Verify image paths
209+
- Review console errors
210+
211+
**"MetaMask add failed"**
212+
- Verify chainId format (0x)
213+
- Check RPC endpoint valid
214+
- Ensure all required fields present
215+
216+
---
217+
218+
Following these practices ensures smooth development, maintains data integrity, and enables reliable community contributions. Always validate JSON changes and test thoroughly before submitting pull requests.

0 commit comments

Comments
 (0)