/diagnostics:diagnostics-lang-skill-creatorfrom diagnostics
Workflow skill that creates a language-specific logging and diagnostics skill for a given programming language. Invoke ONLY when the user explicitly asks to create or generate a diagnostics skill, logging skill, or error handling skill for a specific language — e.g. "create a TypeScript diagnostics skill", "build me a Rust logging skill", "make a Go error handling skill for my project", "generate a Python diagnostics skill". Do NOT trigger for general questions about logging or error handling — only when the user wants to produce a new skill artifact. This skill is a multi-phase interactive workflow; do not attempt to run it silently or skip user checkpoints. Requires the diagnostics-base skill to be installed.
Ships in diagnostics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill is a guided workflow. It produces a new, packaged language-specific
diagnostics skill that extends diagnostics-base. It must not be run silently
or in one shot — it has explicit user checkpoints at each phase.
Before starting: verify that diagnostics-base is available in the user's
skill library. If it is not, stop and tell the user:
"This workflow requires the
diagnostics-baseskill to be installed first. Please install it and then re-run this workflow."
Display this tracker at the start of each phase, updating status as you go.
Use ✅ for complete, ▶ for current, ○ for pending.
○ Phase 1 — Detect language & application context
○ Phase 2 — Scan codebase for existing libraries
○ Phase 3 — Research: idiomatic libraries & patterns
○ Phase 4 — User decisions: library stack & application profile
○ Phase 5 — Generate skill
○ Phase 6 — Test the skill via subagents
○ Phase 7 — Review & package
Goal: Know the language, know whether there's an existing codebase, and understand the application type before doing anything else.
Start by checking if the conversation or any uploaded files already tell you the language. If the user said "create a Rust diagnostics skill", the language is Rust — do not ask again.
If the language is not clear, ask:
"Which programming language should this skill target?"
Then determine whether there's an existing project to scan:
bash_tool for common project files: package.json, Cargo.toml,
go.mod, pyproject.toml, requirements.txt, pom.xml, build.gradle,
*.csproj.Also note the application type if detectable from file structure:
main.rs, cmd/, __main__.py, bin/ entry points)Checkpoint: Print the phase tracker (Phase 1 ✅) and a one-paragraph summary of what you found before proceeding.
Goal: Find every logging, error handling, and diagnostics dependency already in use. Detected libraries are the highest-priority signal — the generated skill must be compatible with what's already there.
Run the appropriate scan based on language:
TypeScript / JavaScript (package.json)
# Extract dependencies + devDependencies keys
cat package.json | python3 -c "
import json,sys
d=json.load(sys.stdin)
libs=list({**d.get('dependencies',{}), **d.get('devDependencies',{})}.keys())
keywords=['pino','winston','bunyan','log4','consola','debug','morgan',
'neverthrow','ts-results','effect','zod','yup','valibot','fp-ts']
print([l for l in libs if any(k in l for k in keywords)])
"
Rust (Cargo.toml)
# Find logging/error crates
grep -E '^\s*(thiserror|anyhow|eyre|miette|snafu|tracing|log|env_logger|
tracing-subscriber|color-eyre|serde|tokio)' Cargo.toml Cargo.lock 2>/dev/null | head -30
Go (go.mod)
grep -E '(zap|zerolog|logrus|slog|sentry|pkg/errors|multierr|go-multierror)' go.mod
Python (pyproject.toml / requirements.txt)
grep -Ei '(structlog|loguru|logbook|rich|pydantic|marshmallow|cerberus|
result|returns|stamina)' pyproject.toml requirements*.txt setup.cfg 2>/dev/null
If the project structure is non-standard or multi-language, adapt — the goal is to find what's already wired in, not to run a rigid script.
Also look for existing logging configuration or setup files:
logger.ts, logging.py, log/config.go, src/telemetry.rs, etc.Checkpoint: Print the phase tracker (Phase 2 ✅) and list every detected library with a one-line description. If nothing was found, say so explicitly.
Goal: Find the current best-practice library landscape for this language with real star counts and recency signals. Even if libraries were detected in Phase 2, run this search — the project may be using a suboptimal choice, and the user should know the alternatives.
Run two web searches in parallel:
Search 1: {language} logging library best 2025 structured JSON
Search 2: {language} error handling library idiomatic {year} github stars
For languages where the stdlib has evolved (Go slog, Python structlog,
JS native Error.cause), also search:
{language} stdlib logging error handling 2025 best practices
From results, build a comparison table for each category:
Logging libraries:
| Library | Stars | Last release | Key characteristic |
|---|---|---|---|
| ... | ... | ... | ... |
Error / Result libraries:
| Library | Stars | Last release | Key characteristic |
|---|---|---|---|
| ... | ... | ... | ... |
Validation libraries (if applicable):
| Library | Stars | Last release | Key characteristic |
|---|---|---|---|
| ... | ... | ... | ... |
For each entry, note:
Also find one concrete idiomatic example per major library: a short snippet showing an error type definition and a log call. These become the seed examples in the generated skill.
Checkpoint: Print the phase tracker (Phase 3 ✅), the comparison tables, and the seed snippets. Tell the user you'll use these in Phase 4.
Goal: Nail down the exact choices that drive the generated skill. Ask all questions in one batch — do not drip-feed them one at a time.
Present a summary of what you know so far:
Then ask the following questions. Use ask_user_input_v0 for any that have
clean option sets; use free-text prompts for open-ended ones.
Required questions (always ask):
Logging library — which one should the generated skill teach? Options: the detected library if any, top picks from Phase 3, or "none / stdlib only". If the project already uses one, default to that but confirm.
Error / Result library — typed errors (Result/Either pattern) or exception-based? Which library? Or stdlib only?
Validation library — is there a schema validation library in use? (e.g., zod, pydantic, serde) The skill should cover how to surface validation errors well.
Application type (if not already clear):
Log output format:
Error rendering target — who sees the errors?
Optional questions (ask only if not determinable from context):
Async runtime (Rust: tokio/async-std; JS: native promises/async-await; Go: goroutines). Affects tracing/span integration.
Are there any existing internal error conventions (error code scheme, specific field names, a shared error base type) the skill should know about?
Checkpoint: Print the phase tracker (Phase 4 ✅) and a "Decision summary" table with every chosen library and setting before generating anything. Confirm with the user: "Does this look right? I'll generate the skill based on these choices." Wait for explicit confirmation before Phase 5.
Goal: Produce the language-specific SKILL.md by filling in the template
from references/skill-template.md with all discovered and decided information.
Read references/skill-template.md now. Fill every section using:
Non-negotiable requirements for the generated skill:
diagnostics-base must be a hard dependency. SKILL.md frontmatter only
supports name and description (a compatibility: key is silently
ignored by the loader). Encode the dependency two ways:
description, end with the sentence: "REQUIRES diagnostics-base
to be installed — this skill does not repeat base rules, it extends them.""REQUIRED: Read
diagnostics-basefully before applying any pattern in this skill. This skill is an extension — it does not repeat the base rules. All base rules apply."
Every pattern must reference the base rule it extends. When showing how to write a log call, note which base rule (e.g., "structured fields — base §Structured logging") it implements.
Library decision tree must be present. Show when to use each chosen library in a decision table or flowchart — the most common confusion point for every language is "which of my libraries do I reach for here."
Code examples must be real, runnable snippets — not pseudocode. The base skill uses pseudocode; this skill uses actual syntax for the chosen language and libraries.
The checklist addendum must include language/library-specific items on top of the base checklist.
Name the output file: diagnostics-{language-lowercase}.skill (e.g.,
diagnostics-typescript.skill, diagnostics-rust.skill).
Save the SKILL.md to: /tmp/diagnostics-{lang}/SKILL.md
Checkpoint: Print the phase tracker (Phase 5 ✅) and show the generated SKILL.md inline. Tell the user: "Here's the generated skill. Review it and tell me anything to change before I package it."
Goal: Verify the generated skill actually changes a fresh agent's output before packaging. A skill that reads well but doesn't land in practice is a waste of context window. Subagent tests catch this gap.
Spawn three subagents using the Agent tool (subagent_type: claude or
general-purpose), in parallel. Each receives the path to the saved SKILL.md
plus the path to diagnostics-base/SKILL.md, and a task it must complete by
applying both skills.
Test 1 — Reviewer test (catches anti-patterns). Hand the subagent a short, deliberately bad snippet in {LANGUAGE} containing at least four base-skill violations: a swallowed error, log-and-rethrow, an interpolated log message, an "ERROR" level on a 4xx user error, no cause preservation, no error code. Prompt:
"Read both skills, then review the snippet. List every violation you find, citing the skill rule by section name. Under 250 words."
Score: count cited violations. A well-written skill produces >= 4 distinct citations with section names. If the subagent misses obvious violations, the skill's anti-pattern table is not specific enough — fix and re-test.
Test 2 — Author test (writes from scratch).
Give the subagent a tight spec: "Write a function loadConfig(path) in
{LANGUAGE} using only the libraries declared in the skill's Library Stack
table. Define its error type and one log call. Apply both skills." No bad
seed code — just the spec.
Score: read the output. Does it have a stable code field on the error type? Does it preserve cause when wrapping I/O errors? Does the log call use structured fields? Does it use OTel-style field names? If any of these miss, the skill's positive examples are under-specified — add more concrete code.
Test 3 — Log-level test (taxonomy). Give the subagent five scenarios and ask for the log level + one-line justification for each:
Expected answers (per base rules):
Score: 5/5 must match. If the subagent picks ERROR for #2, the skill's log level rules need stronger language about user errors vs. service errors.
Checkpoint: Print the phase tracker (Phase 6 ✅) and a results table:
| Test | Pass / Fail | Notes |
|---|---|---|
| Reviewer (anti-patterns caught) | ... | ... |
| Author (writes clean code) | ... | ... |
| Log-level taxonomy | ... | ... |
If any test fails, iterate on the skill and re-run that specific test (no need to redo passing tests). Tell the user the results before Phase 7:
"Subagent tests: [X passed, Y failed]. [If failures] I've patched the following sections: [...]. Re-running failed tests."
Do not proceed to Phase 7 until all three tests pass.
Goal: Incorporate any user feedback and produce the final packaged .skill
file.
Apply any changes the user requests. Then run a self-review against this checklist before packaging:
diagnostics-base named in the description AND the opening body banner
(do not add a compatibility: frontmatter key — it is not recognized)REQUIRED: Read diagnostics-base first instructionOnce all items pass, package using the skill-creator's package script:
# Copy scripts to a writable location if needed
cp -r /mnt/skills/examples/skill-creator/scripts /tmp/skill-creator-scripts
cd /tmp && python3 -m skill-creator-scripts.package_skill /tmp/diagnostics-{lang}
# or, if the above module path fails:
python3 /mnt/skills/examples/skill-creator/scripts/package_skill.py /tmp/diagnostics-{lang}
Present the .skill file to the user and confirm install instructions:
"Install this by dropping
diagnostics-{lang}.skillinto your Claude skills directory alongsidediagnostics-base.skill. Both skills will be loaded together whenever you work on error handling or logging in {Language}."
Print the final phase tracker (all ✅) and close the workflow.
If the user bails out mid-workflow or says "skip" for a phase:
If web search returns thin results (Phase 3):
If diagnostics-base is not installed:
What SKILL.md sets; muted values are Claude Code's defaults
diagnostics@tarq is listed by tarqd/skills — review the source before installing
npx claudepluginhub tarqd/skills --plugin diagnostics4 skills in this plugin
/diagnostics-baseThis skill should be used whenever writing, reviewing, or refactoring error types, error messages, log statements, or any code that reports failure to a human or a machine — e.g. defining an `Error`/`Exception` class, writing `throw`, `panic!`, `raise`, or `return Err(...)`, calling `log.info/warn/error`, `console.error`, `slog`, `tracing`, `logger.*`, or composing user-facing error messages. Language-agnostic foundations; pair with a language-specific diagnostics skill for library/crate/package choices.
/diagnostics-rustLanguage-specific logging, error handling, and diagnostics patterns for Rust. Extends diagnostics-base with concrete Rust crate choices (tracing, tracing-subscriber, thiserror, anyhow, miette) and idiomatic code patterns for both libraries and applications (CLIs, HTTP services, async workers). Triggers whenever writing or reviewing error enums, `Result` returns, `?` propagation, `panic!`/`unwrap`/`expect`, or any `tracing!`/`log!` call in Rust. REQUIRES diagnostics-base to be installed — this skill does not repeat base rules, it extends them.
/diagnostics-swiftLanguage-specific logging, error handling, and diagnostics patterns for Swift. Extends diagnostics-base with concrete Swift library choices (swift-log, os.Logger, native Error / LocalizedError, typed throws, Result) and idiomatic code patterns for both Apple-platform apps and server-side Swift. Triggers whenever writing or reviewing error types, log calls, do/try/catch blocks, or diagnostic code in Swift. REQUIRES diagnostics-base to be installed — this skill does not repeat base rules, it extends them.