← Reddit

Best practice for code libraries

Reddit · FrostingPlayful6160 · May 14, 2026
A scientist describes seeking efficiency improvements when using Claude for learning research-grade code libraries used intermittently across fragmented projects. The repeated token expenditure of retraining Claude on the same libraries motivated inquiry into whether saved documentation or reusable skills could eliminate the need for repeated deep dives into repositories across multiple projects.

Detailed Analysis

A scientist working with research-grade code libraries raises a practical and underexplored challenge in AI-assisted development workflows: the token cost and inefficiency of repeatedly orienting Claude to the same third-party libraries across fragmented, infrequent use cases. The poster's situation — using specialized equipment-interfacing or data analysis libraries for only a few sessions per year — represents a common pattern among domain experts who rely on AI coding assistants not as full-time developers but as occasional technical translators between their scientific intent and unfamiliar codebases. Each new session effectively resets Claude's contextual understanding of the library, forcing a redundant "deep dive" that consumes significant tokens before any productive work begins.

The question centers on whether artifacts like `CLAUDE.md` files or skill-like knowledge stores can be persisted and reused across projects to short-circuit this repetitive onboarding. `CLAUDE.md` is a project-level configuration file recognized by Claude Code that allows users to embed persistent context — including documentation summaries, coding conventions, library quirks, and usage patterns — directly into a project's working environment. The strategy the poster is intuiting is essentially the creation of a portable, library-specific knowledge document: a curated summary of the library's architecture, key APIs, common patterns, and gotchas that can be dropped into any new project's `CLAUDE.md` without requiring Claude to re-explore the source repository from scratch.

This approach reflects a broader emerging practice in agentic AI workflows sometimes called "context engineering" — the deliberate crafting of reusable, structured context artifacts that minimize redundant reasoning and token consumption across sessions. Rather than treating each conversation as a blank slate, practitioners are developing personal or team-level knowledge bases that prime AI assistants with domain-specific information upfront. For scientists and researchers in particular, this matters because their toolchains often involve niche, poorly documented libraries maintained by small academic teams, where Claude's ability to synthesize sparse documentation and source code is especially valuable — but only if that synthesis doesn't need to be repeated every single session.

The underlying tension highlighted by this use case points to a current architectural limitation in most AI coding tools: the absence of a native, persistent, cross-project memory layer for technical knowledge. While `CLAUDE.md` provides a workable manual solution, it places the burden of knowledge curation and portability entirely on the user. The broader AI development community is actively working on more automated solutions — including retrieval-augmented generation systems, long-term memory modules, and project-spanning context stores — that could eventually allow tools like Claude Code to automatically recognize and reuse previously learned library knowledge without manual intervention. The scientist's workflow represents a real-world stress test of where current tooling falls short for non-developer expert users.

Read original article →