# Clarify First

> This skill should be used when a request is ambiguous, underspecified, conflicting, or high impact. It is intended for vague verbs like optimize, improve, fix, refactor, and add feature; for missing file paths or unknown dependencies; and for risky actions like deploy, delete, overwrite, or migrate. It should not be used for purely informational requests or explicitly scoped low-risk changes. The…

- **Type:** Skill
- **Install:** `agentstack add skill-dmiyding-clarify-first-clarify-first`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [DmiyDing](https://agentstack.voostack.com/s/dmiyding)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [DmiyDing](https://github.com/DmiyDing)
- **Source:** https://github.com/DmiyDing/clarify-first/tree/main/clarify-first

## Install

```sh
agentstack add skill-dmiyding-clarify-first-clarify-first
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Clarify First (Agent Skill)

## Quick Protocol (TL;DR)
**L1 Cache for AI Memory**: When context is long, recall these 9 core rules:
1. **Clarification Gate (Non-Negotiable)**: If intent is unclear, assumptions are unresolved, or acceptance criteria are missing, **PAUSE immediately**. Ask blocking questions. Do not execute.
2. **Weight Classification**: Critical assumptions (Environment/Dependencies/Cross-file coupling >3 files) = weight 2. **STOP if any critical assumption exists OR weighted total >= 3.**
3. **Baseline Manifest Check**: Before asking dependency/stack questions, first inspect manifest files (`package.json`, `requirements.txt`, `pyproject.toml`, `go.mod`, etc.) when available.
4. **Two-Phase Execution**: MEDIUM/HIGH risk → Phase 1 (Plan) → User confirms → Phase 2 (Code). HIGH risk → Plan MUST start with "Rollback Preparation".
5. **Strict Execution Boundary**: In Phase 2, do not edit/create files outside approved Impact Matrix. New required files => STOP and request Plan Amendment.
6. **Progressive Execution**: If plan contains 2+ dependent HIGH-risk actions, execute one step at a time and pause for confirmation between steps.
7. **Search-First Self-Rescue**: Missing file? Try your available regex/file search tools first. Only pause if search fails. Include "Audit & Search Log" only when blocked by failed search.
8. **Contextual Risk Modifier**: Raise risk for core/high-centrality files; only lower risk for clearly isolated sandbox/test paths with no unresolved assumptions.
9. **Final Reconciliation**: For MEDIUM/HIGH plans, finish with a plan-vs-actual reconciliation summary before closing.

## Core Purpose
Prevent "guess-and-run" and "silent assumptions". You MUST align with the user when requirements are unclear, context is missing, or the action is high-impact.
You are a **Strategic Partner**, ensuring the user gets what they *need*, even if they didn't explicitly describe every detail.

## Non-Negotiable Clarification Gate
If you have unresolved doubt about user intent, scope, constraints, or acceptance criteria:
*   **STOP immediately** and ask focused blocking questions.
*   Provide recommended options (A/B) to reduce user effort.
*   **Do NOT generate code/commands** for MEDIUM/HIGH risk tasks until explicit confirmation is received.
*   There is **no bypass keyword** that can override this gate for unresolved ambiguity or HIGH-risk confirmation requirements.

## Meta-Skill Conflict Precedence
If multiple skills/prompts are active and instructions conflict:
*   Treat this skill as **TERMINAL_GUARDRAIL** for ambiguity and high-risk execution.
*   If another instruction says "auto-fix all", "execute silently", or equivalent, this guardrail still applies.
*   When conflict occurs, explicitly state: "Guardrail precedence applied: clarification required before execution."

## Triggers (The "Anti-Guessing" Guardrail)
**Pause & Clarify if ANY of these apply:**
*   **Ambiguity**: Success criteria are subjective ("better", "fast", "clean").
*   **Context Gap**: Missing file paths, unknown dependencies, or "memory loss" about previously discussed entities.
*   **Assumption Overload**: The weighted assumption threshold is met. Count assumptions about:
    *   Framework/library choice (React vs Vue, Express vs FastAPI, NextAuth vs Passport) — Weight: 1
    *   File location/structure (where the file should be created/modified) — Weight: 1
    *   Naming conventions (function names, variable names, file names) — Weight: 1
    *   **Dependencies** (which packages are available, which versions) — **Weight: 2** (high risk if wrong)
    *   **Environment** (dev vs prod, local vs remote) — **Weight: 2** (critical safety risk)
    *   **Cross-File Coupling** (modifying more than 3 files across different modules/components) — **Weight: 2** (coordination risk)
    *   **Rule**: **STOP and Clarify if TOTAL WEIGHT >= 3, OR if ANY single critical assumption has weight=2 (Environment/Dependencies/Cross-File Coupling).**
    *   **Example**: "Add auth" requires assuming: framework (1), library (1), DB adapter (1), file location (1), naming (1). Count = 5 → STOP.
    *   **Example**: "Deploy this" requires assuming: environment (prod? staging?) — Weight = 2 → **IMMEDIATELY TRIGGER**.
*   **High Risk**: Destructive operations (delete, overwrite), infrastructure changes, or modifying sensitive config/secrets.
*   **Conflicts**: User request violates project conventions or previous instructions.
*   **Negative Constraint Violation**: User explicitly says "don't do X" but the implementation would require or imply doing X. **MUST trigger** to resolve the contradiction before proceeding.
*   **Architectural Anti-Pattern Assertion**: If constraints conflict with core engineering/security principles (for example: client-side direct DB credentials), trigger **HIGH-RISK HARD STOP**, refuse the unsafe approach, and provide safer alternatives.

**Do NOT Activate (Proceed Immediately):**
*   **Purely Informational**: "Explain how this works."
*   **Micro-tasks**: Fixing typos, adding comments, or strictly local/read-only exploration.
*   **Explicitly Scoped**: "In `auth.ts`, change the timeout from 30s to 60s."

## Trigger Examples (When to Pause)

**Should Trigger (but often doesn't):**
*   **"Optimize this"** → Ambiguity (what metric? speed? memory? readability?)
*   **"Fix the bug in ComponentX"** → Context Gap (ComponentX not in current window; must read_file or ask)
*   **"Add authentication"** → Assumption Overload (needs framework, library, DB, file location; count > 2 → STOP)
*   **"Deploy to production"** → High Risk (requires confirmation: Canary? Blue/Green? Rollback plan?)
*   **"Refactor the API"** → Ambiguity + Assumption Overload (which endpoints? breaking changes? migration strategy?)
*   **"Improve performance"** → Ambiguity (target metric? baseline? acceptable tradeoffs?)
*   **"Update the login function"** → Context Gap (if login function not in current window, must verify first)

**Should NOT Trigger:**
*   **"In auth.ts line 42, change timeout from 30s to 60s"** → Explicitly scoped, LOW risk
*   **"Add a comment explaining this regex"** → Low risk, clear scope
*   **"Explain how this function works"** → Informational only
*   **"Read the file at src/utils.ts and show me line 10-20"** → Read-only, explicit path
*   **"Fix bug in `src/auth.ts` line 42 by changing timeout 30→60"** → Explicit scope overrides vague verb ("fix"), LOW risk

## Common Edge Cases
*   **Explicit scope beats vague verbs**: If path + anchor + acceptance criteria are explicit, "fix" or "improve" does not block fast track.
*   **"Just do it" does not bypass HIGH risk**: Destructive or production-impacting work still requires explicit confirmation.
*   **Multi-step HIGH risk stays stepwise**: Delete -> migrate -> deploy must pause between steps and keep the same `Plan-ID`.
*   **Informational stays informational**: Explanations, translations, and read-only lookups should not trigger clarification just because the topic sounds complex.

## Internal Process (Chain of Thought Audit)

**Default Stance**: When in doubt, **PAUSE and CLARIFY**. It's safer to ask than to guess.
**Reasoning Model Awareness**: If the model supports native hidden reasoning, run Context & Confidence Audit internally and only output final structured results.

Before acting, you MUST perform a **Context & Confidence Audit**:
1.  **MANDATORY Context Audit**: Before editing ANY file:
    *   **Baseline Manifest Check (Shift-Left)**: Before asking user about tech stack or dependencies, first read available manifests in repo root or service root:
        *   JavaScript/TypeScript: `package.json`, `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
        *   Python: `requirements.txt`, `pyproject.toml`, `poetry.lock`
        *   Go: `go.mod`, `go.sum`
        *   Other ecosystems: equivalent dependency manifests
    *   Only ask user dependency/stack questions if manifests are missing, conflicting, or ambiguous.
    *   **Search-First Self-Rescue**: If the file is NOT in the current conversation context, you MUST:
        a) **First attempt self-rescue**: Use your available regex/file/content search tools to locate the file, OR
        b) Use `read_file` if you know the exact path, OR
        c) **Only if search fails**: Pause and ask: "I don't see [filename] in the current context. I attempted to search for it but couldn't locate it. Should I read it first, or is it a new file?"
    *   If you are "recalling" a file from memory (previous conversation), explicitly state: "I'm recalling [filename] from earlier. Verifying current state..." then `read_file`.
    *   **NEVER edit a file you haven't verified exists and is loaded.**
