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
name `Adafruit TMP117`). Guessing the library name from the repo name will produce "package not
176
+
found" build failures. Record this name and use it verbatim in Step 4 for both `platformio.ini`
177
+
and the firmware's `library.properties`.
178
+
179
+
### 0d. Gather remaining details
90
180
91
181
| What | Where to look |
92
182
|------|---------------|
93
-
| Product page | Search the web for "adafruit <SENSOR>" to find the product page. The product page (`https://www.adafruit.com/product/<PRODUCT_ID>`) html data has links to the learn guide (do not use the API or guess URLs). Use a tool like wget or curl: `curl -sL https://www.adafruit.com/product/5817 \| grep "learn.adafruit.com"` (Note: replace `5817` with the actual product ID found via search). |
94
-
| Learn guide |**Always read the learn guide before writing any code.** Fetch the text view `.md?view=all` version of the guide found on the product page (e.g., `curl -sL "https://learn.adafruit.com/<guide-slug>.md?view=all"`). The Arduino section (`## Arduino`) names the exact library to use. Do NOT skip this step even if you think you recognise a sub-component. There is also a `## Example Code` section showing the basic example sketch. |
95
-
| Adafruit Arduino library | Named in the learn guide. Or: `gh search repos "<SENSOR>" --owner adafruit`. If no dedicated library from adafruit, check related chips (e.g. TMP119 lives inside `Adafruit_TMP117`). Try partial matches like `TMP11` if exact fails. Fall back to 3rd party or ask user. |
96
183
| Library API | Read the library header on GitHub — find `begin()` signature and sensor read methods (`getEvent`, `readTempC`, etc.) |
97
184
| I2C addresses | Sensor datasheet or Adafruit product page or learn guide or driver. Check https://learn.adafruit.com/i2c-addresses/the-list|
98
185
| What it measures | Datasheet — map each reading to a subcomponent type (see table below) |
@@ -173,6 +260,13 @@ gh api repos/adafruit/<Library_Repo>/contents/examples --jq '.[].name'
173
260
section usually contains example code link showing the exact API (or embedded code if non-markdown version).
174
261
3.**Ask the user:** If tools are restricted, ask them to paste the library header and example.
175
262
263
+
**If any fetch returns a 404 or error:** Do not silently move to the next fallback and then
264
+
forget that all routes failed. If every fallback also fails, you have no verified API to code
265
+
against. **Report all failed URLs to the user** and ask them to provide the example code or
266
+
confirm the library repo name and structure. Writing driver code without having successfully
267
+
read either the example sketch or the learn guide's embedded code is forbidden — you will
268
+
produce code that calls methods which may not exist.
269
+
176
270
From the example, extract the **exact method signatures** used:
177
271
-`begin()` — what arguments, what return type
178
272
- How readings are triggered (`getEvent()`, `readMeasurement()`, `measureSingleShot()`, etc.)
@@ -194,8 +288,13 @@ gh api repos/adafruit/<Library_Repo>/contents/<Library_Name>.h --jq '.content' |
194
288
195
289
Or via WebFetch: `https://raw.githubusercontent.com/adafruit/<Library_Repo>/main/<Library_Name>.h`
196
290
197
-
If GitHub is blocked, the learn guide `.md?view=all` may contain enough API detail from code
198
-
snippets. If not, ask the user for the header content.
291
+
**If this fetch 404s**, the repo name or header filename may differ from what you assumed. Try:
292
+
1. List the repo contents: `gh api repos/adafruit/<Library_Repo>/contents --jq '.[].name'`
293
+
2. WebFetch the repo's main page to find the actual header filename
294
+
3. Fall back to the learn guide `.md?view=all` which may contain enough API detail from code snippets
295
+
296
+
If none of these work, **ask the user for the header content.** Do not proceed to write the
297
+
driver without having verified the actual method signatures.
199
298
200
299
**Explicitly set every configuration parameter that the library defaults in `begin()`/`_init()`.**
201
300
This pins behavior so library updates can't silently change WipperSnapper.
Copy file name to clipboardExpand all lines: .agents/skills/add-sensor-component-v1/evals/evals.json
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,18 @@
18
18
"prompt": "Add the BMP581 barometric pressure sensor to WipperSnapper. It measures temperature, pressure, and altitude.",
19
19
"expected_output": "Checks if driver already exists (BMP5XX covers BMP580/581/585), identifies the existing driver handles this, and advises that only a components definition may be needed if not already present.",
20
20
"files": []
21
+
},
22
+
{
23
+
"id": 4,
24
+
"prompt": "Add the AS7331 UV sensor to wippersnapper, publishing UVB as raw and debug-logging UVA/B/C on each read.",
25
+
"expected_output": "Finds the Adafruit product page, extracts the learn guide URL, reads the learn guide to confirm the library is 'Adafruit AS7331', fetches and reads the example sketch to learn the API (oneShot, readAllUV, etc.), then writes the driver. If any fetch 404s, reports the failure to the user instead of silently proceeding. Does NOT guess the GitHub URL or write code based on an unverified header file alone.",
26
+
"files": []
27
+
},
28
+
{
29
+
"id": 5,
30
+
"prompt": "Let's add the STCC4 sensor to WipperSnapper. It has an SHT41 onboard.",
31
+
"expected_output": "Does NOT assume the library is Adafruit_SHT4X based on the SHT41 sub-component. Finds the product page, reads the learn guide, and discovers the correct library is 'Adafruit_STCC4' — a dedicated library. The learn guide is the source of truth for the library name, not chip sub-component names.",
0 commit comments