cortex-skills
Skill1 starsChanged 2 months agoMITView on GitHub
Propose and write skills that fit this codebase's detected stack — a webhook skill for Stripe, a migration skill for Prisma. Triggers — "add skills for this project", "what skills should this repo have".
In this repository50 other files it gives its agents.
- AGENTS.mdAGENTS.md
- core/AGENTS.mdAGENTS.md
- index/AGENTS.mdAGENTS.md
- mcp/AGENTS.mdAGENTS.md
- tools/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-specSkill
- auditSkill
- captureSkill
- catch-me-upSkill
- connect-brainSkill
- cortex-auditSkill
- cortex-briefSkill
- cortex-enrichSkill
- cortex-impactSkill
- cortex-installSkill
- cortex-nextSkill
- cortex-profileSkill
- cortex-reviewSkill
- cortex-scaffoldSkill
- cortexSkill
- cortex-viewSkill
- dailySkill
- diagnosing-bugsSkill
- domain-modelingSkill
- dreamSkill
- grillingSkill
- handoffSkill
- improve-codebase-architectureSkill
- install-projectSkill
- level-upSkill
- migrate-engineSkill
- onboardSkill
- optimize-contextSkill
- optimize-promptSkill
- plugin-syncSkill
- reindexSkill
- resolving-merge-conflictsSkill
- resumeSkill
- scan-projectsSkill
- setup-pluginsSkill
- shipSkill
- site-syncSkill
- skill-auditSkill
- skill-creatorSkill
- team-addSkill
- team-initSkill
- weekly-reviewSkill
- wizardSkill
- writing-for-agentsSkill
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
- Very specific: line 10
Every repo used to get the same two skills.
- Distinctive: line 24
If it reports no index, or one older than the working tree, re-index first:
- Distinctive: line 56
If you cannot find the real command or path, say so in the skill body rather than guessing.
- Very specific: line 92
Keep it short. A skill body is loaded whole when it fires.
- Distinctive: line 96
Do not restate what the root AGENTS.md already says.
- Distinctive: line 101
Do not report success without checking:
- Distinctive: line 146
If it still does, the line is still wrong.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.
Files
/cortex-skills — skills shaped by this repo, not by a default list
Every repo used to get the same two skills. A Next.js app with Prisma and no tests got exactly what a Rust CLI got, because nothing downstream of the index could tell them apart. The context layer was tailored and the skills were not.
The index knows the stack now. This turns that into skills the repo would actually use.
Read-only until the user picks. Steps 1 and 2 write nothing.
1. Propose, from evidence
node "${CLAUDE_PLUGIN_ROOT}/index/cortex-skills.mjs" .If it reports no index, or one older than the working tree, re-index first:
node "${CLAUDE_PLUGIN_ROOT}/index/cortex-index.mjs" .If .cortex/ does not exist, ask before running that — it is the first write, and this skill is
separately invocable on a repo where no other ritual has run. That is the write
ADR 0005 gates: generated and
gitignored is not the same as invisible. The .gitignore entry is written for you at creation time;
the asking is not.
Show the detected stack and the proposals with the reason each was surfaced — the tool prints them. Never present a bare list: a user cannot consent to a proposal they cannot evaluate, and the reason is what lets them say "that one's wrong, we do use a test runner."
Then wait. The user picks. Some will be declined, and that is a correct outcome — a skill nobody wanted is context load every session pays for.
If the tool proposes nothing, say so and stop. A repo with no manifest has no detectable stack, and inventing skills for it is the exact failure this replaced.
2. Read before you write
For each accepted skill, open the code it describes. The proposal carries a brief saying what
belongs in the body; it does not carry the body, because a useful body quotes this repo's real
commands and real paths.
- The test command comes from
package.jsonscripts, the Makefile, or wherever this repo keeps it — read it. A wrong command is the most costly error here: every future agent trusts it. - Paths come from the index. A generated Prisma client is often not at the library default, and a skill that says otherwise sends every agent to a file that does not exist.
- If you cannot find the real command or path, say so in the skill body rather than guessing. "Run the tests — command not found in the manifest, confirm before relying on this" is honest and fixable. An invented command is neither.
3. Write one skill per accepted proposal
.claude/skills/<id>/SKILL.md, with frontmatter and a short body:
---
name: <id>
description: <what it does, and the triggers that should reach it — see /writing-for-agents>
paths: <the proposal's paths line, copied verbatim — omit the line when the proposal has none>
---
# /<id> — <title>
<Two or three sentences: what this is for in THIS repo.>
## Steps
1. <the real command, the real path>
## Invariants
- <what must stay true, and the reason — the thing an agent could plausibly break>
## Verify
- <the command that proves it worked>paths: comes from the proposal, never from you. The tool prints the line under each proposal
that earned one — paths: prisma/**, **/*.prisma for a Prisma schema — built from what the index
detected, and quoted when a glob would otherwise break the YAML. Claude Code then loads the skill
only when those files are in play. Copy it exactly. When the proposal has no paths: line, write
none: an empty value is a skill that never loads, and a guessed glob is one that never loads on the
file that matters. Agents that ignore paths read the skill as they always did.
Keep it short. A skill body is loaded whole when it fires; a 200-line skill is a brief in
disguise. If it grows past about 60 lines, the depth belongs in a scoped AGENTS.md leaf via
/cortex-brief, and the skill should point at it.
Do not restate what the root AGENTS.md already says. Duplication is how these rot: two copies
drift and neither is trusted.
4. Verify what you wrote
Do not report success without checking:
for d in <the ids you accepted>; do
[ -f ".claude/skills/$d/SKILL.md" ] && echo " ok $d" || echo " MISSING $d"
doneThen re-run node "${CLAUDE_PLUGIN_ROOT}/index/cortex-skills.mjs" . — everything you wrote should
now appear under Already present. If a skill you just wrote is still proposed, it landed in the
wrong place.
And check every command you quoted actually exists. Run it, or grep the manifest for it.
Then format what you wrote. Write LF line endings. Run the repo's declared formatter
(state.formatters in cortex-loop.mjs . --json) on exactly the files you wrote, never on ..
Then run the repo's own lint/format check. A Prettier repo checks .claude/skills/**/*.md like
any other Markdown. If the check still fails on a file you wrote, report it with the output.
5. Report
List the skills written as paths, and say they are committed with the repo so the whole team gets
them. Then offer the natural next step: /cortex-brief for any area whose skill turned out to need
more depth than a skill body should hold.
Refreshing a skill that drifted
Step 1's output ends with the skills already here that the repo now contradicts, one line per
finding — line 8: says the repo has no tests, and the index counts 9 test files. --offers
carries the same list as drift. Each finding is provable from disk; prose the check cannot prove
(a lint baseline that has since gone) is yours to spot while the file is open.
- Ask whether it was edited since it was written.
git log --format='%h %an %s' -- .claude/skills/<id>/SKILL.mdshows every commit that touched it, andgit status --shortshows uncommitted edits. More than the commit that added it, or any uncommitted change, means a person worked on it: ask about that skill by name before you touch it, even after[a]llin/cortex. Their edit may be the only correct part. - Fix the flagged lines, in the body, from the code. Open what the line described and write
what is there now — the moved path (a
hintnames a same-named file; open it before trusting it), the real test count and command, a script the manifest declares. Frontmatter stays exactly as it is; so does every line nobody flagged and you did not verify wrong. - Retire a skill whose premise is gone. A setup skill for a harness that now exists has nothing left to say. Propose deleting it — the tool's own proposal usually names its successor — and delete only on a yes.
- Re-run
cortex-skills.mjs .— a refreshed skill no longer appears under the drift heading. If it still does, the line is still wrong.
Gotchas
- A generic skill is worse than no skill. "Follow best practices when adding a route" costs context every session and teaches nothing. If the body would not name a real path, a real command or a real invariant of this repo, do not write it — decline the proposal out loud.
- The proposals are ranked, and the ranking is the interview order. It comes from
index/lib/skills.mjs, where each candidate declares its own trigger. Add a stack-specific skill there rather than improvising one here, so the next repo with that stack gets it too. - Skills are per-repo; rituals are per-machine.
/cortex-brief,/grillingand the rest come from the installed plugin and work in any repo. What this writes is different: skills that only make sense here, committed with the code. Do not copy plugin rituals into a project. - Re-run after a stack change. Adding Stripe to a repo means the webhook skill is now worth proposing, and nothing notices on its own. The same run is what notices a written skill going stale — see Refreshing a skill that drifted.
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
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.

