/godmode:codebase-conventionsfrom GodMode
Guides adding or changing code in an existing codebase by surveying precedents and enforcing conventions. Required for new files, modules, routes, components, services, tests, migrations, error paths, or dependencies.
Ships in GodMode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An existing codebase is the most authoritative reference for how new code in it should look. Before adding anything, find the two or three closest precedents, write down the conventions they share, build the new code by shadowing the nearest one, and check the result against them before committing. New code must read as if the original authors wrote it: one way of doing each thing, not two.
NO NEW CODE WITHOUT A NAMED PRECEDENT IN THIS REPOSITORY
No exceptions. No workarounds. No shortcuts.
If you cannot point to the file you modelled your change on, you guessed. When no precedent exists, say so, and establish the convention deliberately.
Required:
Skip:
godmode:project-bootstrap.Read the explicit rules first. Linter and formatter configs, .editorconfig, type-checker settings, CONTRIBUTING, AGENTS.md or similar agent instructions, architecture notes, ADRs. Explicit rules beat inferred ones. Note any check you will have to pass.
Survey two or three precedents. Find the files most similar to what you will add: same kind of thing (another route, another service, another form), same layer, ideally recent. Search by name, by directory, and by the pattern itself (the function you will call, the decorator you will use). Read them fully, plus their tests.
Catalogue the conventions. Fill in the table below from what the precedents actually do, quoting the file and line for each row. Leave a row empty rather than guessing.
Resolve conflicts between precedents. If two precedents disagree, decide in this order: an explicit rule (lint, docs) wins; then the convention in the directory you are editing; then the newer pattern if git log shows a migration towards it; then the majority. If it is still unclear, ask the user one question with both options and a recommendation.
Pick the nearest relative and shadow it. Use the closest precedent as a skeleton: same file placement, same section order, same imports and helpers, same error and logging calls. Change only what is specific to the new feature.
Reuse before you add. Before writing a helper, search for an existing one (utils, lib, common, shared, base classes, hooks). Before adding a dependency, check the manifest and lockfile for something that already does the job. A new dependency that duplicates an existing one needs the user's approval.
Run the conformity check below on your diff before committing. Fix every miss or write down why it differs.
Leave evidence. In the task report or commit message, name the precedent you shadowed ("modelled on src/billing/invoice.service.ts") and any convention you established for the first time.
digraph conventions {
rankdir=TB;
rules [label="Read explicit rules"];
survey [label="Find 2-3 precedents"];
found [label="Precedent exists?", shape=diamond];
catalogue [label="Catalogue conventions"];
conflict [label="Precedents agree?", shape=diamond];
resolve [label="Rule > local dir >\nmigration direction > majority > ask"];
shadow [label="Shadow nearest relative"];
none [label="No-precedent path"];
check [label="Conformity check"];
rules -> survey -> found;
found -> catalogue [label="yes"];
found -> none [label="no"];
catalogue -> conflict;
conflict -> shadow [label="yes"];
conflict -> resolve [label="no"];
resolve -> shadow;
none -> check;
shadow -> check;
}
Write this down (in your notes, the plan, or the brief you give a subagent) before writing code.
| Dimension | Question | Example answer |
|---|---|---|
| Placement | Where do siblings of this file live? By feature or by layer? | src/<feature>/<feature>.service.ts |
| File naming | Case and suffix pattern? | kebab-case.ts, PascalCase.tsx, snake_case.py |
| Exports | Default or named? Barrel files? | Named exports, re-exported from index.ts |
| Identifiers | Case for variables, functions, types, constants? Domain vocabulary? | camelCase, types PascalCase, "customer" not "user" |
| Function shape | Object parameter or positional? Sync or async? Return type? | async fn({ id, tx }) returning Result<T, AppError> |
| Errors | Throw, return a result, error codes? Which error classes? | Throws DomainError subclasses; mapped in middleware |
| Validation | Where and with what? | Schema validation at the HTTP boundary only |
| Logging | Which logger, what fields, which levels? | logger.info({ orderId }, "order.created") |
| Data access | ORM, query builder, repository layer, raw SQL? Transactions how? | Repository functions take a tx argument |
| Configuration | How are settings and secrets read? | Typed config module, never process.env inline |
| State (UI) | Local, context, store, server-state library? | Server state through the existing query library |
| Styling (UI) | Utility classes, CSS modules, CSS-in-JS, design-system props? | See godmode:ui-engineering |
| Tests | Framework, location, naming, fixtures, what is mocked? | Co-located *.test.ts, factories in test/factories |
| Comments and docs | Docstring style and density? | Public functions get a one-line docstring |
| Commits | Message format? | Conventional Commits |
The divergences agents introduce most often, and what to do instead.
| Drift | Instead |
|---|---|
console.log or print in a project with a structured logger | Use the project's logger and its field conventions |
Generic try/catch with a string error | Use the project's error hierarchy or result type |
A second HTTP client (axios next to a fetch wrapper) | Use the existing wrapper |
A new helper that duplicates one in utils/ | Search first; extend the existing helper if needed |
| Default exports in a named-export codebase | Match the export style |
Loose types (any, untyped dicts) in a strict codebase | Match the type discipline |
| Raw SQL beside an ORM, or the reverse | Use the established data-access layer |
| A new folder layout for "your" feature | Place it where its siblings live |
| Tests in a different framework or style | Copy the nearest test file's structure |
| Inline styles or arbitrary values beside a design system | Use the system's tokens and components |
godmode:reference-first for an external reference that fits the project's stack.godmode:knowledge-capture covers where.Follow it anyway, and raise it separately. Mixing a better pattern into one file leaves the codebase with two patterns, which is worse than one imperfect pattern. If the existing convention causes a real defect (a security hole, data loss), stop and tell the user; that is a bug, not a style question. A migration to a new pattern is its own task with the user's approval.
Hold the diff next to the precedent you shadowed and confirm:
| Rationalisation | Truth |
|---|---|
| "My approach is cleaner." | Two patterns are worse than one adequate pattern. Consistency is the feature. |
| "This is a new module, so its conventions are mine." | New modules live in the old project and are read by the same people. |
| "The pattern is outdated." | Outdated and consistent beats modern and forked. Propose a migration as a separate task. |
| "It is one small helper." | Small helpers are the most reused code. A wrong pattern spreads from them. |
| "I read one similar file." | One file can be the exception. Two or three show the rule. |
| "I will tidy it to match later." | Later rarely comes, and partial migrations are the worst state. |
| "This library is better than the one they use." | Better in isolation does not justify a second library for the same job. |
| "There is no precedent." | Search three ways first, including the sibling packages and the tests. |
Never:
Always:
godmode:reference-first: routes in-repository work here, and is where to go when no internal precedent exists.godmode:project-bootstrap: for new projects with no code to survey.godmode:ui-engineering: applies the same discipline to the project's design system.godmode:task-planning: plan tasks name the precedent file for each change.godmode:test-first: new tests follow the test conventions catalogued here.godmode:code-review: reviewers check conformity against the precedent named in the report.godmode:knowledge-capture: records a newly established convention so the next change finds it.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub noobygains/godmode --plugin godmode33 skills in this plugin
/agent-briefingUse when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff report between agents, or sending a message to another agent mid-task./code-reviewUse when a task, feature or bug fix is implemented and before it is committed, merged or handed back to the user, and when the user asks for a review of a change, a branch or a pull request./completion-gateUse when about to say that work is done, fixed, passing, working, deployed or ready, before committing, opening or merging a pull request, closing a task, moving to the next task, or reporting a subagent's result as finished.Other plugins' skills for the same job