backend-conventions
Skill1 starsChanged 7 months agoMITView on GitHub
Scraper contract, fetch/retry, state persistence, and feed generation conventions for anthropic-watch
6 other projects use a version of this.
Adopted by
Most recently taken up by
- jbouder/skillstheir own version, first seen Nov 1, 2026
- fpindej/netrocktheir own version, first seen Oct 8, 2026
- flntfnd/claude-skillstheir own version, first seen Aug 20, 2026
- ryokkon624/scrum-agent-basetheir own version, first seen Jul 9, 2026
- getsentry/sentrytheir own version, first seen Jun 30, 2026
- sefaertunc/Worclaudetheir own version, first seen Apr 28, 2026
Used with
Projects with it also use frontend-conventions.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
CloudflareSkillfrontend-conventions
Use for creating, modifying, moving, or reviewing React frontend code anywhere in packages/*, including Workshop pages, gatekeeper management apps, shared UI, components, hooks, forms, interactions, styling, accessibility, and frontend tests.
Also in 3 projects that use this
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- getsentry/sentry★ 46ksame name
- fpindej/netrock★ 234same name
- sefaertunc/Worclaude★ 4same name
- jbouder/skills★ 1same name
- flntfnd/claude-skills★ 0same name
- ryokkon624/scrum-agent-base★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-routingSkill
- claude-md-maintenanceSkill
- coding-principlesSkill
- context-managementSkill
- coordinator-modeSkill
- frontend-design-systemSkill
- git-conventionsSkill
- memory-architectureSkill
- planning-with-filesSkill
- project-patternsSkill
- prompt-engineeringSkill
- review-and-handoffSkill
- security-checklistSkill
- subagent-usageSkill
- testingSkill
- verificationSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Every scraper is a function with a fixed signature:
- Very specific: line 28
IDs must be stable: Don't use timestamps or random values.
- Very specific: line 29
datemay benull: when the source legitimately has no per-item date (e.g. - Very specific: line 34
All HTTP goes through src/fetch-with-retry.js, accessed via src/fetch-source.js (which adds fixture injection for tests).
- Very specific: line 46
Never call fetch directly from a scraper — always route through fetchSource(url, options, fixtureFile) so test fixtures work.
- Very specific: line 65
State is append-only: Never delete keys. If a source is removed from sources.js, its state entry stays — the source may come back.
- Very specific: line 74
Read existing feed file → extract items array
- Very specific: line 96
All results collected via Promise.allSettled — one failure never aborts the others
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Backend Conventions — anthropic-watch
This project is a scraper pipeline, not a web service. There is no HTTP API, no database, no auth. Backend conventions here cover scrapers, fetching, state, and feed generation.
Authoritative deep-dive: docs/ARCHITECTURE.md. This document is the working-memory summary for agents.
Scraper Contract
Every scraper is a function with a fixed signature:
- Input: source config object from
src/sources.js(must includekey,category,name, and type-specific fields) - Output:
Array<Item>on success; throws on failure - Item shape: 8 fields —
id,title,date,url,snippet,source,sourceCategory,sourceName
Rules:
- Never wrap scraper logic in
try/catch { return [] }. Let errors propagate. The orchestrator'sPromise.allSettledcaptures them, records the real message, and incrementsconsecutiveFailures. The v1.0.1 silent-failure bug was caused by scrapers catching their own errors. - Empty array return means "no items right now" — it is not a failure signal. Return
[]when the source is live but has nothing new. - IDs must be stable. Don't use timestamps or random values. Use source-natural IDs:
tag_name, post URL, version string, incident ID, heading text. Use SHA-256 hashes only as a fallback when no natural ID exists. datemay benullwhen the source legitimately has no per-item date (e.g. the models reference table). Never fake a date.snippetmax 300 chars, may be"". Plain text only — markdown or HTML in snippets breaks RSS consumers.
Fetching
All HTTP goes through src/fetch-with-retry.js, accessed via src/fetch-source.js (which adds fixture injection for tests).
- Max retries: 2 (3 total attempts)
- Backoff: linear — 1s, 2s
- Timeout: 15s per request (
AbortSignal.timeout) - Retries on: 5xx, network errors, 429
- On 429,
Retry-Afterheader (seconds) overrides linear backoff for that attempt
- On 429,
- Does not retry: other 4xx — returned immediately
- Redirects:
redirect: "follow"by default; scrapers can override - User-Agent: derived from
package.jsonversion at module load (anthropic-watch/${version} (…)) - GitHub rate limit:
logGitHubRateLimit(res)warns when remaining quota < 10
Never call fetch directly from a scraper — always route through fetchSource(url, options, fixtureFile) so test fixtures work.
State
State lives in state/last-seen.json and is managed by src/state.js.
Per-source entry:
{
"knownIds": ["id-1", "id-2"],
"lastChecked": "2026-04-16T06:00:00.000Z",
"consecutiveFailures": 0,
"lastSuccess": "2026-04-16T06:00:00.000Z"
}Rules:
- State is append-only. Never delete keys. If a source is removed from
sources.js, its state entry stays — the source may come back. loadState()returns{}on ENOENT. Missing file is safe; pipeline treats everything as new. Malformed JSON throws and halts the pipeline.recordFailure()runs unconditionally on rejected scraper promises, including first runs. There is no "first-run heuristic" — that was removed in v1.0.1.- Warning threshold:
consecutiveFailures >= 3triggers::warningannotations in the GitHub Actions job summary.
Feed Generation (src/feed/)
Accumulation model, applied identically to JSON and RSS:
- Read existing feed file → extract
itemsarray - Prepend new items:
[...newItems, ...existingItems] - Dedup by
${id}|${source}— first-seen wins, so the freshly scraped copy overwrites the persisted one - Sort by
datedescending (nulls last) - Slice: 100 for
all.*, 50 for per-source
The new-wins semantics matter for in-place edits like [Unreleased] changelog sections — the latest snippet replaces the stale one.
Error Handling Philosophy
- No shared error class hierarchy. Plain
Errorwith descriptive messages. Don't introduceScraperError,FetchError, etc. - Two levels:
- Scraper level: let errors propagate — no outer
try/catch. - Orchestrator level:
src/index.jsprocessesPromise.allSettledresults. Rejected promises have_sourceand_durationMsattached viaObject.assign(err, { … });err.messageis written tosourceResults[].error.
- Scraper level: let errors propagate — no outer
- Logging:
src/log.jsprovideslog.info/log.warn. Don't useconsole.*directly in source code — tests capture log output.
Concurrency
runWithConcurrency(tasks, 4) in src/index.js:
- 4 scrapers in flight at once
Setof in-flight promises;Promise.racewaits for one to finish before launching the next- All results collected via
Promise.allSettled— one failure never aborts the others .catch(() => {})on the race is intentional: it prevents unhandled rejection (the real error is captured byallSettled)
Dependencies Policy
Runtime deps are cheerio + fast-xml-parser only. Dev deps are vitest + yaml. Adding a new dep requires:
- A concrete use case existing tools can't cover
- A CHANGELOG entry in the same PR explaining why
- Preference for Node built-ins first (
node:crypto,node:fs/promises,node:path,node:url)
Naming
- File names: kebab-case (
fetch-with-retry.js,github-releases.js) - Function names: camelCase (
runPipeline,fetchSource,markSeen) - Source keys: kebab-case matching the feed filename (
blog-engineering,api-sdk-py-releases) - Parse modes: kebab-case string literals (
nextjs-rsc,intercom-article,model-table) - Constants:
UPPER_SNAKE_CASEwhen module-level, otherwise named like the value
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