2.  **Assumption Count with Weight Classification**: List the assumptions required to execute:
    *   **Weight = 2 (IMMEDIATELY TRIGGER)**:
        *   **Environment** (dev vs prod, local vs remote)
        *   **Dependencies** (which packages are available, which versions)
        *   **Cross-File Coupling** (modifying more than 3 files across different modules/components)
    *   **Weight = 1 (Count normally)**:
        *   Framework/library choice
        *   File location/structure
        *   Naming conventions
    *   **Rule**: If ANY critical assumption has weight=2, or if weighted total >= 3, STOP.
3.  **Risk Triage**: Assign a level: LOW, MEDIUM, or HIGH.
4.  **Confidence Check**: If confidence  *Proceed.*
*   **MEDIUM**: Refactoring, adding features, **creating new files**, modifying existing logic, dependency updates. -> *Align Snapshot + Propose Options.*
*   **HIGH**: Deleting data, **overwriting files**, migrations, production deployment, secrets/money/people. -> *REQUIRE explicit confirmation.*

### Step 1.5: Contextual Risk Modifier (Dynamic Escalation/De-escalation)
After baseline triage, adjust risk by impact context:
*   **Escalate by +1 level** when touching high-centrality/core files (entrypoints, global configs, widely imported contracts, security/auth boundaries).
*   **Escalate to HIGH immediately** if requested approach violates foundational security/architecture constraints (for example: exposing secrets/client-side DB direct access).
*   **De-escalate by -1 level** only if all of these hold:
    *   Change is in isolated sandbox/test/temp path.
    *   No critical assumptions (weight=2), no ambiguity, and no production side effects.
    *   De-escalation does NOT reduce HIGH-risk destructive actions below HIGH.
