Skip to content

docs(skills): add agent skills for the SDK#34

Closed
IgorShevchik wants to merge 6 commits into
mainfrom
claude/implement-skills-structure-nBN5h
Closed

docs(skills): add agent skills for the SDK#34
IgorShevchik wants to merge 6 commits into
mainfrom
claude/implement-skills-structure-nBN5h

Conversation

@IgorShevchik
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a top-level skills/ directory mirroring the layout used in bitrix24/b24ui/skills: index.json manifest + a single b24-jssdk skill with SKILL.md and references/.
  • The skill teaches when to use which entry point and method (decision matrices, conventions, recipes). Detailed API references live in packages/jssdk/README-AI.md and the docs site — SKILL.md links out to them rather than duplicating.
  • 17 files, ~1346 lines of markdown, English (consistent with README-AI.md, AGENTS.md, CLAUDE.md).

Layout:

skills/
├── index.json
└── b24-jssdk/
    ├── SKILL.md                      # routing table + core rules + install
    └── references/
        ├── api-surface.md            # categorized index of public exports
        ├── guidelines/  (5 files)    # entry-points, conventions, error-handling,
        │                             # rate-limiting, logger
        └── recipes/     (9 files)    # frame-apps, webhook-server, oauth-apps,
                                      # batch-calls, list-pagination, ui-integrations,
                                      # helper-manager, pull-client, nuxt-module

Test plan

  • Read skills/b24-jssdk/SKILL.md end-to-end — routing table covers expected agent tasks
  • Spot-check a few references against packages/jssdk/README-AI.md and the source under packages/jssdk/src/ for factual accuracy
  • Verify index.json lists every file under skills/b24-jssdk/ (17 entries total when including SKILL.md + 16 reference files)
  • Confirm all relative cross-links between SKILL.md and reference files resolve

Notes for reviewers

A few facts worth a second pair of eyes (flagged here because they were inferred from README-AI.md and source-tree shape rather than confirmed line-by-line):

  • references/recipes/oauth-apps.md — the B24OAuth constructor signature in the example is left as a comment placeholder; if you want the exact args spelled out, please point at the canonical form and I'll fill it in.
  • references/recipes/list-pagination.md — claims idKey: 'id' (lowercase) for crm.item.list payloads vs default 'ID' for legacy crm.deal.list-style methods; worth a quick sanity check.
  • references/guidelines/rate-limiting.md — uses ParamsFactory.getForEnterprise() as the enterprise preset name; confirm the actual export name.

Generated by Claude Code

claude added 2 commits May 15, 2026 17:00
Mirrors the b24ui skills layout: a top-level `skills/` directory with
`index.json` and a single `b24-jssdk` skill. The skill teaches *when* to
use each entry point and method (decision matrices, conventions,
recipes); detailed API references live in README-AI.md and the docs
site.

Structure:
- skills/index.json
- skills/b24-jssdk/SKILL.md (routing table, install, core rules)
- references/api-surface.md (categorized export index)
- references/guidelines/ (entry-points, conventions, error-handling, rate-limiting, logger)
- references/recipes/ (frame-apps, webhook-server, oauth-apps, batch-calls,
  list-pagination, ui-integrations, helper-manager, pull-client, nuxt-module)
Skill content was using the deprecated AbstractB24 call*/batch*/list*
methods (scheduled for removal in v2.0.0). Rewrite all recipes,
guidelines, and the API surface index against the current
b24.actions.v{2,3}.{call,callList,fetchList,batch,batchByChunk}.make
managers.

- frame-apps, webhook-server, oauth-apps, batch-calls, list-pagination,
  nuxt-module recipes: switch every example to actions.make form.
- conventions, api-surface, error-handling: rewrite the REST surface
  section; flag the legacy call* methods explicitly.
- rate-limiting: fix ParamsFactory.getEnterprise() (was wrongly named
  getForEnterprise), add getBatchProcessing / getRealtime /
  fromTariffPlan, use $b24.setRestrictionManagerParams.
