en un clic
analyze-spec
// Spec analysis with ambiguity scoring — interactive locally, single-pass remotely via label
// Spec analysis with ambiguity scoring — interactive locally, single-pass remotely via label
Deep code review of a pull request using parallel analysis agents (semantic consistency, bugs, tech debt, security). USE FOR: - Reviewing PRs for bugs, security issues, and code quality - Analyzing new abstractions for consistency and correctness - Identifying tech debt and architectural concerns - Posting review comments to specific lines on GitHub TRIGGERS: - "review PR", "code review", "review changes" - "diff review", "PR feedback", "check PR" - "analyze diff", "critique code", "review code" - "pull request review", "GitHub PR review"
Autonomous one-shot implementation from an approved spec (local/cloud only)
Create a new spec through Socratic interview, filling each template section to zero ambiguity
Implement a new invariant for jolt-eval
Implement a new objective for jolt-eval
Wrap a Rust function in a Jolt zero-knowledge proof
| name | analyze-spec |
| description | Spec analysis with ambiguity scoring — interactive locally, single-pass remotely via label |
| argument-hint | [spec file path] |
This skill operates in two modes:
/analyze-spec in Claude Code): Full interactive Socratic interview — one question at a time, iterative refinement with the spec author.claude-spec-review-request label): Single-pass analysis — all questions posted at once as a single PR comment. Reads prior PR comments as context to account for already-answered questions.Adapted from the Ouroboros-inspired deep interview methodology — specification quality is the primary bottleneck in AI-assisted development.
<Execution_Policy>
explore agent BEFORE asking about them<Mode_Detection> Detect which mode to use:
claude-spec-review-request label. Indicators: environment is non-interactive (no TTY), or running inside a GitHub PR context./analyze-spec.When in doubt, default to local mode (interactive). </Mode_Detection>
{{ARGUMENTS}}, use that directly.gh pr view --json number --jq .number to get the current branch's PR number.ls specs/ and ask the user which one.specs/<PR#>-*.md matching the PR number. This is the spec for this PR.specs/*.md file that is NOT TEMPLATE.md.jolt-eval/README.md so you understand the invariant/objective framework for scoring Success Criteria and generating questions.explore agent to map codebase areas relevant to the spec's intent.gh pr view --json comments to identify questions already asked and answers already given. Account for these when scoring — don't re-ask answered questions.Score clarity across four dimensions (0.0–1.0 each):
| Dimension | Weight | What to assess |
|---|---|---|
| Goal Clarity | 0.35 | Is the primary objective unambiguous? Can you state it in one sentence? Are key entities and relationships clear? |
| Constraint Clarity | 0.20 | Are boundaries, limitations, and non-goals clear? |
| Success Criteria | 0.30 | Could you write a test that verifies success? Are acceptance criteria concrete? Are relevant jolt-eval invariants/objectives described? |
| Context Clarity | 0.15 | Do we understand the existing system well enough to modify it safely? |
Calculate ambiguity:
ambiguity = 1 - (goal × 0.35 + constraints × 0.20 + criteria × 0.30 + context × 0.15)
For each dimension below 0.9, generate a targeted question that would improve it:
Post a single PR comment with all findings:
**Spec Analysis: {spec title}**
| Dimension | Score | Gap |
|-----------|-------|-----|
| Goal | {s} | {gap or "Clear"} |
| Constraints | {s} | {gap or "Clear"} |
| Success Criteria | {s} | {gap or "Clear"} |
| Context | {s} | {gap or "Clear"} |
| **Ambiguity** | | **{score}%** |
{If ambiguity ≤ 20%:}
**Status: Approved** — The spec is clear enough for one-shot implementation.
**Summary:**
- {what will be built}
- {key invariants}
- {critical evaluation criteria}
**Next step:** Run `/implement-spec` to implement this spec:
- [Open in Claude Code (cloud)](https://claude.ai/code) — run `/implement-spec` on this branch
- Or run `/implement-spec` locally in Claude Code
{If ambiguity > 20%:}
**Status: Questions remain** — {n} ambiguities to resolve before implementation.
**Questions:**
**1. [{dimension}]** {question}
**2. [{dimension}]** {question}
...
> After addressing these questions, update the spec and re-add the `claude-spec-review-request` label.
If approved, add the label: gh pr edit --add-label claude-spec-approved
If NOT approved, do NOT add the label.
Full iterative loop, one question at a time:
Each round:
Round {n} complete.
| Dimension | Score | Weight | Weighted | Gap |
|-----------|-------|--------|----------|-----|
| Goal | {s} | 0.35 | {s*w} | {gap or "Clear"} |
| Constraints | {s} | 0.20 | {s*w} | {gap or "Clear"} |
| Success Criteria | {s} | 0.30 | {s*w} | {gap or "Clear"} |
| Context | {s} | 0.15 | {s*w} | {gap or "Clear"} |
| **Ambiguity** | | | **{score}%** | |
Next target: {weakest_dimension} — {rationale}
Challenge modes (local only):
Each mode is used ONCE.
Soft limits (local only):
When approved (local): Print the summary and offer to update the spec with any refinements discovered during the interview.
Remote mode — single-pass with all questions: ``` **Spec Analysis: Streaming Commitments**| Dimension | Score | Gap |
|---|---|---|
| Goal | 0.85 | Clear |
| Constraints | 0.70 | Memory budget undefined |
| Success Criteria | 0.50 | No new tests specified |
| Context | 0.60 | Unclear which Dory tier is streamed |
| Ambiguity | 34% |
Status: Questions remain — 3 ambiguities to resolve.
Questions:
1. [Success Criteria] The Evaluation section says "existing tests pass" but doesn't specify new tests. What test would verify streaming produces identical commitments to the non-streaming path? What's the performance target?
2. [Context] DoryCommitmentScheme uses a two-tier structure (tier-1 chunks
→ tier-2 aggregation in poly/commitment/dory/). Which tier is streamed?
3. [Constraints] What's the memory budget? The current non-streaming path peaks at ~2GB for large traces — should streaming reduce this, and to what?
After addressing these questions, update the spec and re-add the
claude-spec-review-requestlabel.
Why good: All questions posted at once, each tagged with the dimension it targets, clear next steps.
</Good>
<Good>
Local mode — interactive round:
Round 2 | Targeting: Success Criteria | Ambiguity: 38%
The Intent section defines a streaming commitment scheme, but the Evaluation section only mentions "existing tests pass." What NEW test would verify that streaming produces the same commitments as the non-streaming path? And what is the acceptable performance threshold (e.g., memory usage, throughput)?
Why good: One question, targets weakest dimension, specific to the spec content.
</Good>
<Good>
Probing jolt-eval coverage:
The Intent → Invariants section says "streaming must produce the same
commitments as the non-streaming path." That looks like a binary property —
have you considered capturing it as a new jolt-eval invariant? The existing
split_eq_bind_low_high in jolt-eval/src/invariant/ is a close model
(reference vs. optimized implementation comparison). If this is out of scope,
the Invariants section should say so explicitly.
Why good: Names a concrete existing invariant as a model, leaves the N/A
door open, doesn't force a fit.
</Good>
<Good>
Citing codebase context:
I found that DoryCommitmentScheme in poly/commitment/dory/ uses a two-tier
structure (tier-1 chunks → tier-2 aggregation). The spec mentions "streaming
commitments" but doesn't specify which tier is streamed. Is this streaming
at tier-1 (chunk-level), tier-2 (aggregation), or both?
Why good: Explored first, cited specific types and files.
</Good>
<Bad>
Asking about codebase facts:
"What commitment scheme does Jolt use?"
Why bad: Should have explored the codebase to find this.
</Bad>
</Examples>
<Escalation_And_Stop_Conditions>
- **Remote mode**: Single pass — no escalation needed. Either approve or list remaining questions.
- **Local mode**:
- Hard cap at 15 rounds
- Soft warning at 10 rounds
- Early approval allowed at round 3+
- Ambiguity stalls (same score ±0.05 for 3 rounds): Activate Ontologist mode
- All dimensions at 0.9+: Approve immediately
</Escalation_And_Stop_Conditions>
Task: Analyze the spec. {{ARGUMENTS}}