Skip to content

docs: add Cursor rules, syntax cheat sheet, and AI agent context - #1606

Merged
ssalbdivad merged 11 commits into
arktypeio:mainfrom
WolfieLeader:docs/improve-llm-knowledge
Oct 7, 2026
Merged

ssalbdivad merged 11 commits into
arktypeio:mainfrom
WolfieLeader:docs/improve-llm-knowledge

Conversation

@WolfieLeader

Copy link
Copy Markdown
Contributor

Summary

Closes #1539, closes #1562

Adds three resources to improve AI/LLM integration with ArkType:

  1. .cursor/rules/arktype.mdc — Cursor rules file with common ArkType patterns and
    pitfalls, adapted from the battle-tested cheat sheet in improve llm knowledge #1539. Activates when working
    with ArkType code in Cursor.

  2. ark/docs/content/docs/cheat-sheet.mdx — Syntax cheat sheet covering operators,
    keywords mental model, syntax kinds, and common gotchas. Per maintainer request in Create syntax cheat sheet #1562:
    "markdown page with code and comments." Automatically included in llms.txt via the
    existing writeLlmsTxt() build step.

  3. CLAUDE.md + AGENTS.md (symlinked) — AI agent context file covering monorepo
    structure, code style, key patterns, and common gotchas. Read by Claude Code, Codex,
    and other agent systems.

The cheat sheet is placed after Intro in sidebar navigation — the natural place a new user
looks after the getting-started tutorial.

Follow-up items from #1539 (llms.txt optimization, node_modules packaging) tracked separately.

Test plan

  • pnpm buildDocs succeeds — all MDX code blocks compile cleanly
  • Cheat sheet appears in sidebar navigation after Intro
  • Cheat sheet content included in llms.txt
  • pnpm checkPrettier passes
  • pnpm checkEslint passes
  • Full test suite passes (1703 tests)

Single-page quick reference covering syntax kinds, keywords mental model,
operators, objects, arrays, composition, morphs, type inference, error
handling, and common gotchas. Placed after Intro in sidebar navigation.

Addresses arktypeio#1562 per maintainer request for "markdown page with code and
comments" covering common operators, keyword patterns, syntax kinds, and
common issues new users run into.
Adds .cursor/rules/arktype.mdc with common ArkType patterns and pitfalls
for AI coding assistants. Adapted from the battle-tested cheat sheet in
arktypeio#1539 that was shared across teams adopting ArkType with Cursor.

Addresses arktypeio#1539 follow-up item for improving LLM knowledge.
Provides ArkType-specific guidance for Claude Code, Codex, and other AI
agents that read CLAUDE.md/AGENTS.md. Covers monorepo structure, code
style, key patterns, syntax cheat sheet, and common gotchas.

AGENTS.md is symlinked to CLAUDE.md so both agent conventions are served
from a single source of truth.
@WolfieLeader

Copy link
Copy Markdown
Contributor Author

Follow-up ideas for AI/LLM adoption

Beyond the Cursor rules and cheat sheet in this PR, a couple more ideas that could significantly lower the adoption barrier:

1. ArkType skill/plugin for AI agents

A dedicated ArkType skill (e.g. for Claude Code, Cursor, Copilot) that provides context-aware guidance when working with ArkType code — auto-activated when arktype is imported. This would go beyond static rules files by understanding the user's code and suggesting idiomatic patterns in real-time.

2. Migration skills from other validation libraries

Purpose-built migration guides (or interactive AI skills) for teams moving from:

  • Zod → ArkType
  • Joi → ArkType
  • Yup → ArkType
  • class-validator → ArkType
  • Valibot → ArkType

Each would map the source library's API to ArkType equivalents — e.g. z.string().email() → type("string.email"), Joi.object({}).required() → type({}), @IsEmail() → "string.email", etc. These could live as docs pages, Cursor rules, or packaged AI agent skills.

This would directly address the adoption friction mentioned in #1539 — teams are often not starting fresh but migrating existing codebases.

Happy to contribute either of these as follow-up PRs if there's interest.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is a solid contribution — the content is accurate and well-structured, and addressing #1539/#1562 in one PR makes sense. Three issues worth resolving before merge, one of which is a correctness problem.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | pullfrog.com | 𝕏

Comment thread CLAUDE.md Outdated
Comment thread .cursor/rules/arktype.mdc Outdated
Comment thread CLAUDE.md Outdated
Comment thread .cursor/rules/arktype.mdc Outdated
WolfieLeader and others added 2 commits March 19, 2026 05:14
- Remove auth-schema.ts gotcha (doesn't exist in arktype repo)
- Set cursor rules globs to "**/*.ts" so rule auto-activates
- Wrap default operator example in object context
- Add sync comment noting overlapping content locations
Drop the Cursor rule and CLAUDE.md (Claude Code reads AGENTS.md) so agent
context lives in one shared file. AGENTS.md now points at arktype.io/llms.txt,
the full docs concatenated from ark/docs/content, with the cheat sheet as its
abbreviated version.

Also correct the Record gotcha: "Record<string, T>" parses fine with keyword
arguments; only a JS variable inside the string fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@ssalbdivad ssalbdivad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I trimmed this down to the cheat sheet plus a single AGENTS.md and pointed agents to arktype.io/llms.txt, which this cheat sheet makes a great abbreviated version of.

@ssalbdivad
ssalbdivad merged commit a2f642c into arktypeio:main Oct 7, 2026
6 checks passed
ssalbdivad added a commit that referenced this pull request Oct 7, 2026
Bumps all publishable packages and documents the changes merged since
2.2.7:

- add string.base58 (#1604, @WolfieLeader)
- return empty props for object instead of throwing (#1682, fixes #1177,
  @SunilRathod27)
- keep object values from meta in JSON Schema (#1677, @lprnmns)
- report invalid generic definitions on TypeScript 7 (#1681)

@ark/attest goes to 0.57.0 for its breaking changes: tsVersions and
getPrimaryTsVersionUnderTest are removed and the position APIs are
singular, alongside TypeScript 7.1+ support (changelog entry added with
the attest changes).

#1683 and #1606 only change the docs and agent context, so they have no
changelog entries. llms.txt is regenerated to include #1606's cheat
sheet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ssalbdivad added a commit that referenced this pull request Oct 7, 2026
Brings in #1606 (agent docs), #1680 (attest TypeScript 7 support) and
the Infinity default on this branch. Conflicts: package.json keeps
testBuild beside main's new testTsVersions, testTsCompat and
testTypedLoose scripts; arktype's CHANGELOG puts the unreleased section
above main's 2.2.8; attest's puts this branch's bench changes under
Unreleased above main's released 0.57.0.

Ported for TypeScript 7, which main now installs:
- bundle.ts and testBuild.ts import `ts` from ts-morph, since TS 7 has
  no JS API (main's jsdocGen.ts made the same move).
- bench/scenarios.ts annotates the cyclic arktype Tree, which TS 7's
  declaration emit can't serialize (TS5088).
- cyclic.test.ts casts the generic-plus-variadic scope in "deferred
  checks resolving aliases" to never. Once TS 7's checker infers that
  scope, attest's per-node queries read later spreads and module
  members as `any` (9 assertions in spread, imports and submodule
  tests). A full tsc run infers them correctly; the test only asserts
  the runtime throw.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done (merged or closed)

Development

Successfully merging this pull request may close these issues.

Create syntax cheat sheet improve llm knowledge

2 participants