- oauth-apps: spell out the real B24OAuth constructor signature, cover
  setCallbackRefreshAuth / setCustomRefreshAuth / RefreshTokenError.
- SKILL.md: update core rules to point at actions managers; note the
  README-AI.md deprecation mismatch.
- AGENTS.md: add a "Agent skills" section pointing readers at skills/.
@IgorShevchik IgorShevchik force-pushed the claude/implement-skills-structure-nBN5h branch from 6929ddb to ed3fe12 Compare May 15, 2026 17:08
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Addressed the review's correctness issues (1–3) and the housekeeping points (4–5) in a follow-up commit ed3fe12.

What changed

1. All examples now use b24.actions.* instead of the deprecated call* methods.

AbstractB24.callMethod / callBatch / callListMethod / fetchListMethod / callBatchByChunk are scheduled for removal in v2.0.0 and log deprecation warnings. The skill was teaching the legacy API. Rewrote every example to:

  • b24.actions.v3.call.make({ method, params, requestId }) / v2.call.make(...) — single calls
  • b24.actions.v{2,3}.callList.make({ method, params, idKey, customKeyForResult, requestId }) — in-memory list
  • b24.actions.v{2,3}.fetchList.make(...) — async generator stream
  • b24.actions.v{2,3}.batch.make({ calls, options: { isHaltOnError, returnAjaxResult, requestId } }) — supports array-of-tuples, array-of-objects, and named-object input shapes
  • b24.actions.v{2,3}.batchByChunk.make(...) — auto-chunked, array shapes only

Files rewritten: conventions.md, frame-apps.md, webhook-server.md, oauth-apps.md, batch-calls.md, list-pagination.md, nuxt-module.md, api-surface.md, error-handling.md. The legacy call* family is now explicitly flagged as deprecated in conventions.md and in each recipe's anti-patterns list.

Added a note to SKILL.md that README-AI.md's examples still use the legacy API — that's a separate doc-debt and probably warrants its own PR.

2. ParamsFactory.getEnterprise() (not getForEnterprise) plus the full preset list.

The actual ParamsFactory exposes getDefault(), getEnterprise(), getBatchProcessing(), getRealtime(), fromTariffPlan(plan). rate-limiting.md now documents all five with when-to-use guidance. Examples were updated to call $b24.setRestrictionManagerParams(...) (the actual method on AbstractB24) rather than the imaginary getHttpClient().setRestrictionManagerParams(...). Also added a one-liner on retryOnNetworkError from PR #32.

3. Real B24OAuth constructor.

oauth-apps.md now spells out:

new B24OAuth(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret, options?: { restrictionParams?: Partial<RestrictionParams> })

Plus coverage of setCallbackRefreshAuth (persist rotated tokens), setCustomRefreshAuth (custom refresh flow), initIsAdmin, and the typed RefreshTokenError (vs catching generically). error-handling.md was updated to match.

4. Rebased onto origin/main.

Picked up v1.1.1 + the limiter changes from #32. Force-pushed with --force-with-lease. mergeable_state is now blocked (was behind before the rebase) — assuming that's branch-protection requiring a review rather than a conflict; let me know if I'm wrong.

5. AGENTS.md updated.

Added skills/ to the repository structure tree + a new "Agent skills" section pointing to skills/b24-jssdk/SKILL.md as the entry point. The b24ui repo has a similar paragraph in its agent docs.

Still outstanding

  • idKey casing claim from the first review note — confirmed against the source: v2 default is 'ID', v3 default is 'id', and crm.item.list (a v2 method that happens to return lowercase fields) needs explicit idKey: 'id'. list-pagination.md documents this explicitly.
  • README-AI.md update — separate PR. Want me to file it?

Diff: 6929ddb...ed3fe12 (12 files, +632/-275).


Generated by Claude Code

