agentleFS
dafaalzdafaalz/agent-skills/skills/s13n/SKILL.md

s13n

Skill2 starsChanged 53 days agoMITView on GitHub

Use when standardizing inconsistent code patterns across a repository, resolving architectural divergence, or installing linter guards. Don't use for deep module redesign (use codebase-design) or single-file refactoring (apply the edit directly without invoking this skill; see AGENTS.md for edit conventions).

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verify repository evidence or secure user authorization before selecting a canonical variant.

    line 23
  2. Very specific:

    If the repository is mid-migration (indicated by TODO(migrate) comments or dual implementations), clarify migration intent before touching …

    line 72
  3. Distinctive:

    When code patterns conflict and rank 1 or 2 does not specify a rule, present options to the user:

    line 94
  4. Distinctive:

    Update every caller site across the codebase.

    line 122
  5. Distinctive:

    Update associated test cases and documentation.

    line 123
  6. Very specific:

    Add an automated linter guard (such as no-restricted-imports in ESLint or banned-api in Ruff) to prevent regressions.

    line 124
  7. Distinctive:

    Test suite passes completely.

    line 134

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Standardization (s13n)

Normalize diverging patterns across a repository into a single canonical architecture protected by automated linter guards.

<HARD-GATE> Write-Target Boundary. In Audit mode, do not modify any file outside `.agents/state/s13n/`. In Normalize mode, modify only source files under the resolved repository root and only after Phase 3 completion criterion passes. Never modify `vendor/`, `node_modules/`, `dist/`, `build/`, lockfiles, or generated files. Any write outside these bounds requires explicit user approval recorded in `.agents/state/s13n/write-approval.md`. </HARD-GATE>

Modes

Select an execution mode before Step 1:

  • Audit mode (default). Inventory codebase patterns, identify architectural divergence, and generate a standardization plan without modifying files.
  • Normalize mode. Apply approved pattern refactors and install linter guardrails.

Governing principle

Verify repository evidence or secure user authorization before selecting a canonical variant; never adopt a pattern solely on file frequency. The majority pattern is evidence, not authority. A minority pattern may represent an active architectural migration. Normalizing to the majority without checking destroys intentional migrations.

Precedence hierarchy

Resolve convention questions against this hierarchy, evaluated highest to lowest:

RankSourceAuthorityAction
1Enforced tooling configuration (.editorconfig, eslint.config.js, ruff.toml)AbsoluteApply configured rules directly as executable truth
2Repository convention documents (AGENTS.md, CLAUDE.md, CODEBASE.md)AuthoritativeApply documented standard when tooling does not yet enforce the pattern
3Dominant unambiguous pattern in code (such as 47 out of 48 files)TentativeRecommend majority but check git history for intentional migrations
4User confirmationAuthoritativeAsk via structured choice when patterns conflict
5Per-language standards in references/std-*.mdAdvisoryBaseline default when the repository lacks conventions

Reference modules

Load relevant reference files on demand based on repository language and scope:

ConcernReference File
Divergence taxonomy and probesreferences/divergence-taxonomy.md
Architecture and file layoutreferences/std-structure.md
TypeScript and JavaScriptreferences/std-ts.md, references/std-js.md
Pythonreferences/std-python.md
Goreferences/std-go.md
PHPreferences/std-php.md
Rust and Rubyreferences/std-rust.md, references/std-ruby.md
Java and C#references/std-java.md, references/std-csharp.md
SQL, Shell, HTML, CSSreferences/std-sql.md, references/std-shell.md, references/std-html.md, references/std-css.md
Configuration, Docs, Gitreferences/std-yaml-json.md, references/std-docs.md, references/std-git.md

Workflow

Phase 1. Reconnaissance

Inspect existing repository conventions and tool configurations before modifying code:

ls -la AGENTS.md CLAUDE.md CODEBASE.md CONTRIBUTING.md .editorconfig 2>/dev/null
ls -la .eslintrc* eslint.config* .prettierrc* ruff.toml pyproject.toml .golangci.yml 2>/dev/null

Determine primary languages and file distributions:

find . -type f -not -path './.git/*' -not -path '*/node_modules/*' -not -path '*/vendor/*' \
  | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -15

If the repository is mid-migration (indicated by TODO(migrate) comments or dual implementations), clarify migration intent before touching files.

Completion criterion. The inventory is recorded in .agents/state/s13n/inventory.md listing convention files, active formatters, and language distribution counts.

Phase 2. Detect divergences