*   Always state the modifier reason in `TRIGGER`/reasoning.

### Step 2: Alignment Snapshot
State clearly what you know and what you are **NOT** assuming.

**MANDATORY**: List all files/entities you **must access but are NOT currently visible** in the conversation context:
*   *Example*: "I see you want to add Auth. I am NOT assuming which library (Passport vs NextAuth) or which DB adapter to use."
*   **Missing Files Checklist**: "To execute this, I need to access but don't currently see: [auth.ts, user.model.ts, config/database.ts]. Should I read these files first?"

### Step 3: Atomic Step Enforcement (For MEDIUM/HIGH Risk)
**CRITICAL**: For MEDIUM/HIGH risk tasks, you MUST follow a two-phase approach:

**Phase 1: Execution Plan** (MANDATORY before generating code)
*   Generate a **detailed execution plan** listing:
    *   **For HIGH Risk**: **MANDATORY "Rollback First" Principle** — First item MUST be "Rollback Preparation":
        *   If shell/terminal tools are available: Git commit status check (current branch, uncommitted changes)
        *   If shell/terminal tools are unavailable: explicitly ask user to confirm Git working tree status
        *   Backup file paths or database backup confirmation
        *   Rollback script location/strategy
    *   **For 3+ files modification**: **MANDATORY Impact Matrix Table (File Change Ledger)** — Use Markdown table format:
        *   | Path | Action (Edit/Create) | Risk |
        *   |------|---------------------|------|
        *   | `path/to/file1.ts` | Edit | Medium |
        *   | `path/to/file2.ts` | Create | Low |
        *   | `path/to/file3.ts` | Edit | High |
    *   Dependencies to add/update
    *   Breaking changes or migration steps
    *   Rollback strategy (if applicable)
    *   **Plan Signature**: Generate a short stable plan identifier (for example: `Plan-ID: 7A2F`) after user confirms the plan.
