docs: add CLAUDE.md and Claude Code skill for new sub-API authoring#2612
docs: add CLAUDE.md and Claude Code skill for new sub-API authoring#2612andersfylling wants to merge 2 commits into
Conversation
Adds two pieces of authored context for AI assistants (Claude Code in particular, but the markdown is readable by any agent that loads files): - CLAUDE.md at repo root — repo-wide conventions, the 10 hard rules (sync codegen, doctest registration, no dict[str, Any], read/write split, APIClient helpers, @overload, FeaturePreviewWarning, etc.) and BAD/GOOD anti-pattern pairs from PR #2534 review feedback. - .claude/skills/cognite-sdk-python-add-resource/ — an opt-in Claude Code skill triggered when adding a new resource group / sub-API. 16-step boilerplate checklist, decision tree (flat vs nested, alpha vs GA, chunking), and per-topic references covering the streams PR walkthrough, DTO design, wiring, alpha warnings, tests/doctests. Also gitignores .claude/settings.local.json (Claude Code per-user state). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2612 +/- ##
==========================================
- Coverage 93.02% 93.01% -0.01%
==========================================
Files 486 486
Lines 49462 49462
==========================================
- Hits 46010 46007 -3
- Misses 3452 3455 +3 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive Claude skill and supporting reference documentation to guide developers through the process of adding new sub-APIs or resource groups to the SDK. The documentation covers DTO design, wiring touchpoints, testing requirements, and alpha/beta gating strategies, using the streams implementation as a canonical reference. Additionally, the PR updates the project's .gitignore and CLAUDE.md to formalize repo-wide conventions and provide context for AI-assisted development. I have no feedback to provide.
|
Testing this out with sonnet 4.6 on high effort I asked it to implement records API with the following prompt: we will add a new api resource to build the records API. the documentation for the endpoint is a bit messy, so please spin up a sonnet subagent that can clean up data from the following before we start our plan
and figure out scope:
- # Records
> Manage records in Cognite Data Fusion (CDF).
Records are immutable or mutable data objects, depending on the stream template, that are stored in a stream. You create records by ingesting data into a stream.
For a comprehensive guide on records, including detailed behavior, uniqueness constraints, and how they relate to streams, see [About records and streams](/cdf/dm/records/concepts/records_and_streams).
Records have a similar shape to instances in the Data Modeling service, and their schema is defined by the [containers](/cdf/dm/dm_concepts/dm_containers_views_datamodels#containers) referenced as sources. Each
record also links to the [space](/cdf/dm/dm_concepts/dm_spaces_instances#space) it belongs to, enabling space-based access control.
<Note>
Every `record` has a required top-level `externalId` property, which you can use in some queries to retrieve or aggregate records.
* **Mutable records**: The `externalId` and `space` properties uniquely identify records for write operations (create/upsert/delete).
* **Immutable records**: The uniqueness of the `space` + `externalId` pair is not enforced, allowing multiple records with the same identifier to exist.
</Note>
## Rate and concurrency limits
For Records rate and concurrency limits, including mutable vs immutable stream budgets, see [API rate limits](/api-reference/concepts/20230101/rate-limits#records).
- resource markdown file can be fetched from the following which gives us several endpoints: https://docs.cognite.com/20230101/records/aggregate-records-data-from-a-stream.md
- - aggregate endpoint
- - delete records endpoint
- - ingest records into a stream endpoint
- - retrieve records from a stream endpoint
- - sync records from a stream endpoint
- - upsert records into a stream endpoint
you can skip reading changelog since this is a completely new api resource for the python sdk. Please cleanup the data in a subagent, and then write me a plan for implementation and grill me with questions till
you have a clear scope of the task.Here is the result from the first try: #2616 |
Summary
Adds two pieces of authored context that AI coding assistants pick up automatically when working in this repo:
CLAUDE.mdat repo root — repo-wide conventions in one place..claude/skills/cognite-sdk-python-add-resource/— a Claude Code skill that triggers when adding a new resource group / sub-API.Eval results
To validate that the authored context actually moves the needle, I ran a small eval suite based on different scenarios in PR reviews in the past. This is just 23 scenarios, a smaller test suite to check if this contribution is actually helpful.
The three configs:
claude.md + skill— both files present, skill triggeredclaude.md—CLAUDE.mdonly (skill dir absent, so it can't trigger)none— neither file present (raw baseline)(Sonnet low N=5 batches, Haiku N=4 batches, others N=1; ± is sample std dev.)
Takeaways:
CLAUDE.mdalone closes about half the gap, even when no skill triggers.