Agent skill

axiom-foundation-models-diag

Use when debugging Foundation Models issues — context exceeded, guardrail violations, slow generation, availability problems, unsupported language, or unexpected output. Systematic diagnostics with production crisis defense.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill axiom-foundation-models-diag-charleswiltgen-axiom-2 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 27 KB
Bundled scripts: none
Version: 1.0.0
Requires: iOS 26+, macOS 26+, iPadOS 26+, axiom-visionOS 26+
Path: skills/ai-llm/axiom-foundation-models-diag-charleswiltgen-axiom-2/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Guides the agent through systematic Foundation Models diagnostics when facing context limits, availability, language support, and output quality issues. It emphasizes identifying the root cause (device availability, context overflow, guardrail violations, language support, or slow generation) and applying patterned fixes such as condensing transcripts, graceful error handling, language checks, and optional tool usage for missing data.

How it works

The skill instructs the agent to perform these concrete steps:

  • Check availability via SystemLanguageModel.default.availability and log the result with a reason when unavailable.
  • Check supported languages via SystemLanguageModel.default.supportedLanguages and compare to Locale.current.language; warn if unsupported.
  • Inspect the current LanguageModelSession transcript to estimate transcript length and approximate token usage; indicate whether approaching the 4096 token context limit.
  • Profile performance with an Instruments Foundation Models template to capture latency, token counts, and generation times.
  • Inspect full transcript entries for anomalies and repeated content.
  • If problems are detected, follow one of several diagnostic patterns based on the symptom:
    • Pattern 2a (Context Window Exceeded): Condense transcript by keeping the first instruction and most recent entries, then continue.
    • Pattern 2b (Guardrail Violation): Handle gracefully and log for review without exposing input.
    • Pattern 2c (Unsupported Language): Check supported languages and early-exit if unsupported, with user guidance.
    • Pattern 2d (General Error): Implement comprehensive error handling with specific branches for exceededContextWindowSize, guardrailViolation, and unsupportedLanguageOrLocale, plus a catch-all.
    • Pattern 3a/3b/3c/3d (Output Quality and Data): If hallucinations or wrong use case occur, switch to appropriate tools or world-knowledge sources, ensure proper JSON generation via Generable structures, or call external tools for missing data, and adjust sampling as needed.

The text shows concrete Swift-like code blocks illustrating how to implement each pattern, including how to instantiate sessions, catch specific GenerationError cases, and implement helper functions like condensedSession(from:).

When to use it

Use when Foundation Models issues manifest as context window exceeded errors, guardrail violations, slow generation, availability failures, unsupported language, or unexpected output. The guide explicitly instructs the user to interpret issues with one of several defined patterns before changing code.

What it can touch

  • Tools: references to Tool protocol and Generable-based tools (e.g., GetFactTool, GetWeatherTool) for external data.
  • Code constructs: LanguageModelSession, SystemLanguageModel.default, @Generable, and error handling blocks for GenerationError cases (exceededContextWindowSize, guardrailViolation, unsupportedLanguageOrLocale).

Caveats

  • The material assumes Foundation Models are device-scale (~3B parameters) optimized for summarization, extraction, classification, and content generation, not world knowledge.
  • It requires the Apple Intelligence ecosystem and related availability parity (iOS/macOS/iPadOS/visionOS constraints).
  • Results or outcomes are not guaranteed by the skill; it provides diagnostic procedures and example fixes only as described in the patterns.
From the SKILL.md

# Foundation Models Diagnostics ## Overview Foundation Models issues manifest as context window exceeded errors, guardrail violations, slow generation, availability failures, and unexpected output. **Core principle** 80% of Foundation Models problems stem from misunderstanding model capabilities (3B parameter device-scale model, not world knowledge), context limits (4096 tokens), or availability requirements—not framework bugs. ## Red Flags — Suspect Foundation Models Issue If you see ANY of these, suspect a Foundation Models misunderstanding, not framework breakage: - Generation takes >5 seconds - Error: `exceededContextWindowSize` - Error: `guardrailViolation` - Error: `unsupportedLanguageOrLocale` - Model gives hallucinated/wrong output - UI freezes during generation - Feature works in simulator but not on device - ❌ **FORBIDDEN** "Foundation Models is broken, we need a different AI" - Foundation Models powers Apple Intelligence across millions of devices - Wrong output = wrong use case (world knowledge vs summarization) - Do not rationalize away the issue—diagnose it **Critical distinction** Foundation Models is a **device-scale model** (3B parameters) optimized for summarizati

What's inside
Steps it walks through
  1. Overview
  2. Red Flags — Suspect Foundation Models Issue
  3. Mandatory First Steps
  4. Decision Tree
  5. Diagnostic Patterns
  6. Pattern 1a: Device Not Capable
  7. Pattern 1b: Regional Availability
  8. Pattern 1c: User Not Opted In
  9. Pattern 2a: Context Window Exceeded
  10. Pattern 2b: Guardrail Violation
  11. Pattern 2c: Unsupported Language
  12. Pattern 2d: General Error Handling
  13. Pattern 3a: Hallucinated Output (Wrong Use Case)
  14. Pattern 3b: Wrong Structure (Not Using @Generable)
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the axiom-foundation-models-diag skill do?

Use when debugging Foundation Models issues — context exceeded, guardrail violations, slow generation, availability problems, unsupported language, or unexpected output. Systematic diagnostics with production crisis defense.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill axiom-foundation-models-diag-charleswiltgen-axiom-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going