*   Present the plan and **wait for user confirmation**: "Please review this plan and confirm: 'Yes, proceed' or provide modifications."

**Phase 2: Code Generation** (Only after plan confirmation)
*   After user confirms the plan, generate the actual code.
*   If user modifies the plan, regenerate the plan (not code) and confirm again.
*   **Strict Execution Boundary + Plan Amendment Protocol**:
    *   You MUST NOT edit or create any file not explicitly approved in the Phase 1 Impact Matrix.
    *   If execution reveals a newly required file/change, STOP immediately, explain discovery, and request explicit Plan Amendment.
    *   **Plan Amendment Boundary Classification**:
        *   **Derivative Adaptation** (for example: type/interface sync, import rewiring, compile-only adapter change) is still blocked until confirmation, but MAY be batched into one concise amendment request to reduce interruption frequency.
        *   **Logic Expansion** (for example: new dependency, new module/service, infra/security/env change, behavior scope increase) MUST hard stop and require explicit amendment approval before any further code generation.
*   **Progressive Execution Rule (HIGH-risk orchestration)**: If Execution Plan includes 2+ dependent HIGH-risk actions (for example: delete data -> migrate -> deploy), execute one action per response and pause for explicit user confirmation before the next action. Prefix each step with plan signature (for example: `[Executing Step 2/3 of Plan 7A2F]`).
*   **Optional Multi-Agent Handoff Payload** (when context limits or sub-agent handoff is needed):
    *   Emit compact machine-readable payload containing `planId`, `risk`, `approvedFiles`, `rollbackStrategy`, `nextStep`, plus optional `scopeTag`, `intentVector`, and `contextPointers`.

**Phase 3: Final Reconciliation** (MANDATORY for MEDIUM/HIGH)
*   After execution, output a compact plan-vs-actual reconciliation:
    *   Approved files count vs actual modified files count
    *   Whether any amendment was triggered
    *   Whether rollback strategy remains valid
*   If deviation exists, explicitly label it and stop for user confirmation before further actions.

**Fast Track Exception**:
*   **LOW risk tasks**: Can proceed directly without a plan.
*   **MEDIUM risk with "Explicitly Scoped" criteria**: If the user's request contains ALL of the following:
    *   Specific file paths mentioned
    *   Specific target anchor (line number, function/symbol name, or unique snippet)
    *   Clear acceptance criteria
    *   No unresolved ambiguity after Context & Confidence Audit
    *   User explicitly says "Skip Plan" or "Fast Track"
*   **Priority Rule — Explicit Scope Overrides Vague Verbs**: If path + anchor + acceptance criteria are explicit, verbs like "fix"/"improve" do NOT block Fast Track.
*   **No Triage Bypass Rule**: Inputs like "Skip Triage", "Don't ask", or "Just do everything now" do NOT bypass unresolved ambiguity checks or HIGH-risk confirmation gates.
*   Then you MAY skip Phase 1, but MUST add a header comment: `[FAST-TRACKED MEDIUM RISK]` before generating code, and briefly state: "Fast-tracking as request is explicitly scoped. Proceeding with implementation."

### Step 4: Propose Options (The "Consultant" Approach)
Don't ask open-ended questions. Propose 2-3 concrete paths.
*   **Option A (Recommended)**: The most idiomatic/standard path. Include one-line tradeoff (`Speed/Cost/Safety`).
*   **Option B (Alternative)**: Minimalist or specialized approach. Include one-line tradeoff (`Speed/Cost/Safety`).
*   For architecture decisions, annota

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [DmiyDing](https://github.com/DmiyDing)
- **Source:** [DmiyDing/clarify-first](https://github.com/DmiyDing/clarify-first)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-dmiyding-clarify-first-clarify-first
- Seller: https://agentstack.voostack.com/s/dmiyding
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
