plankevm/plank-monorepo/frontend-diagnostics
Claude Code and agent skill by plankevm/plank-monorepo
- community
Checking that the SKILL.md file is still in the repository.
Mandatory use when adding, modifying, or reviewing diagnostic emission in any frontend pipeline stage. Use when touching emit_ methods, Session::emit_diagnostic, or the Diagnostic/Cause/Claim builder API.
Install
npx vskill@latest install plankevm/plank-monorepo/frontend-diagnosticsSKILL.md
Frontend Diagnostics
Overview
Every frontend pipeline stage emits diagnostics through dedicated emit_ methods that take minimal domain inputs, build a Diagnostic value, and forward it to Session. The pipeline never constructs diagnostics inline at the call site.
Architecture
- Call sites stay clean. Pass only what they naturally hold (an index, a
span). No Diagnostic construction, no format!.
- emit_ methods own the translation. Resolve indices to names, look up
related spans, assemble the Diagnostic.
- Context is opaque. The pipeline only knows
Session::emit_diagnostic.
Quick Reference
Diagnostic Builder
| Method | Purpose | |
|---|---|---|
Diagnostic::error(title) | Start an error diagnostic | |
Diagnostic::warning(title) | Start a warning diagnostic | |
.primary(source_id, span, label) | Convenience: pushes a lone Cause with a single primary annotation | |
.element(impl Into<Element>) | Push any element (Cause, Origin, Message) to primary group | |
.note(message) | Push a note message element | |
.help(message) | Push a help message element | |
.add_claim(claim) | Push a secondary group (renders as separate titled section) |
Cause Builder
Groups annotations for a single source file. Converts Into<Element>.
| Method | Purpose | |
|---|---|---|
Cause::new(source_id) | Start a cause for a source file | |
.primary(span, label) | Add a primary annotation (AnnotationKind::Primary) | |
.secondary(span, label) | Add a context annotation (AnnotationKind::Context) | |
.span(span, kind) | Add an unlabeled annotation with explicit AnnotationKind |
Claim Builder
Creates a secondary group rendered with secondary_title.
| Method | Purpose | |
|---|---|---|
Claim::new(level, title) | Start a claim (e.g. Level::Note, "entry file") | |
.element(impl Into<Element>) | Push element (Cause, Origin, etc.) | |
.primary(source_id, span, label) | Convenience: lone Cause with primary annotation | |
.note(message) / .help(message) | Push message elements |
Element Variants
| Variant | Purpose | |
|---|---|---|
Element::Cause { source, annotations } | Annotated source snippet (built via Cause) | |
Element::Origin { path: SourceId } | Bare file reference (::: path) | |
Element::Message { level, text } | Footer-style message | |
Element::Suggestion { source, patches } | Patch-based code suggestion |
The emit_ Method Pattern
Anti-pattern: inline Diagnostic at call site
Correct: dedicated emit_ method
Rules:
emit_methods live on the pipeline's main struct, grouped in a dedicated
diagnostics.rs file or impl block
- Parameters are minimal domain types (indices, spans), never pre-built strings
or Diagnostic fragments
- The method uses
selfto resolve anything it needs - A single
emit_diagnostichelper method forwards to the session
Annotation Grouping
Each .primary() on Diagnostic creates a separate Cause. To group multiple annotations into one snippet, build a Cause explicitly:
When two SourceIds might or might not be the same, branch explicitly:
Borrow Strategy
Default — `&mut Session` directly: when emit_ methods can take &mut self.
`RefCell` — when emit_ needs `&self`: when business logic holds shared borrows into the struct during emission (common in tree-walking lowerers):
Decision rule: methods take &self and read multiple fields while emitting? Use RefCell. Otherwise &mut Session.
Common Mistakes
| Mistake | Why it's wrong | Fix | |
|---|---|---|---|
Building Diagnostic at the call site | Scatters formatting, noisy call sites, inconsistent messages | Dedicated emit_ method | |
Passing String args to emit_ methods | Forces caller to resolve names, duplicates lookup logic | Pass indices/spans, let emit_ resolve via self | |
panic!/todo! instead of emitting | Kills compilation on first error, no useful output | Emit diagnostic and return a poison/sentinel value | |
Bare Element::Origin without context | Lone file path with no explanation | Wrap in a Claim with descriptive title | |
Same-source annotations in separate Causes | Renders as two disconnected snippet blocks | Group in one Cause with .primary() + .secondary() |
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplankc/.claude/skills/frontend-diagnostics/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 18
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/plankevm/plank-monorepo/frontend-diagnostics)