TanStack Intent

repository·main·Indexed 43 days ago

https://github.com/tanstack/intent

A CLI tool for library maintainers to manage Agent Skills. It enables developers to auto-discover, validate, and ship skills compatible with the Agent Skills standard, ensuring they are versioned alongside library code. Features include skill loading guidance for agent configuration files, maintainer workflows for authoring and syncing skills, and an evaluation suite for measuring Copilot discovery and invocation.

Tokens
62.5K
Snippets
154
Records
248
Agent score
55%

What's inside TanStack Intent

  1. What is TanStack Intent

    main
    TanStack Intent is a CLI designed for library maintainers to generate, validate, and ship Agent Skills alongside their npm packages. It features auto-discovery of skills, versioning that stays in sync with your code, and compatibility with the open Agent Skills standard.
  2. Decide between Core and Framework skill content

    main

    When planning your file tree, use the following criteria to decide if content belongs in a core skill or a framework skill.

    ContentGoes in...
    Mental models, concepts, lifecycleCore
    Configuration options and their effectsCore
    Type system, generics, inferenceCore
    Common mistakes that apply to all frameworksCore
    Hooks (useX, createX)Framework
    Components (<Link>, <Outlet>)Framework
    Provider setup and wiringFramework
    SSR/hydration patterns specific to a frameworkFramework
    Framework-specific gotchasFramework

    Important Rules:

    • Framework Decomposition: If a library has separate framework adapter packages (e.g., React, Vue), do not create one monolithic framework skill. Decompose it into per-framework skills co-located with each adapter package.
    • Adapter-heavy Domains: For domains covering multiple adapters with distinct configs, use one SKILL.md for shared patterns and separate references/[adapter].md files for specific details.
  3. Understand the Intent skill lifecycle

    main

    Intent operates across six lifecycle stages. It can observe and verify the first four stages, but the final two depend entirely on the agent's behavior.

    StateMeaningObservable by Intent
    1. AvailableSkill discovered from an installed or workspace package.Yes
    2. PermittedProject policy allows the package/skill to surface (not removed by intent.exclude).Yes
    3. LoadedA supported load path resolved the skill and returned its content.Yes
    4. DeliveredIntent placed guidance where an agent can access it (e.g., session hook context).Yes (output only)
    5. ActivatedThe agent selected or received the skill for a task.No
    6. AppliedThe model followed the skill correctly.No

    Note: Observing an intent load command does not guarantee the skill was relevant or that the model successfully used the guidance.

  4. Understand the default Skill Loading guidance output

    main

    By default, intent install creates a guidance block that instructs agents to discover skills and load matching guidance on demand. This block is inserted into supported config files like AGENTS.md.

    Default Block Structure:

    <!-- intent-skills:start -->
    ## Skill Loading
    
    Before editing files for a substantial task:
    - Run `npx @tanstack/intent@latest list` from the workspace root to see available local skills.
    - If a listed skill matches the task, run `npx @tanstack/intent@latest load <package>#<skill>` before changing files.
    - Use the loaded `SKILL.md` guidance while making the change.
    - Monorepos: when working across packages, run the skill check from the workspace root and prefer the local skill for the package being changed.
    - Multiple matches: prefer the most specific local skill for the package or concern you are changing; load additional skills only when the task spans multiple packages or concerns.
    <!-- intent-skills:end -->

    Tip: Keep the intent-skills block near the top of your guidance file (e.g., AGENTS.md) so agents read it before task-specific instructions.

  5. Maintain the library planning record

    main

    Every authoring batch in TanStack Intent must incrementally maintain three cumulative planning documents. These documents serve as the official record of library domains, developer tasks, maintainer decisions, coverage, and remaining work. Do not replace these documents with only the tasks from a single batch; they must be cumulative.

    The Three Planning Documents

    1. domain_map.yaml: Manages domain/task relationships, supported failure modes, cross-references, tensions, and knowledge gaps. It ensures task slugs and package ownership stay aligned with skills.
    2. skill_spec.md: A human-readable record of coverage and decisions. It must include a Coverage and batch history section recording assessed scope, completed batches (with source revision/version), consequential decisions, check outcomes, and remaining work. Distinguish between implemented guidance and planned work.
    3. skill_tree.yaml: Manages skill identities, paths, prerequisites, source mappings, and package placement. It tracks planned or retired statuses and maintains links to the other artifacts.

    Note: .intent/review-state.json records review evidence but is not a replacement for these three documents.

  6. Ensure cross-model compatibility for skill output

    main

    To ensure that generated skill content is consistently consumed by all major AI coding agents, follow these formatting rules:

    • Format: Use Markdown with YAML frontmatter.
    • Tags: Do not use XML tags in generated content.
    • Code Blocks: Use triple backticks with language annotations (e.g., ```ts).
    • Headers: Use ## for section boundaries.
    • Descriptions: State distinct loading conditions.
    • Examples: Show concrete values; never use placeholders.
    • Instruction Style: Use positive instructions (e.g., "Use X") rather than negative ones (e.g., "Don't use Y").
    • Information Hierarchy: Place critical information at the start or end of sections, never buried in the middle.
    • Self-containment: Each SKILL.md must be self-contained, except for dependencies declared in the requires field.
  7. Understand intent.skills special forms and notices

    main

    The state of your intent.skills configuration changes how Intent behaves and what notices it emits to stderr:

    FormResultNotice
    Absent (no key)Discovery commands surface every discovered package.Deprecation notice until configured.
    Empty ("skills": [])Surfaces no packages.Info notice on stderr.
    Wildcard ("skills": ["*"])Permits every discovered package across all scopes/kinds.Acknowledged-risk notice (unvetted skills may reach your agent).

    Discovery Notices

    • Unpermitted package: Human output names omitted packages; agent sessions receive only counts.
    • Configured but not discovered: Reports that the package was not found.
    • Explicitly excluded: No unlisted-source notice is emitted.
  8. Identify cross-skill tensions and references

    main

    To improve agent output, identify how different skills interact through tensions and references.

    Cross-skill Tensions

    Identify structural pulls where optimizing for one task makes another harder. A tension is not a failure mode, but a design tradeoff.

    • Example: "SSR correctness requires patterns that hurt client-side performance."
    • Goal: Target 2–4 tensions. Name the skills in conflict, describe the pull, and state what an agent gets wrong when only considering one side.

    Cross-references

    Identify skills that illuminate each other without conflicting. These become "See also" pointers.

    • Example: A state management skill referencing an SSR skill ("state hydration requires understanding SSR lifecycle").
    • Output: Note which skill references which and why awareness of the other improves output.
  9. How the Agent Skills Registry discovery works

    main
    The Agent Skills Registry automatically indexes npm packages that include the tanstack-intent keyword. The registry periodically searches npm for this keyword, downloads the package tarball, extracts all skills/**/SKILL.md files, and indexes their contents. Every new version you publish is automatically indexed.
  10. Understand how `intent.skills` permissions work

    main

    The intent.skills configuration in your package.json determines which packages and specific skills are visible to Intent. The nearest configured list (including inherited workspace permissions) applies.

    Supported Rule Patterns

    Rule PatternEffect
    "*"Enables all discovered npm and workspace sources (all packages and skills).
    "@tanstack/query"Enables all skills within that specific npm package.
    "@tanstack/*"Enables all skills in any matching npm packages.
    "@tanstack/query#fetching"Enables only the fetching skill within that package.
    "workspace:@scope/internal"Enables all skills in a specific workspace package.
    "workspace:@scope/internal#testing"Enables only the testing skill in a specific workspace package.

    Key Behaviors

    • Wildcards: Package patterns support *. Individual skill entries require an exact package and skill name.
    • No Configuration: If no list is configured, all discovered sources appear (with a migration notice).
    • Empty List ([]): No sources are permitted; an informational notice is shown.
    • Scope: Permissions select sources and skill names but do not freeze skill content when dependencies are updated. Git sources are not supported.
  11. Managing skill versions and updates

    main

    When distributing skills, be aware of how versioning works across different installers:

    • Command Pinning: Generated commands do not automatically pin a release. Each installer resolves its own default source. To pin a version, use --pin <tag-or-sha> with gh skill add or use a specific reference like owner/repo@<tag> for Claude marketplace sources.
    • Plugin Versions: If a Claude plugin declares a version field, you must manually bump this version on every plugin release. If no version is declared, Git-based Claude installs default to the source commit.
    • NPM vs. Plugins: Changing an npm package version does not automatically update plugin metadata.
    • Compatibility: Always check implementation guidance against the application's actual dependencies. Record supported package versions within the skill itself; do not assume repository distribution automatically matches the installed package version.
  12. How the skill staleness check workflow works

    main

    The skill-staleness-check is an autonomous workflow triggered by upstream TanStack webhooks. It ensures that SKILL.md files remain accurate when source code changes. The workflow follows these logical steps:

    1. Match: Compares changed_files from a webhook against the sources defined in SKILL.md frontmatter (using Owner/repo:relative-path and glob patterns).
    2. Evaluate: Performs a two-pass classification of the diff:
      • Pass 1 (Quick scan): Analyzes the diff summary to identify potentially affected sections.
      • Pass 2 (Detail evaluation): Compares full diff hunks against skill content to determine if the change actually impacts documented behavior.
    3. Classify: Changes are categorized as No impact, Version bump only, Content update, or Breaking change.
    4. Update:
      • Content updates use the generate-skill meta-skill in "regeneration mode" (surgical updates rather than full rewrites).
      • Version bumps are handled manually by editing the library_version in frontmatter.
    5. Cross-skill Check: A single-level cascade checks if updated skills affect other skills that require them.
    6. Sync: The skills/sync-state.json file is updated with the new library_version and source file SHAs.
    7. PR: Opens a Pull Request with a structured body describing the trigger, source changes, skill edits, and cross-skill impact.