---
name: vigosan-methodology
description: How Vicent Gozalbes (@vigosan) builds software — TDD, layered domain logic, surgical changes, honest reporting and behaviour-first commits. Use when writing, changing, testing or committing code in any of his projects, or when he asks you to work "his way".
license: MIT
metadata:
  generator: dna
  dna-version: "0.1-poc"
  dna-profile: https://dna.vicent.io/@vigosan
---

# Working like @vigosan

## Precedence

1. The current repository's own rules (its CLAUDE.md, AGENTS.md, lint config, existing code) win over this skill.
2. Confirmed preferences below win over observed defaults.
3. Observed defaults are where to start, not laws. Deviate when the repo clearly does something else, and say so.

## Before coding

- State assumptions explicitly. If a request has several readings, list them and ask instead of picking one silently.
- Read the exports, the immediate callers and the shared utilities before adding code. Find 2–3 similar features in the repo and follow them.
- For multi-step work, write a short plan where each step has a checkable success criterion.
- When unsure about a framework API, read the version-matched docs shipped with the package (or the project's docs) instead of answering from memory.

## Confirmed preferences

- **TDD, always.** Red → green → refactor for every behaviour change, whatever the project size. Never skip the red phase: run the test and watch it fail for the right reason first.
- **Tests explain why.** Name tests after the behaviour and the reason it matters ("unique artwork cannot oversell", "reuses an existing user matched by email instead of creating a duplicate"), not after the function.
- **Selectors:** `data-testid` first, then semantic roles, then text. Never CSS classes.
- **Layered architecture, always.** Keep domain logic (entities, pure rules) separate from use cases and from infrastructure (database, HTTP, payment providers). Layers are the accepted structure, not a "single-use abstraction"; inside each layer, stay flat and boring.
- **Stack: ask first.** Before scaffolding a new web project, ask which stack to use. He has shipped both Next.js and Vite + TanStack Router/Query + Hono and picks per project.

## Writing code

- Boring and obvious beats clever. If 200 lines could be 50, rewrite them.
- Build only what was asked. No speculative options, no error handling for impossible cases.
- Make surgical changes: every changed line must trace back to the request. Don't reformat or "improve" adjacent code; mention unrelated problems instead of fixing them.
- Remove imports, variables and functions that your change made unused. Leave pre-existing dead code alone and mention it.
- No code comments. Make the code self-documenting through names and structure.
- No TODOs without an issue number.
- Match the existing style even when you'd do it differently. When two patterns conflict, pick one, explain why, and flag the other.

## Critical invariants

When code moves money, handles auth or enforces business rules:

- Write the invariants down in the repo's CLAUDE.md (units, authority, concurrency) and protect each one with a test.
- The server is the authority for prices, stock and permissions. Never trust amounts sent by the client.
- Guard concurrent state transitions (compare-and-swap, guarded updates). Don't "simplify" those guards.
- Database migrations ship before the code that depends on them.

## Verifying and reporting

- Before calling anything done, run what CI runs: lint, type-check, tests, and the build when it type-checks more than the tests do.
- Max three attempts at the same approach when stuck; then try a different angle.
- Checkpoint after each significant step: what was done, what is verified, what is left.
- Fail loud. "Completed" is false if anything was skipped. "Tests pass" is false if any were skipped. Surface uncertainty instead of hiding it.
- Never use `--no-verify`, never disable tests, never commit code that doesn't compile.

## Commits

- One functionality per commit, and only when it compiles and all tests pass.
- Title only, no body, no `feat:`/`fix:` prefixes.
- Describe the behaviour from the user's point of view, in the imperative: "Keep the admin layout mounted across page navigations", "Show the clip length while its start or end is held or dragged".
- Don't commit secrets. Read credentials from 1Password (`op read`) instead of `.env` files where the project does that.

## Project hygiene

- Keep a CLAUDE.md per repo with the commands, the architecture, the invariants and the gotchas that bit before.
- Automate repeated multi-step flows (releases, dependency upgrades) as project skills with a preflight that aborts on anything red.
- Prefer a Makefile or package scripts as the single entry point for setup, tests and release.

## When not to apply

- Repositories owned by other teams or clients: follow their conventions, keep only "verify before done" and "fail loud".
- Throwaway exploration he explicitly labels as a spike: skip commits, keep the honesty rules.

Evidence and confidence for each rule: [references/evidence.md](references/evidence.md).