README-AI.md had an accurate deprecation banner at the top but every
example below it still used the legacy AbstractB24.call*/batch*/list*
methods scheduled for removal in v2.0.0. AI agents reading the file
would pattern-match the examples, not the banner.

- Replace every example with b24.actions.v{2,3}.{call,callList,
  fetchList,batch,batchByChunk}.make({ ... }) form.
- Document all three batch input shapes (tuples, objects, named).
- Add a B24OAuth section: real constructor signature,
  setCallbackRefreshAuth, setCustomRefreshAuth, RefreshTokenError.
- Add a rate limiting section pointing at ParamsFactory presets and
  $b24.setRestrictionManagerParams.
- Cross-link to skills/b24-jssdk/SKILL.md (the agent-routing companion).
- Fix the broken "// fix" code block and the wrong `import Text from`
  default-import.
- Update the export map: drop deprecated call* / paging helpers, add
  action option types, RefreshTokenError, ParamsFactory.

Skill back-ports:
- AjaxResult.isMore/getNext/getTotal noted as v2-only in SKILL.md,
  conventions.md, and list-pagination.md (v3 has no next/total
  envelope; aggregate replaces getTotal).
- Drop stale "README-AI uses deprecated API" notes — no longer true.
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Pushed 3d6e9c3 — rewrites packages/jssdk/README-AI.md against the current b24.actions.* API, plus a small skill back-port for one fact I'd gotten wrong.

Why this change belongs in this PR

README-AI.md was the actual root cause of the deprecated-API problem in the first version of the skill. The file had a correct deprecation banner at the top, but every example beneath it still used $b24.callMethod(...) / $b24.callBatch(...) etc. — and CLAUDE.md points readers there as "the authoritative API guide for callers." Any LLM (or human) following the banner reads "deprecated, use b24.actions.*" then immediately sees ten examples using the deprecated form. The pattern wins.

Fixing both the skill and its upstream source in one atomic change is better than landing the skill against a doc that still teaches the wrong thing.

What changed in README-AI.md

  • Every example switched to b24.actions.v{2,3}.{call, callList, fetchList, batch, batchByChunk}.make({ ... }) form. The legacy call* API is still documented (in the deprecation banner) — but never demonstrated in code.
  • Added a complete B24OAuth section: real constructor (authOptions, oAuthSecret, options?), setCallbackRefreshAuth (persist rotated tokens), setCustomRefreshAuth, initIsAdmin, and the typed RefreshTokenError.
  • Added a rate-limiting section pointing at ParamsFactory.{getDefault, getEnterprise, getBatchProcessing, getRealtime, fromTariffPlan} and $b24.setRestrictionManagerParams.
  • Documented all three batch.make input shapes (tuples / object array / named object) since callBatch was the only place the old README spelled them out.
  • Cross-link to skills/b24-jssdk/SKILL.md near the top — the skill is the agent-routing companion ("when") to README-AI ("how").
  • Fixed the stranded // fix code block in the "Core utilities" section and the wrong import Text from '@bitrix24/b24jssdk' (it's a named export, not default).
  • Updated the export map: dropped the deprecated call* family, added action option types, RefreshTokenError, ParamsFactory, the limiter classes.

Length: 602 → 778 lines (more concrete examples + the new sections).

Skill back-port

One factual correction I noticed while reading the new README's deprecation banner more carefully: AjaxResult.isMore() / getNext() / getTotal() are v2-only. They rely on the v2 next / total envelope fields; v3 returns no next cursor and uses the aggregate action for counts. My skill (and core rule #6) implied they worked uniformly across versions. Fixed in:

  • SKILL.md — core rule Initialisation of main SDK object by complete webhook url  #6 now flags them as v2-only and deprecated.
  • references/guidelines/conventions.md — same correction in the Result / AjaxResult section.
  • references/recipes/list-pagination.md — the "Manual paging" recipe is now explicitly marked v2-only with the v3 alternative spelled out.

