selan.ai

Docs · Practices

Practices

A Claude Code plugin that reads your repository's own Claude Code sessions on your machine and tells you what they cost and what to change. It proposes each change with the numbers behind it, and writes only the ones you pick.

What it is

Claude Code keeps a transcript of every session on your machine. selan-practices reads the transcripts of the repository you are in and counts what those sessions did: what every request carried, which commands ran and how often, which skills were used, and which checks ran before a commit.

From those counts it proposes changes to how the repository is set up for Claude Code. Each proposal quotes the line it came from and the saving over the period the transcripts cover. Something the sessions did once is not a proposal.

On a new repository with no sessions yet, it starts from the files instead: see Start here.

If you have never set Claude Code up for a repository, the glossary at the end explains the five files and settings it talks about.

Install

On the Selan CLI it is already installed. Selan's plugin catalog adds it by default, so there is nothing to do.

Anywhere else, run these two lines inside Claude Code:

/plugin marketplace add selan-ai/selan-practices
/plugin install selan-practices@selan-practices

It needs python3 on your PATH, and nothing else. The source is public and MIT licensed at github.com/selan-ai/selan-practices.

Start Claude Code inside the repository you want to look at. Each command reads the sessions of the directory it runs in, and no other.

Start here

/selan-practices:setup

Run this first. It works on a new repository with no history, from the files alone.

What it shows. What the repository has, in five lines at most: the stack, the checks it has, whether a red pipeline blocks a merge, its CLAUDE.md, and how many sessions there are to learn from.

What it proposes. A plan of at most five items. Each one says in a plain sentence what the thing is and why it helps, before any file name. It skips what is already in place. The items come from one list, in this order: a CLAUDE.md, turning on merge enforcement, moving a check that runs only after merge onto merge requests, code review, and dead-code detection as a suggestion. Where a component does the item, the plan names it.

You pick, it writes. Answer with the numbers you want, or “all”. It makes those changes, runs each one's check and shows you the diff. It never commits.

With fewer than five sessions, it ends by saying to run it again in two weeks. By then the sessions can show what to cut and what is missing.

Install a component

/selan-practices:install code-review
/selan-practices:install dead-code

Each component adds one practice to the repository. With no name, the command lists the two and says which is already installed.

ComponentWhat it adds
code-review An agent that reviews every merge request and writes a severity table with a fix per finding. Code review is the practice and explains every line. The plugin ships those files.
dead-code Finds code nothing reaches, locally and in CI. The tool depends on the stack: knip for TypeScript and JavaScript, deadcode for Go, vulture for Python, clippy for Rust, Periphery for Swift, detekt for Kotlin, PMD for Java. On Kotlin and Java it finds unused private code and resources, not an unused public API.

It reads the repository's CLAUDE.md and CI file first, and follows their conventions, such as runner tags and the package manager. It says in three lines what it will add, adds it, runs the component's own verification and shows you the diff. It never commits.

A component that needs a secret never asks for its value. It names the CI variable to create, where, and with which flags (masked, protected). For code-review that is SELAN_TOKEN, or ANTHROPIC_API_KEY without Selan.

Once there are a few weeks of sessions

The next three commands are audits. They read what the repository's sessions did, so they need a few weeks of them. Then they show what to cut and what is missing.

1. What every request pays for

/selan-practices:context-audit

What it looks at. CLAUDE.md is sent with every request, so its size times your request count is often the largest single cost. The audit also counts command output that was filtered after the fact, work done in another repository from this one, large and generated files read, and paths CLAUDE.md names that no longer exist.

A real finding. One repository had a 444-line CLAUDE.md, sent with every request. In another, sessions ran npx tsc | grep -v node_modules 1,988 times: the whole type check output, cut down after it had already been produced.

What it proposes. A CLAUDE.md under 200 lines, with the costly sections that only one kind of task needs moved into a rule file or a skill. For the filtered command, one quiet script that prints only what the filter kept, named in CLAUDE.md in place of the command.

2. Which skills are used

/selan-practices:skill-audit

What it looks at. Every skill and agent a session had: the repository's own, your personal ones and the ones plugins bring. Then which ran, which failed, and which were worked around, where a session ran a skill's own commands by hand instead of calling it. It also flags two skills with the same name, and throwaway scripts written to /tmp in session after session.

A real finding. A project skill had the same name as a skill in the developer's own ~/.claude. Only one of the two ever ran, and it was not the project's, so sessions kept writing their own watch scripts in /tmp instead of using the one the project skill already had.

What it proposes. Rename or merge one of the two, keeping the one that holds the scripts the sessions needed. It never deletes a personal or plugin skill itself: it tells you what to remove.

3. What done means here

/selan-practices:quality-gates

What it looks at. The repository's checks, cheapest first: format, lint, typecheck, build, unit, integration, e2e, budget, secrets, review. For each one it shows where it runs: a local command someone has to remember, a hook, a CI job that only advises, or a CI job that blocks the merge. From the transcripts it counts commits made with no check since the last edit, and the CI failures sessions ran into.

A real finding. A site whose only check ran after merge, on the default branch, so a broken change was already merged when it failed. And nine repositories where a red pipeline did not block the merge at all, because the project setting that requires a green pipeline was off.

What it proposes. A blocking job on merge requests for a check that only ran after merge. For the merge setting, which is not a file, it names the setting to turn on: “Pipelines must succeed” on GitLab, required status checks on GitHub. Where commits often go in unchecked, a hook that runs the quick check before git commit.

How it works

setup and the three audits each work in three steps, over two turns.

  1. It proposes. The first turn lists the changes. Each one says what to change, quotes the line from the report it comes from, and names the file it touches. An audit also gives the numbers, and puts the largest saving first. It ends with one question: which ones to apply.
  2. You pick. Answer with the numbers you want, or none.
  3. It writes. The second turn makes only those changes and shows you the diff. It never commits. Review the diff and commit it yourself.

Your transcripts never leave your machine. A standard-library Python script reads them locally and prints a summary of counts. The session sees that summary, like the output of any other command, and not the transcripts. To read the merge setting, quality-gates also asks GitLab or GitHub through glab or gh, with your own login.

If a repository has no sessions yet, an audit says so and stops. There is nothing to count, and a setup written without evidence tends to cost more than it saves. Start here works from the files instead.

Glossary

TermWhat it is
CLAUDE.md A file at the root of the repository that Claude Code sends with every request: commands, rules and traps every session needs.
.claude/rules/ with paths: Rule files that load only when a file matching their paths: is read, so a rule for one directory costs nothing elsewhere.
Skill A named, multi-step procedure, often with a script beside it, loaded only when it is called or relevant.
Hook A command Claude Code runs on its own at a set moment, such as before a git commit, and that can block it.
Quality gate A check a change must pass, and the place it runs: a local command, a hook, or a CI job that blocks the merge.