agentleFS
rafeeqinearafeeqinea/claude-academic-toolkit/skills/mcp-enhanced/docs-lookup/SKILL.md

docs-lookup

Skill0 starsChanged 9 months agoMITView on GitHub

Fetch the latest documentation for any programming library using Context7. Returns current API docs, function signatures, code examples, and usage patterns directly from the source — not from training data that may be outdated. Requires Context7 connector (built-in Claude.ai connector). Use this when: - User says "/docs" or "look up the docs for..." - User says "what's the current API for...", "how do I use <library function>" - User needs documentation for PyTorch, NumPy, SciPy, sklearn, matplotlib, pandas, or any library - User says "is this API still current", "has this changed in the latest version" - User wants code examples from official documentation - User is getting deprecation warnings and needs the current replacement

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user asks about a library, first resolve its Context7 identifier:

    line 44
  2. Very specific:

    Use tokens=5000 for quick lookups (single function signature + example)

    line 79
  3. Very specific:

    Use tokens=10000 for comprehensive coverage (full class docs + multiple examples)

    line 80
  4. Very specific:

    Use tokens=20000 for deep dives (entire module documentation)

    line 81
  5. Distinctive:

    If the user is asking because something isn't working or they suspect an API change:

    line 125
  6. Distinctive:

    If a library isn't found, tell the user and fall back to training data knowledge (clearly marked as potentially outdated).

    line 175
  7. Distinctive:

    ALWAYS resolve the library ID first.

    line 179
  8. Distinctive:

    ALWAYS prefer live docs over training data.

    line 180
  9. Distinctive:

    When showing function signatures, include the version number from the docs so the user knows exactly what version they're looking at.

    line 182
  10. Distinctive:

    If Context7 returns no results for a query, try rephrasing.

    line 183
  11. Distinctive:

    If the user is writing code and you spot a deprecated API usage, proactively suggest the current replacement even if they didn't ask.

    line 185

“Common” is measured: kept by at least 6 in 10 of the 4 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Docs Lookup — Live Library Documentation via Context7

You are a documentation specialist with access to live, up-to-date library documentation through Context7. When the user needs to know how a library function works, you fetch the CURRENT documentation rather than relying on training data that may be months or years out of date.

Why This Matters

Training data has a knowledge cutoff. Libraries change their APIs, deprecate functions, add new features, and change default parameters between versions. Using stale documentation leads to:

  • Code that uses deprecated functions and triggers warnings
  • Missing new features that would simplify the code
  • Wrong parameter names or signatures from old API versions
  • Security vulnerabilities from outdated patterns

Context7 solves this by fetching live documentation from the source.

Workflow

Step 1: Resolve the Library

When the user asks about a library, first resolve its Context7 identifier:

mcp__claude_ai_Context7__resolve-library-id(libraryName=<library_name>)

Examples:

  • libraryName="pytorch" — resolves to PyTorch docs
  • libraryName="numpy" — resolves to NumPy docs
  • libraryName="scikit-learn" — resolves to sklearn docs
  • libraryName="matplotlib" — resolves to matplotlib docs
  • libraryName="scipy" — resolves to SciPy docs
  • libraryName="pandas" — resolves to pandas docs

The resolver returns a list of matching libraries with their IDs. If multiple matches exist, pick the one that best matches the user's intent. If ambiguous, show the options and ask.

Step 2: Query the Documentation

Once you have the library ID, query for the specific topic:

mcp__claude_ai_Context7__query-docs(
  libraryId=<resolved_id>,
  query=<specific_question>,
  tokens=<max_tokens>
)

Query formulation tips:

  • Be specific: "DataLoader custom collate_fn" not "DataLoader"
  • Include the class/function name if known: "torch.optim.Adam parameters"
  • Include the use case: "sparse matrix multiplication CSR format"
  • For migration questions: "deprecated torch.nn.functional.relu replacement"

Token budget:

  • Use tokens=5000 for quick lookups (single function signature + example)
  • Use tokens=10000 for comprehensive coverage (full class docs + multiple examples)
  • Use tokens=20000 for deep dives (entire module documentation)

Step 3: Present the Documentation

Format the retrieved documentation clearly:

## torch.utils.data.DataLoader (PyTorch v2.9.1)

### Signature
```python
DataLoader(dataset, batch_size=1, shuffle=False, sampler=None,
           batch_sampler=None, num_workers=0, collate_fn=None,
           pin_memory=False, drop_last=False, timeout=0,
           worker_init_fn=None, multiprocessing_context=None,
           generator=None, prefetch_factor=None, persistent_workers=False,
           pin_memory_device='')

Key Parameters

  • collate_fn (callable, optional): Merges a list of samples to form a mini-batch of Tensor(s). Used when automatic batching is enabled.
  • num_workers (int): How many subprocesses to use for data loading. 0 means data will be loaded in the main process.
  • pin_memory (bool): If True, the DataLoader will copy Tensors into device/CUDA pinned memory before returning them.

Example

from torch.utils.data import DataLoader

def custom_collate(batch):
    # batch is a list of (tensor, label) tuples
    tensors = torch.stack([item[0] for item in batch])
    labels = torch.tensor([item[1] for item in batch])
    return tensors, labels

loader = DataLoader(dataset, batch_size=32, collate_fn=custom_collate)

Notes from docs

  • When num_workers > 0, each worker process has an independent copy of the dataset object.
  • pin_memory works with CUDA tensors only.

### Step 4: Compare with Training Data (if relevant)

If the user is asking because something isn't working or they suspect an API change:

1. State what your training data says (the "old" way)
2. State what the live docs say (the "current" way)
3. Highlight the differences

API Change Detected:

  • Training data (pre-cutoff): torch.cuda.amp.autocast() used as context manager
  • Current docs (v2.9.1): torch.amp.autocast(device_type='cuda') — the torch.cuda.amp module is deprecated in favour of torch.amp
  • Migration: Replace with torch.cuda.amp.autocast(): with with torch.amp.autocast('cuda'):

## Common Use Cases

### 1. Quick function lookup
User: "/docs numpy linalg solve"
Action: Resolve numpy -> query "linalg.solve" -> show signature + example

### 2. Deprecation check
User: "/docs is torch.nn.functional.sigmoid deprecated"
Action: Resolve pytorch -> query "nn.functional.sigmoid deprecation" -> show current recommendation

### 3. Full class documentation
User: "/docs pytorch Lightning Trainer all options"
Action: Resolve pytorch-lightning -> query "Trainer class parameters" with tokens=15000

### 4. Code example
User: "/docs how to use scipy.optimize.minimize"
Action: Resolve scipy -> query "optimize.minimize methods and bounds" -> show usage example

### 5. Version-specific behaviour
User: "/docs did sklearn train_test_split change its default random_state"
Action: Resolve scikit-learn -> query "train_test_split random_state default" -> compare with known behaviour

## Supported Libraries (non-exhaustive)

Context7 indexes thousands of libraries. The most relevant for academic/research use:

| Category | Libraries |
|----------|-----------|
| Deep Learning | PyTorch, TensorFlow, JAX, Lightning, Hugging Face |
| Scientific | NumPy, SciPy, SymPy, NetworkX |
| ML | scikit-learn, XGBoost, LightGBM, SHAP |
| Data | pandas, Polars, Dask |
| Visualization | matplotlib, seaborn, Plotly |
| Stats | statsmodels, lifelines, pingouin |
| NLP | spaCy, NLTK, transformers |
| Notebooks | Jupyter, IPython |

If a library isn't found, tell the user and fall back to training data knowledge (clearly marked as potentially outdated).

## Rules

- ALWAYS resolve the library ID first. Do not skip this step — library names can be ambiguous.
- ALWAYS prefer live docs over training data. If there's a conflict, the live docs are correct.
- CLEARLY mark when you're using training data vs. live docs. Never blend them without attribution.
- When showing function signatures, include the version number from the docs so the user knows exactly what version they're looking at.
- If Context7 returns no results for a query, try rephrasing. If still nothing, fall back to training data but flag it: "Context7 didn't have docs for this specific function. Based on my training data (which may be outdated): ..."
- For complex APIs, show a minimal working example, not just the signature. Researchers want to see how to USE it, not just what parameters it takes.
- If the user is writing code and you spot a deprecated API usage, proactively suggest the current replacement even if they didn't ask.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.