---
name: think-first
description: "Reflection first problem solving for Convex projects: root cause before code, two candidate fixes, a 98 percent confidence bar, and changes limited to the files the request needs. Use before implementing any fix or feature, when a bug report comes in, when a previous fix did not work, or when the request is vague."
title: think-first
canonical_url: https://skilld.dev/gh/waynesutton/builder-skills/think-first
last_updated: 2026-11-12T12:13:49.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/waynesutton/builder-skills/think-first/agents/openai.yaml), [assets/large-logo.png](https://skilld.dev/api/skills-raw/waynesutton/builder-skills/think-first/assets/large-logo.png), [assets/small-logo.svg](https://skilld.dev/api/skills-raw/waynesutton/builder-skills/think-first/assets/small-logo.svg).
>
> If the user asked to install this Skill, run `npx skilld install waynesutton/builder-skills/think-first`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/think-first`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/waynesutton/builder-skills/think-first) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/think-first`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/think-first --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/think-first --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Think first

Slow down for thirty seconds before the first edit. It saves an hour later.

## 1. Reflect before acting

1. **Reflect.** Why does the current code not do what the user wants? Read it. Do not guess.
2. **Identify.** What is missing, wrong, or incomplete relative to the request?
3. **Theorize.** List two or three possible sources of the problem or areas that need to change.
4. **Distill.** Narrow to the one or two most likely causes and say why.
5. **Proceed.** Move forward only once that is clear.

Never assume. If anything is unclear, ask one focused question and stop. A wrong assumption costs more than a question.

## 2. Confidence bar

Do not write code below 98 percent confidence in what needs to change. Below that: read more, ask, or propose a plan instead of a diff. Edit the number if this project wants a different bar.

## 3. Convex rules

Check https://docs.convex.dev/llms.txt for the current API before relying on memory.

- Call mutations with plain objects. Write a dedicated mutation that maps form fields to document fields, and keep the names the same where you can.
- Patch directly when you do not need the current document.
- Check ownership on the server. Load the document and compare its owner to the caller from `ctx.auth`, or read through an index on the owner field. Never trust an owner id passed in args.
- Make mutations idempotent with early returns when the document is already in the target state.
- Order new items by a timestamp field or `_creationTime`.
- Use `Promise.all` for independent reads. It does not prevent write conflicts. To avoid OCC conflicts, keep each mutation's reads and writes narrow and avoid many writers on one hot document.

Docs to check:

- Functions: https://docs.convex.dev/functions
- Mutations: https://docs.convex.dev/functions/mutation-functions
- Queries: https://docs.convex.dev/functions/query-functions
- Validation: https://docs.convex.dev/functions/validation
- Schemas: https://docs.convex.dev/database/schemas
- Zen of Convex: https://docs.convex.dev/understanding/zen
- Best practices: https://docs.convex.dev/understanding/best-practices/
- TypeScript: https://docs.convex.dev/understanding/best-practices/typescript

Authentication:

- Convex Auth: https://docs.convex.dev/auth/convex-auth (beta; the setup guide is at https://labs.convex.dev/auth)
- Auth in functions: https://docs.convex.dev/auth/functions-auth
- Other providers: https://docs.convex.dev/auth

For Convex work beyond these rules, use the official Convex skills. https://www.convex.dev/agent-setup.md installs them.

## 4. Scope

Change:

- Only the files the request needs.
- The schema, if the request needs it.
- `changelog.md`, `files.md`, and `task.md` after the change lands. Run `git log --date=short` so dates match the real history. No placeholders, no future months.

Do not change:

- UI, layout, design, colors, or copy the request did not mention.
- Admin dashboard sections, frontend components, or features the request did not mention. Nothing gets removed without being asked.
- [Add project specific protected areas here.]

## 5. UI

- Use the site's design system for every popup, alert, modal, warning, toast, and confirmation. Never the browser default.
- Follow the Vercel Web Interface Guidelines: https://raw.githubusercontent.com/vercel-labs/web-interface-guidelines/refs/heads/main/AGENTS.md

## 6. Docs policy

Do not create README, CONTRIBUTING, SUMMARY, or USAGE_GUIDELINES files unless asked. A short summary in the reply is enough. No emojis in docs or the app unless asked.

## 7. Git

Load `git-safety` before any git command that could discard work. Short version: `git status` first, `git diff` before discarding, undo by editing files, and never run `reset --hard`, `checkout -- .`, `clean -fd`, or `stash drop` without the user approving that exact command.

## Checklist

Before the first edit:

- [ ] I can name the root cause
- [ ] I considered at least two fixes and picked one for a reason
- [ ] I am at or above the confidence bar
- [ ] I know which files change and which do not
- [ ] I am keeping UI and features the request did not mention
- [ ] I checked the relevant docs
- [ ] Anything unclear has been asked

Before saying done:

- [ ] The fix was verified, not just written
- [ ] Nothing outside the request changed
- [ ] Docs synced if the change was non trivial