Probe codebase concerns systematically. Consult references/divergence-taxonomy.md for full taxonomy:

grep -rn --exclude-dir={node_modules,.git,dist,build,vendor} -E "require\(|from ['\"]|import .* from" . | head -30
grep -rn --exclude-dir={node_modules,.git,dist,build,vendor} -E "\.then\(|await |async function" . | head -30
grep -rn --exclude-dir={node_modules,.git,dist,build,vendor} -E "throw new|raise |return Err|panic\(" . | head -30

Record each divergence with exact file counts and sample locations. Check git history for recent changes in minority variants to distinguish intentional modernizations from accidental deviations.

Completion criterion. The divergence catalog is recorded in .agents/state/s13n/divergences.md documenting file counts and sample snippets for every identified variant.

Phase 3. Resolve canonical variants

Resolve canonical patterns using the Precedence Hierarchy. When rank 1 and rank 2 answer the question, proceed directly to normalization.

When code patterns conflict and rank 1 or 2 does not specify a rule, present options to the user:

  • State the concern concisely in one line.
  • Present each variant with its file count and sample snippet.
  • State the recommended variant with clear rationale.
  • Identify counter-signals such as newer modules or recent commit ranges.
  • Cap questions to at most four major divergences per round.

Completion criterion. A confirmed canonical variant is recorded in .agents/state/s13n/canonical.md with rank from the Precedence hierarchy and backing references.

Phase 4. Normalize

Execute normalization in two distinct stages:

  1. Mechanical normalization. Run project formatters and linters first:
# JS/TS
npx prettier --write . && npx eslint . --fix

# Python
ruff format . && ruff check . --fix

# Go
gofmt -w . && goimports -w .
  1. Semantic normalization. Update call sites, imports, and error handling manually:
  • Replace losing variants with the canonical pattern.
  • Update every caller site across the codebase.
  • Update associated test cases and documentation.
  • Add an automated linter guard (such as no-restricted-imports in ESLint or banned-api in Ruff) to prevent regressions.

Confine normalization edits to project source files; never modify generated files, lockfiles, or external vendor dependencies (vendor/, node_modules/, dist/).

Completion criterion. grep -rn "<deprecated-pattern>" --exclude-dir={node_modules,.git,dist,build,vendor} . returns zero matches, and the linter guard commit hash is recorded in .agents/state/s13n/guard-commit.txt.

Phase 5. Verify

Confirm the codebase is healthy and consistent:

  • Project builds cleanly with zero errors.
  • Test suite passes completely.
  • Linter passes with new guard rules enabled.
  • Repository search for the eliminated variant returns zero matches outside documented exemptions:
grep -rn "disallowed-pattern" --exclude-dir={node_modules,.git,dist,build,vendor} . && echo "FAIL" || echo "CLEAN"

Completion criterion. Build command exits with zero, all tests pass, and grep returns zero matches for the deprecated pattern.

Common mistakes

TitlePattern descriptionWhy it failsConcrete fix
Selecting majority pattern automaticallyAdopts the most frequent variant without checking git historyDestroys ongoing architectural migrationsVerify git history and confirm with user when ambiguous
Asking questions answered by docsAsks the user a question already answered by AGENTS.mdWastes user attention and invites documentation driftInspect convention documents first
Hand-editing formatting discrepanciesManually adjusts whitespace to match formatter outputIntroduces typos and contradicts formatter rulesRun project formatter directly
Modifying definitions without updating callersChanges a definition and updates only the definition siteBreaks builds and unit testsSearch repository for all caller references
Omitting automated linter guardApplies the canonical pattern without an automated guardDivergence returns in subsequent pull requestsAdd linter restriction rule to config
Normalizing third-party or generated directoriesApplies normalization inside vendor/ or generated directoriesEdits get overwritten on subsequent buildsExclude vendor and build output paths

Boundary isolation

Standardize syntax conventions and architectural patterns only. Do not alter functional domain logic, modify database schemas, or rename public API endpoints during normalization.

Quick audit checklist

Review this table before completing standardization tasks:

CheckPassing condition
Hierarchy adherenceCanonical variant backed by enforced tool config, docs, or explicit sign-off
Call site coverageEvery caller updated across all repository source files
Automated guardsLinter or formatter rule configured to block reintroduced deprecated patterns
Boundary integrityVendor dependencies, lockfiles, and generated files remain untouched
Build and testFull build exits clean and automated test suite passes with zero failures

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.