Also dropped now-stale notes in the skill that said "README-AI.md still uses the deprecated API" — no longer true after this commit.

What's next

After this PR is merged I'd suggest two small follow-ups (separate PRs, none mandatory):

  1. CI grep for deprecated forms in docs. A two-line job that searches for $b24.callMethod(, $b24.callBatch(, etc. in docs/, skills/, and packages/*/README*.md, excluding lines that contain deprecated or legacy. Catches the regression I caused.
  2. docs/content/docs/2.working-with-the-rest-api/*.md frontmatter links:. Each REST-API page could link to the matching recipe in the skill. Tightens the docs ↔ skill ↔ source triangle.

Both are tiny; happy to take them if you want.

Diff: ed3fe12...3d6e9c3 (5 files, +493/−315). Total PR diff: cbd83944...3d6e9c3 (19 files, +1881/−315, 3 commits).


Generated by Claude Code

Each page in docs/content/docs/2.working-with-the-rest-api/ now points
at the matching recipe or guideline in skills/b24-jssdk/. Closes the
docs ↔ skill ↔ source triangle suggested in PR #34 review.

Mapping:
- call (v2, v3)              → guidelines/conventions
- callList / fetchList       → recipes/list-pagination
- batch / batchByChunk       → recipes/batch-calls
- frame, frame-initialize    → recipes/frame-apps
- frame-dialog/options/parent/placement/slider → recipes/ui-integrations
- 66.logger.md               → guidelines/logger
- 77.limiters.md             → guidelines/rate-limiting

Pages without prior `links:` block get one; pages with existing links
get one new entry appended (so the source link, type links, and MDN
references stay primary).
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Pushed 872ec7a — adds skill cross-links to each docs/content/docs/2.working-with-the-rest-api/*.md page via the existing links: frontmatter (follow-up #2 from the previous comment).

Mapping

Docs page(s) Skill reference
1.call-rest-api-ver{2,3}.md guidelines/conventions.md
2.call-list-rest-api-ver{2,3}.md, 2.fetch-list-rest-api-ver{2,3}.md recipes/list-pagination.md
3.batch-rest-api-ver{2,3}.md, 4.batch-by-chunk-rest-api-ver{2,3}.md recipes/batch-calls.md
30.frame-initialize-b24-frame.md, 30.frame.md recipes/frame-apps.md
31.frame-{dialog,options,parent,placement,slider}.md recipes/ui-integrations.md
66.logger.md guidelines/logger.md
77.limiters.md guidelines/rate-limiting.md

19 pages touched, +62/−0. Entries appended to existing links: blocks; a links: block added where none existed (30.frame.md, 30.frame-initialize-b24-frame.md, 31.frame-options.md, 31.frame-parent.md, 31.frame-placement.md).

Skipped

  • 31.frame-auth.md — auth in frame is meaningfully different from auth in OAuth/Hook; linking to recipes/oauth-apps.md from there would be misleading.
  • tools-health-check.md, tools-ping.md — niche utilities, no dedicated skill recipe; mentioning them only in api-surface.md.

If you want either of these linked anyway, point me at the target and I'll add it.

What's left in this PR

  • Original skills addition + the README-AI rewrite + these doc cross-links.
  • Commits: 6929ddb (skills) → ed3fe12 (API rewrite) → 3d6e9c3 (README-AI) → 872ec7a (doc cross-links). 4 in total.
  • Total: 38 files, +1943/−315 vs cbd83944 (current main).

Pre-merge could squash these four into a single commit if you prefer linear history — let me know.


Generated by Claude Code

v2 and v3 are independent endpoints, not old-vs-new. The previous skill
text framed v3 as "new code" and v2 as "fall back when v3 doesn't have
it"; in practice v3 today supports only tasks.task.* / main.eventlog.*
and a few meta endpoints — everything else (CRM, IM, user, profile,
placement, options) is v2-only.

Restructure:
- Add skills/b24-jssdk/references/recipes/rest-api-v2.md — full v2
  surface (call, callList, fetchList, batch, batchByChunk) with code.
- Add rest-api-v3.md — mirror, leads with the supported method list
  and a "prefer v2" steer.
- Slim batch-calls.md and list-pagination.md to decision pages that
  point at the v2/v3 examples.
- Update conventions.md, api-surface.md, SKILL.md (routing table +
  core rule #5) to reflect the v2-by-default story.
- index.json: add the two new files.

Bug fixes (v3.* calls that would throw at runtime):
- webhook-server.md: v3.batch.make with crm.item.list -> v2.batch.make.
- oauth-apps.md: v3.call.make with user.current -> v2.call.make (x2).
- error-handling.md: v3.call.make with crm.item.get and user.current,
  v3.batch.make with crm.item.list -> v2.*.
- README-AI.md: same set of v3->v2 swaps; v3 batch examples retained
  only where the methods are actually v3-supported.
- frame-apps.md: drop the stale per-action bullet list, point at the
  rest-api-v2/v3 recipes.

OAuth corrections (signatures were wrong):
- setCallbackRefreshAuth callback signature is
  ({ authData, b24OAuthParams }) => Promise<void>, not (newAuth) =>.
- setCustomRefreshAuth callback takes no args:
  () => Promise<HandlerRefreshAuth>.
- Fill in the real B24OAuthParams / B24OAuthSecret example fields
  (applicationToken, memberId, expires, scope, status, etc.)
  per packages/jssdk/src/types/auth.ts.

README-AI.md cross-link to the skill changed from a relative path
(broken from packages/jssdk/) to the absolute GitHub URL.

Docs cross-links retargeted: per-version REST API pages (call,
callList, fetchList, batch, batchByChunk × v2/v3) now link to the
matching rest-api-v{2,3} recipe instead of the decision pages.
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Pushed 43bed1b — addresses the blocker from the re-review and applies the v2/v3 restructuring + minor fixes.

v2/v3 split — rest-api-v2.md and rest-api-v3.md

New mirror pair under skills/b24-jssdk/references/recipes/:

  • rest-api-v2.md — full v2 surface (call, callList, fetchList, batch, batchByChunk) with code for each.
  • rest-api-v3.md — same structure for v3, leading with the actual supported method list (tasks.task.*, main.eventlog.*, meta endpoints) and an explicit "prefer v2" steer.

The previous framing was wrong: I'd written the skill as if v3 was "the new code path" with v2 as a fallback. The implementation is the opposite — v2 is mature and covers nearly everything; v3 ships methods one by one. Both trees coexist and a method lives in exactly one of them.

batch-calls.md and list-pagination.md are now thin decision pages — input shapes, halt-on-error semantics, callList-vs-fetchList — that point at the v2/v3 files for actual code samples.

v3-method bug — fixed

All 8 spots from the review where a v3 action was called with a v2-only method (would throw JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3 at runtime):

File Fixed Was
webhook-server.md:52 v2.batch.make v3.batch.make with crm.item.list
oauth-apps.md:42 v2.call.make v3.call.make with user.current
oauth-apps.md:79 v2.call.make v3.call.make with user.current
error-handling.md:13 v2.call.make v3.call.make with crm.item.get
error-handling.md:65 v2.batch.make v3.batch.make with crm.item.list
error-handling.md:96 v2.call.make v3.call.make with user.current
README-AI.md (webhook section) v2.batch.make v3.batch.make with crm.item.list
README-AI.md (OAuth section + error handling) v2.call.make v3.call.make with user.current / crm.item.get

Remaining v3 examples (tasks.task.*, main.eventlog.list) confirmed against version-manager.ts to actually be in the v3 supported list.

Reinforced the rule in three places (SKILL.md core rule #5, conventions.md, README-AI.md deprecation banner): default to v2, pick v3 only when the specific method is on the v3 list.

Minor fixes from the review

  • README-AI.md cross-link to skill — switched from [skill](../../skills/...) (which doesn't resolve from packages/jssdk/) to the absolute GitHub URL.
  • B24OAuth constructor example — was a placeholder comment in both oauth-apps.md and README-AI.md. Filled in real B24OAuthParams (applicationToken, memberId, accessToken, refreshToken, expires, expiresIn, scope, domain, clientEndpoint, serverEndpoint, status) per types/auth.ts.
  • setCallbackRefreshAuth / setCustomRefreshAuth signatures — I had them wrong. Real shapes (verified against types/auth.ts):
    • CallbackRefreshAuth = (params: { authData: AuthData, b24OAuthParams: B24OAuthParams }) => Promise<void> — was (newAuth) =>.
    • CustomRefreshAuth = () => Promise<HandlerRefreshAuth> — was async (currentAuth) => (takes no args).
  • Tasks params — aligned all tasks.task.get examples on the SDK's own pattern: { id: 1, select: ['id', 'title'] } (matches the docstrings in packages/jssdk/src/core/actions/v3/batch.ts).

Docs cross-link retarget

The per-version REST API docs pages now link to the matching version-specific recipe:

Docs page(s) Was → Now
1.call-rest-api-ver{2,3}.md guidelines/conventions.mdrecipes/rest-api-v{2,3}.md
2.call-list-rest-api-ver{2,3}.md recipes/list-pagination.mdrecipes/rest-api-v{2,3}.md
2.fetch-list-rest-api-ver{2,3}.md recipes/list-pagination.mdrecipes/rest-api-v{2,3}.md
3.batch-rest-api-ver{2,3}.md recipes/batch-calls.mdrecipes/rest-api-v{2,3}.md
4.batch-by-chunk-rest-api-ver{2,3}.md recipes/batch-calls.mdrecipes/rest-api-v{2,3}.md

More direct — each docs page jumps straight to the skill recipe that covers the same version.

State of the PR

  • 5 commits: skills add → v2/v3 API rewrite → README-AI rewrite → docs cross-links → this commit (v2/v3 split + bug fix + minor).
  • 40 files total in diff.

Ready for re-review.


Generated by Claude Code

- batch-calls.md / list-pagination.md / conventions.md / api-surface.md:
  cross-links into rest-api-v{2,3}.md used Markdown header fragments
  (e.g. #batch--batchmake, #when-to-use-v3--and-when-not-to). GitHub's
  anchor slugger drops em-dashes and backticks inconsistently, so the
  links could break silently. Drop the fragments and point at the file
  root + a short pointer to the section by name.

- README-AI.md "Recommended generation patterns" had a stale "for new
  code prefer v3" bullet — directly contradicts the v2-default story
  added elsewhere in the same commit chain. Replace with text that
  matches the v3-method-list rule from the deprecation banner.
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Повторное ревью (3-е) + правки в 92e148a

Перечитал текущее состояние PR (5 коммитов, 40 файлов, +2589/−306). Прошёл по тем же осям, что и в прошлый раз, плюс по местам, которые я мог сломать новой версткой v2/v3. Нашёл два класса проблем — оба поправил тем же ходом.

Обзор

После 43bed1b структура такая:

  • rest-api-v2.md / rest-api-v3.md — зеркальная пара со всеми code-примерами; v3 сразу с явным списком поддерживаемых методов.
  • batch-calls.md / list-pagination.md — тонкие decision-страницы (без кода), направляют на v2/v3.
  • SKILL.md, conventions.md, api-surface.md — обновлённые routing-таблица и REST-обзор.
  • README-AI.md — синхронизирован с новым framing'ом.
  • Docs cross-links — каждая per-version страница указывает на свой rest-api-v{2,3}.md.

Что нашёл и поправил в 92e148a

🟡 1. Хрупкие anchor-ссылки на заголовки с em-dash и backticks

Я понаставил ссылок вроде [rest-api-v2 → Batch](rest-api-v2.md#batch--batchmake) — указывающих на заголовок ## Batch — \batch.make`. GitHub slugger обрабатывает em-dash, backticks и точки несогласованно (чаще всего просто дропается, что даёт две подряд-`). Это работает в одном рендерере и тихо ломается в другом — типичный foot-gun, который ещё долго не заметят.

Поменял на ссылки уровня файла + текст-указатель на секцию по имени:

- **v2 examples:** [rest-api-v2](rest-api-v2.md) — see the "Batch" and "Auto-chunked batch" sections.

5 anchor-ссылок убрано:

  • batch-calls.md — 3 штуки
  • list-pagination.md — 3 штуки
  • conventions.md — 1
  • api-surface.md — 1

Сейчас grep -E '\.md#[a-z]' skills/ возвращает ноль — все cross-links уровня файла.

🔴 2. Stale «prefer v3» строка в README-AI.md

В секции «Recommended generation patterns» осталось:

- For new code prefer v3 methods; fall back to v2 only when v3 doesn't support the method

Прямо противоречит новому правилу в deprecation-баннере того же файла («default to v2; reach for v3 only when its method is on the list»). LLM, который прочитает оба, получит конфликтные инструкции — выберет какой-то из них или один из двух в зависимости от того, какой попал в attention последним.

Заменил на формулировку, совпадающую с баннером и с core rule #5 в SKILL.md.

Что проверил независимо и нашёл ОК

  • v3 примеры везде с v3-supported методами. Прогнал awk по всем actions.v3.*.make(...) контекстам в README-AI и скиле — все вызовы используют tasks.task.*, main.eventlog.list или meta-методы (всё из v3 списка в version-manager.ts).
  • v2 примеры — с v2-методами. Аналогично: crm.item.*, user.current, crm.item.get — все вызываются через v2.
  • OAuth callback signatures. Сверил против types/auth.ts: CallbackRefreshAuth = (params: { authData, b24OAuthParams }) => Promise<void>, CustomRefreshAuth = () => Promise<HandlerRefreshAuth>. Примеры в oauth-apps.md и README-AI.md соответствуют.
  • B24OAuth constructor. (B24OAuthParams, B24OAuthSecret, { restrictionParams? }) — соответствует.
  • B24OAuthParams реальные поля. applicationToken, userId, memberId, accessToken, refreshToken, expires, expiresIn, scope, domain, clientEndpoint, serverEndpoint, status — совпадает с types/auth.ts.
  • AjaxResult.isMore() / getNext() / getTotal(). Сверил ajax-result.ts: они помечены @deprecated, getNext() явно бросает SdkError для restApi:v3. Утверждение «v2-only» корректно.
  • Filter shapes. v2 — operator-prefixed object ({ '>=createdTime': '...' }), v3 — array of triples ([['timestampX', '>=', '...']]). В примерах разделено корректно.
  • idKey defaults. v2 = 'ID' (uppercase), v3 = 'id' (lowercase). crm.item.list (v2 метод с lowercase fields) везде с явным idKey: 'id'.
  • customKeyForResult required в v3. Везде передан, где нужен.
  • tasks.task.* params shape. Все примеры используют { id, select: ['id', 'title'] } — совпадает с SDK source-комментариями.
  • pagination: { limit } для v3 — есть в TypeCallParams, ОК.
  • Text.toB24Format, Text.toDateTime, RefreshTokenError — все существуют как named exports.
  • 18 файлов в index.json — все физически присутствуют (проверил скриптом).
  • README-AI relative-link fix — ссылка на скил абсолютная (GitHub URL), не ../../.
  • Docs cross-links — 19 страниц, все указывают на существующие файлы скила (per-version пары → rest-api-v{2,3}.md, frame/limiters/logger → соответствующие guidelines/recipes).

Прочее (мелочи, не правил)

  • packages/jssdk/README-AI.md сильно длинный (~780 строк) — частично перекрывается с rest-api-v{2,3}.md контентом. Можно ужать, оставив примеры только в скиле, и сделать README-AI указателем туда. Но это уже не bug, а edit-direction — не блокер.
  • Named-batch генерик в rest-api-v2.md: Record<'Company' | 'Contact', AjaxResult<{ item: CompanyItem | ContactItem }>> — литерально точно, но union T значит, что TypeScript не знает, какой ключ какой тип возвращает. Это структурно правильно (как в SDK source), но если хочется строже — нужны discriminated unions. Не критично для документации.

Рекомендация

🟢 Готово к мерджу. Все исходные блокеры закрыты, новые блокеры от рестрактуринга — поправлены. Документация согласована между собой и с исходниками SDK.

Состояние PR: 6 коммитов, 40 файлов, +2600/−317.


Generated by Claude Code

IgorShevchik pushed a commit that referenced this pull request May 26, 2026
…inks + polish

Acts on the review comment from PR #34 author (which is being closed in
favour of this one): #38 (comment)

1. AGENTS.md — new "Agent Skills" section listing the 7 skills with a
   one-line "when to use" table. Without this, a human / 3rd-party agent
   reading AGENTS.md as the "single source of truth" doesn't discover
   `.claude/skills/`.

2. .github/contributing/*.md — added an "Agent-facing mirror" reference
   block at the top of all 4 guides (transports-and-results,
   package-structure, testing, documentation) pointing at the matching
   skill files. Makes skill ↔ contributing sync a shared obligation.

3. docs/content/docs/2.working-with-the-rest-api/*.md — added a
   "Skill — <name>" link entry to frontmatter `links:` of 21 pages
   (call/callList/fetchList/batch/batchByChunk × {v2,v3}, frame-*,
   choosing-the-right-method, errors, limiters). Bumped `audited:` to
   2026-05-26 because adding the cross-link is the audit. `docs-lint`
   passes cleanly.

4. Cosmetic — replaced `offClientSideWarning?.()` with
   `offClientSideWarning()` across all skill files and recipes. The
   method is present on every concrete entry point; optional chaining
   created false impression of variability.

5. Recipe 9 — switched the canonical example to `ENTITY_TYPE_ID: 2`
   (numeric, accepted on every portal version per #34 author's testing)
   from the symbolic `ENTITY_TYPE: 'deal'`. Comment updated to mention
   the string fallback.

6. b24jssdk-core SKILL.md — new "Security checklist for event-receiver
   recipes" section consolidating the application_token + reply-200-
   first + setCallbackRefreshAuth + HTML-escape guidance that currently
   only lives in the per-recipe Notes blocks.

Skipped from the review:
- audited stamps on examples/*.md — reviewer explicitly noted this as
  "на усмотрение" and `docs:lint-pages` accepts it.
- Recipe 7 live-portal payload-shape verification — needs B24_HOOK,
  documented in REPORT.md as open question.
@IgorShevchik
Copy link
Copy Markdown
Collaborator Author

Закрываю в пользу #38 — он содержательно сильнее (компилируемые .ts recipes со strict typecheck, anchor-facts в REPORT.md, security-hardening event-recipes, покрытие hardErrorCodes/softErrorCodes/retryOnNetworkError из недавних http-фиксов в main).

Ключевые выводы и наработки переехали в виде ревью на #38: #38 (comment)

Что предложено подобрать оттуда отдельным маленьким коммитом перед мержем #38:

  1. Секция ## Agent Skills в AGENTS.md (discoverability — иначе агент/человек не узнает о существовании скилов).
  2. Cross-link .github/contributing/.claude/skills/.
  3. Skill-ссылки в frontmatter links: существующих per-version REST docs (docs/content/docs/2.working-with-the-rest-api/*.md) — замкнёт docs ↔ skills ↔ source.

Ветка claude/implement-skills-structure-nBN5h может быть удалена после закрытия.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants