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
docs: document LangChain 1.x import rules and parallel doc maintenance
Expand sync-langchain-docs to cover all six doc surfaces, drop README-as-
source-of-truth wording, and record which imports use langchain vs langchain_core.
Co-authored-by: Cursor <cursoragent@cursor.com>
This skill checks every Diffbot documentation file on the LangChain docs site against this repo's public API, runs the docs repo's own validators (Vale, etc.), and propagates any findings back into this repo — `README.md` and Python source files (docstrings, comments). The docs repo's validation standards apply repo-wide here.
10
10
11
-
## Source of truth (this repo)
11
+
## Package authority (this repo)
12
12
13
13
| Artifact | What it defines |
14
14
|----------|----------------|
@@ -17,17 +17,19 @@ This skill checks every Diffbot documentation file on the LangChain docs site ag
|`src/oss/python/integrations/providers/all_providers.mdx`| Card entry for Diffbot |
32
34
|`src/oss/python/integrations/tools/index.mdx`| Row in Search table + card in All tools and toolkits |
33
35
|`src/oss/python/integrations/retrievers/index.mdx`| Rows in External index table + card in All retrievers |
@@ -165,5 +167,6 @@ uv run pytest tests/unit_tests/test_readme_parity.py tests/unit_tests/test_readm
165
167
## Notes
166
168
167
169
- Fixes to `README.md` and Python source are applied directly by this skill. Fixes to `langchain-docs` files must be made there separately (this repo has no write access to the remote).
168
-
- To sync the provider hub after fixing README.md: run `/sync-langchain-docs`.
169
-
- To fix tools/retrievers deep-dive pages: edit them directly in `langchain-ai/docs`.
170
+
- To align langchain-docs pages with README.md after fixes here: run `/sync-langchain-docs`.
171
+
- To fix detail pages: edit them directly in `langchain-ai/docs`.
172
+
-**LangChain 1.x imports:** Flag `langchain.documents`, `langchain.prompts`, `langchain.runnables`, or `langchain.output_parsers` as stale — those modules do not exist. Use `langchain.messages` for message types and `langchain_core` for `Document`, prompts, parsers, and runnables. See the `sync-langchain-docs` skill for the full table.
Copy file name to clipboardExpand all lines: .claude/skills/sync-langchain-docs/SKILL.md
+51-6Lines changed: 51 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,51 @@
1
1
---
2
2
name: sync-langchain-docs
3
-
description: "Keep all Diffbot docs in sync: README.md in this repo and the three LangChain docs pages (providers, tools, retrievers). Use when code changes, when any doc page drifts, or when the user says: sync langchain docs, update the diffbot docs, sync the integration pages."
3
+
description: "Keep all Diffbot docs in sync: README.md in this repo and the LangChain docs pages (providers, tools, retrievers, chat, document loaders). Use when code changes, when any doc page drifts, or when the user says: sync langchain docs, update the diffbot docs, sync the integration pages."
|`providers/diffbot.mdx` (langchain-docs) | Docs site visitors landing on Diffbot | Overview only: install, auth, components table, links to detail pages |
17
17
|`tools/diffbot.mdx` (langchain-docs) | Docs site visitors looking for tools | Full tool documentation with examples |
18
18
|`retrievers/diffbot.mdx` (langchain-docs) | Docs site visitors looking for retrievers | Full retriever documentation with examples |
19
+
|`chat/diffbot.mdx` (langchain-docs) | Docs site visitors looking for chat models |`ChatDiffbot` instantiation, invocation, streaming, chaining |
20
+
|`document_loaders/diffbot.mdx` (langchain-docs) | Docs site visitors looking for loaders |`DiffbotExtractLoader`, `DiffbotCrawlLoader`|
19
21
20
-
**Link, don't duplicate within langchain-docs.** The provider hub names every class and links to the tools/retrievers pages; the detail pages don't repeat install/auth. The README is for a different audience and channel (GitHub/PyPI) — it can be complete without violating this rule.
22
+
**Link, don't duplicate within langchain-docs.** The provider hub names every class and links to detail pages; detail pages don't repeat install/auth. The README is for a different audience and channel (GitHub/PyPI) — it can be complete without violating this rule.
23
+
24
+
## LangChain import rules (LangChain 1.x)
25
+
26
+
Assume readers use current `langchain` and `langchain-core` releases. The slim `langchain` package (1.3+) only ships `agents`, `chat_models`, `embeddings`, `messages`, `rate_limiters`, and `tools`. Paths like `langchain.documents` or `langchain.prompts` do not exist and will fail if copied.
27
+
28
+
Use this split in **every** README and MDX example:
29
+
30
+
| Symbol | Import from |
31
+
|--------|-------------|
32
+
|`HumanMessage`, `AIMessage`, `ToolMessage`, other message types |`langchain.messages`|
from langchain_core.prompts import ChatPromptTemplate
42
+
from langchain_core.output_parsers import StrOutputParser
43
+
from langchain_core.runnables import RunnablePassthrough
44
+
```
45
+
46
+
**Docs CI note:** The langchain-docs **Check PR Imports** job only flags `langchain_core` imports that `langchain` actually re-exports (mostly `messages` and `tools`). `langchain_core.documents` and `langchain_core.prompts` are allowed and correct — do not "fix" them to nonexistent `langchain.*` paths.
47
+
48
+
**Package source code** (`langchain_diffbot/*.py`) continues to import from `langchain_core` directly; these rules apply to user-facing documentation and examples only.
21
49
22
50
## Where the docs repo lives
23
51
@@ -33,20 +61,22 @@ If that errors, ask the user for its path or to clone `git@github.com:langchain-
Also check what triggered the sync — git diff, the user's description, or a specific change — so you know what actually changed and can limit edits to what's necessary.
46
76
47
77
### Identify what needs updating
48
78
49
-
For each of the four files, decide independently whether it needs a change. Common triggers:
79
+
For each file, decide independently whether it needs a change. Common triggers:
50
80
51
81
-**New or renamed class** → update the components table in README + provider hub; add documentation to the appropriate detail page (tools or retrievers); update any import examples.
52
82
-**Behavior change to a tool or retriever** → update README + the matching detail page.
@@ -69,7 +99,7 @@ uv run pytest tests/unit_tests/test_readme_parity.py tests/unit_tests/test_readm
69
99
70
100
**providers/diffbot.mdx** — hub only. Structure:
71
101
1. Frontmatter (`title`, `description`)
72
-
2.Sync comment (keep it — see current file for wording)
102
+
2.Maintenance comment (keep it — see current file for wording; README and MDX pages are peers, not source/derived)
73
103
3. Short intro + API → class mapping table
74
104
4.`## Installation` as `<CodeGroup>` with `pip` and `uv` tabs
@@ -80,12 +110,27 @@ uv run pytest tests/unit_tests/test_readme_parity.py tests/unit_tests/test_readm
80
110
81
111
**retrievers/diffbot.mdx** — full retriever docs. Include both retriever classes, output shaping, LCEL chain usage. Link back to the provider hub for install/auth. Do not repeat tool content.
**document_loaders/diffbot.mdx** — `DiffbotExtractLoader` and `DiffbotCrawlLoader` only. Link back to the provider hub for install/auth.
116
+
83
117
MDX formatting rules (Vale enforces these — violations block the docs CI):
84
118
- Em dashes: no surrounding spaces (`word—word`, not `word — word`)
85
119
-`prebuilt` not `pre-built`
86
120
- Install blocks: `<CodeGroup>` with `pip` and `uv` tabs
87
121
- Relative links to this repo become absolute `https://github.com/diffbot/langchain-diffbot/...` URLs
88
122
123
+
### Validate imports and prose in langchain-docs
124
+
125
+
If you changed any MDX in the docs repo, run the import checker (flags only `langchain_core` imports that should be `langchain.*` re-exports) and Vale:
|`tools/diffbot.mdx` (langchain-docs) | Docs site — tools reference | Full tool documentation with examples |
63
63
|`retrievers/diffbot.mdx` (langchain-docs) | Docs site — retrievers reference | Full retriever documentation with examples |
64
+
|`chat/diffbot.mdx` (langchain-docs) | Docs site — chat model reference |`ChatDiffbot` usage |
65
+
|`document_loaders/diffbot.mdx` (langchain-docs) | Docs site — loader reference | Extract and crawl loaders |
64
66
65
67
The langchain-docs pages link to each other rather than duplicate content. Use the `sync-langchain-docs` skill to update whichever pages need it. The local docs checkout is expected at sibling `../langchain-docs` (overridable via `$LANGCHAIN_DOCS_REPO`).
66
68
69
+
**LangChain 1.x imports in docs:** Use `langchain.messages` for message types; use `langchain_core` for `Document`, prompts, output parsers, and runnables. Do not use `langchain.documents` or `langchain.prompts` — those modules do not exist in current `langchain` releases. See the `sync-langchain-docs` skill for the full table and CI notes.
70
+
67
71
**The docs repo leads on prose quality.** If validation fixes are made to the docs pages (Vale, CI, editorial review), propagate those improvements back to `README.md` — don't let the README drift to a lower standard.
68
72
69
73
Two unit suites keep the README in lockstep with the package: `tests/unit_tests/test_readme_parity.py` (the `## Components reference` table matches `__all__`, every class is documented, every example builds a client) and `tests/unit_tests/test_readme_examples.py` (every executable example runs under `respx` mocks; the crawl example is documented but not executed — flagged via `tests/readme.py`'s `is_executable`). `tests/integration_tests/test_readme_examples.py` runs the same blocks live.
0 commit comments