codebase-conventions skill
✓ VerifiedEnsures new code matches existing repository patterns by surveying precedents and shadowing their style, error handling, and architecture.
- GitHub stars
- 119
- Files
- 1
- Last commit
- Nov 9, 2026
- License
- MIT
- Allowed tools
- —
What does the codebase-conventions skill do?
codebase-conventions ensures new code matches existing repository patterns by surveying precedents and shadowing their style, error handling, and architecture.
Summary generated from the skill's SKILL.md.
About the codebase-conventions skill
Maintaining architectural consistency in existing repositories is the primary function of this skill. It is designed for AI agents that are tasked with adding new files, modules, routes, components, or tests to a codebase they have not yet fully surveyed. Instead of guessing how to implement a feature, the agent uses this skill to identify two or three existing precedents within the project to shadow their specific implementation patterns.
The process involves reading explicit configuration files like linter settings or contributing guides, then cataloging shared conventions regarding file naming, error handling, logging, and data access. By following this protocol, the agent ensures that new code reads as if the original authors wrote it. This prevents the introduction of duplicate dependencies, conflicting helper functions, or divergent styling. If no precedent is found, the agent is instructed to establish a new convention deliberately and record it for future use.
What an agent can do with it
- 1Implementing a new serviceAn agent should use this to ensure a new service follows the existing error handling and dependency injection patterns found in sibling files.
- 2Adding project-specific error handlingDevelopers can use this to prevent the use of generic try/catch blocks when the project requires specific error classes or result types.
- 3Preventing dependency bloatThe skill helps an agent check if a required library is already present in the manifest before suggesting a new one.
- 4Standardizing new module architectureWhen a developer needs to create a feature in a directory with no similar files, the agent can establish a new convention that remains consistent with the project spirit.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the codebase-conventions skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the codebase-conventions skill in Plugin
/plugin marketplace add NoobyGains/godmode /plugin install godmode@godmode
Install the codebase-conventions skill in Claude Code
~/.claude/skills/codebase-conventions/SKILL.md
$ npx degit NoobyGains/godmode/skills/codebase-conventions ~/.claude/skills/codebase-conventionsInstall the codebase-conventions skill in Claude Code (project)
.claude/skills/codebase-conventions/SKILL.md
$ npx degit NoobyGains/godmode/skills/codebase-conventions .claude/skills/codebase-conventionsInstall the codebase-conventions skill in Codex
~/.agents/skills/codebase-conventions/SKILL.md
$ npx degit NoobyGains/godmode/skills/codebase-conventions ~/.agents/skills/codebase-conventionsInstall the codebase-conventions skill in Gemini CLI
~/.gemini/skills/codebase-conventions/SKILL.md
$ npx degit NoobyGains/godmode/skills/codebase-conventions ~/.gemini/skills/codebase-conventionsInstall the codebase-conventions skill in Claude.ai
npx degit NoobyGains/godmode/skills/codebase-conventions codebase-conventions && zip -r codebase-conventions.zip codebase-conventions # claude.ai → Customize → Skills → + → Create skill → Upload a skill → codebase-conventions.zip
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachablenoobygains/godmode/skills/codebase-conventions is public and reachablegithub.com/noobygains/godmode/tree/HEAD/skills/codebase-conv ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-09github.com/noobygains/godmode/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/noobygains/godmode/blob/HEAD/skills/codebase-conv ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/noobygains/godmode/blob/HEAD/skills/codebase-conv ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 178 linesgithub.com/noobygains/godmode/blob/HEAD/skills/codebase-conv ↗Pass
SKILL.md
View on GitHubCodebase Conventions
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.
The Prime Directive
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.
When to Use
Required:
- Creating a file, module, route, component, service, job, migration or test in an existing project.
- Adding error handling, logging, validation, configuration or data access.
- Adding a dependency, or reaching for a library to do something the project may already do.
- Working in a repository, or a part of one, that you have not surveyed in this session.
- Refactoring code into a new shape.
Skip:
- A new project with no code yet: use
godmode:project-bootstrap. - Throwaway scripts that never enter version control.
- A change confined to lines you have just surveyed for the same task.
The Protocol
-
Read the explicit rules first. Linter and formatter configs,
.editorconfig, type-checker settings,CONTRIBUTING,AGENTS.mdor 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 logshows 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;
}
The Convention Catalogue
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 |
Typical Drift
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 |
When No Precedent Exists
- Confirm the absence. Search at least three ways (by name, by directory, by the pattern or API you would call). In a monorepo, check sibling packages.
- Look outside. Invoke
godmode:reference-firstfor an external reference that fits the project's stack. - Stay in character. Make the new convention consistent with the spirit of the codebase: its naming, its error style, its layering.
- Make it explicit. Tell the user a new convention is being introduced and why, in one or two sentences, before you build on it.
- Write it down. Record the new convention where the project keeps such notes (contributing guide, agent instructions, ADR) so the next change finds a precedent.
godmode:knowledge-capturecovers where.
When the Convention Looks Wrong
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.
Pre-Commit Conformity Check
Hold the diff next to the precedent you shadowed and confirm:
- Every new file sits beside its siblings and follows the file-naming pattern.
- Imports use the same aliases, order and barrel files.
- Identifiers use the project's casing and domain vocabulary.
- Errors, logging and validation use the project's mechanisms, not new ones.
- No new dependency duplicates an existing one; any new dependency was approved.
- No helper duplicates an existing helper.
- Tests follow the existing framework, location, naming and fixture style.
- The project's own lint, format and type checks pass on the changed files (run them; do not assume).
- A reviewer could not tell which lines are new by style alone.
Cognitive Traps
| 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. |
Guardrails
Never:
- Add a dependency that overlaps one already in the project without the user's approval.
- Introduce a second way of doing errors, logging, validation, configuration or data access.
- Change an established convention in passing while doing other work.
- Skip the project's own lint, format and type checks before committing.
Always:
- Read the explicit rules (lint config, contributing guide, agent instructions) first.
- Survey two or three precedents and catalogue their conventions before writing.
- Name the precedent you shadowed in the report or commit message.
- Include the convention catalogue in any brief for a subagent that will write code here.
- Tell the user when you establish a convention for the first time.
Connections
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.
Files in this skill
1codebase-conventions skill questions
How do I install the codebase-conventions skill in Claude Code?
Run npx degit NoobyGains/godmode/skills/codebase-conventions ~/.claude/skills/codebase-conventions. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the codebase-conventions skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What should I do if I cannot find a precedent for the code I am writing?
If no precedent exists, you must state this clearly, establish the convention deliberately, and inform the user before building on it.
How should I handle conflicting patterns between two existing files?
Resolve conflicts by prioritizing explicit rules (lint/docs), then the local directory convention, then the newer pattern via git log, and finally the majority.
Is it okay to use a better library if the current one is outdated?
No, you should follow the existing convention even if it seems imperfect. Propose a migration as a separate task with user approval.