.cursor/skills/optimise-cursor-repo/SKILL.md
Audit a repository's Cursor configuration or evaluate whether a specific artefact (rule, skill, command, subagent) is correctly placed. Use when optimising the repo for Cursor, improving indexing, adding or assessing rules/skills, or deciding where information should live.
npx skillsauth add Samuel-Harris/Bytes-and-Nibbles-Website optimise-cursor-repoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit a repository's Cursor configuration, indexing setup, rules, hooks, documentation, and workflows. Produce a prioritised report of recommendations.
Reference files in this skill:
references/audit-commands.md — Bash commands for each audit areareferences/audit-process.md — Parallel and sequential audit workflowsreferences/migration-examples.md — Migration formats and example recommendationsscripts/validate-artefacts.sh — Validate frontmatter for skills, rules, and subagentsCursor evolves rapidly. Always consult these sources for the latest information:
This skill has two phases: audit then implementation. During the audit phase, do not make changes to the repository — present findings as a prioritised report. Implementation only happens after the user approves specific recommendations (see "After the Report").
For AGENTS.md creation and updates, refer to the generate-agent-docs skill.
CRITICAL: Before including any recommendation in the report, verify that it is actually needed by reading the relevant files.
Common verification failures:
.cursorindexingignoreFor each potential recommendation:
.cursor/ artefacts to avoid redundant suggestionsExample: Before recommending "add MCP server for Linear", check if Linear integration already exists via .cursor/mcp.json or an existing skill.
Multi-agent portability is paramount. AGENTS.md files are supported by all major AI coding agents (Cursor, Claude Code, OpenCode, etc.), while .cursor/rules/ are Cursor-specific. This means:
dir/**/*.py or dir/**/*.ts, that content belongs in dir/AGENTS.md**/*.test.ts, **/*.config.js, **/migrations/*.pyIf a rule covers "most files in a directory", it should be in that directory's AGENTS.md instead.
Is this information needed on EVERY request, regardless of what files are being worked on?
├─ YES → Root AGENTS.md (keep total under ~100 lines)
│ └─ Won't fit? → Always-apply rule (Cursor-only; use sparingly)
├─ NO → Is it specific to a subdirectory, package, or service?
│ ├─ YES → Is it procedural (multi-step "how to do X")?
│ │ ├─ YES → Skill scoped to that area
│ │ └─ NO → Does it need precise file-pattern scoping (e.g., only *.test.py)?
│ │ ├─ YES → Glob-scoped rule (Cursor-only; prefer AGENTS.md when possible)
│ │ └─ NO → Subdirectory AGENTS.md (preferred; portable across agents)
│ └─ NO → Does the agent need to decide when it's relevant?
│ ├─ YES → Is it procedural (multi-step "how to do X")?
│ │ ├─ YES → Skill (SKILL.md)
│ │ └─ NO → Apply-intelligently rule (description, no globs)
│ └─ NO → Is it triggered by an explicit user action?
│ ├─ YES → Command (`.cursor/commands/`)
│ └─ NO → Subagent (`.cursor/agents/`) if it needs isolated
│ context, otherwise skill
| Artefact | Nature | Loading | Best For |
| -------------------------------- | ------------------------ | ------------------------------ | -------------------------------------------------------------------------- |
| AGENTS.md | Passive, always loaded | Every request | Preferred. Identity, constraints, conventions (portable across agents) |
| Always-apply rule | Passive, always loaded | Every request | Universal style when root AGENTS.md is too large (Cursor-only; sparingly) |
| Glob-scoped rule | Passive, auto-attached | When matching files in context | Precise file-pattern scoping AGENTS.md can't cover (Cursor-only) |
| Skill | Active, agent-discovered | When task matches description | Procedural workflows, domain expertise, multi-step "how-to" |
| Skill (disable-model-invocation) | Active, user-invoked | Only when user types /skill | Saved prompts, repeatable workflows user triggers explicitly |
| Subagent | Active, delegated | When parent agent delegates | Tasks needing isolated context, parallel execution |
| Artefact | Status | Notes |
| --------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------- |
| Apply-intelligently rule | Still supported | Consider migrating to skill if it contains multi-step procedures or would benefit from references/ structure |
| Command (.cursor/commands/) | Still supported | Skills with disable-model-invocation: true are the newer alternative |
Note: Cursor includes a /migrate-to-skills command that can convert apply-intelligently rules and commands to skills if desired.
The acid test: Default to AGENTS.md for directory-scoped guidance (portable across agents). Use a rule only when precise file-pattern scoping is needed. If it tells the agent how to do something, it's a skill. If it's a prompt you're tired of retyping, it's a skill with disable-model-invocation: true. If it needs a clean context window, it's a subagent.
For bash commands to run for each area, see references/audit-commands.md.
Check .cursorignore, .cursorindexingignore, and .gitignore. The key distinction:
.cursorignore — Files invisible to Cursor entirely.cursorindexingignore — Files excluded from the semantic index but still readable by the agent and @-mentionable in chatFlag for exclusion: Large reference docs, scraped data, database snapshots, generated code, binary content, build artefacts, vendored dependencies.
Exclude .cursor/ from indexing. Rules, hooks, subagents, and skill reference docs are all loaded by Cursor natively or read by the agent via the Read tool — none of them need to be in the semantic index. Skills are already listed in the agent's context via the system prompt. Add .cursor/ to .cursorindexingignore.
| Mode | Frontmatter | Guidance |
| ----------------------- | ------------------------------------------ | ------------------------------------------------------------------------- |
| Always Apply | alwaysApply: true | Use sparingly — loads on every request |
| Apply to Specific Files | alwaysApply: false + globs: <patterns> | When precise file-pattern scoping is needed (Cursor-only) |
| Apply Intelligently | description only, no globs | Agent decides based on description; consider skill for procedural content |
| Apply Manually | No globs, no description | Only when @-mentioned |
Anti-patterns:
backend/**/*.py or frontend/**/*.ts,frontend/**/*.tsx, that content belongs in backend/AGENTS.md or frontend/AGENTS.md respectively. Rules are Cursor-specific; AGENTS.md is portable across all major AI coding agents (Cursor, Claude Code, OpenCode, Aider, etc.)Sizing: Individual rules <500 lines, all always-apply rules combined <200 lines.
Bloated signs: >100 lines at root, detailed command references, area-specific conventions, procedural instructions.
Too thin signs: No directory map, no tech stack, no build/test commands, no critical constraints.
| Context type | Budget | | --------------------------- | -------------- | | Root AGENTS.md | ~100 lines | | All always-apply rules | ~200 lines | | Total always-on context | <300 lines | | Individual glob-scoped rule | ~200 lines max | | Skill SKILL.md body | ~500 lines max |
Red flags: Root AGENTS.md >200 lines, >3 always-apply rules, single rule >500 lines.
Check .cursor/hooks.json for hook configuration. Format requires version: 1 and hooks object:
{
"version": 1,
"hooks": {
"hookName": [{ "command": "./script.sh", "matcher": "pattern" }]
}
}
High-value hook patterns:
sessionStart — Inject branch name, ticket, environment context via env and additional_context outputpreToolUse with matcher: "Shell" — Validate or transform shell commandsbeforeShellExecution — Block dangerous commands (exit code 2 to deny)afterFileEdit — Run formatters/linters after agent editsstop — Prompt handoff notes, auto-retry logic via followup_messageAvailable hooks: sessionStart, sessionEnd, preToolUse, postToolUse, postToolUseFailure, subagentStart, subagentStop, beforeShellExecution, afterShellExecution, beforeMCPExecution, afterMCPExecution, beforeReadFile, afterFileEdit, beforeSubmitPrompt, preCompact, stop, afterAgentResponse, afterAgentThought, beforeTabFileRead, afterTabFileEdit
Flag: Auto-generated types (OpenAPI/protobuf), compiled output, SQL dumps, LFS-tracked paths, large test fixtures.
UI settings to verify (Cursor Settings > Features):
Skills are the preferred format for:
references/ subdirectoriesdisable-model-invocation: true)Check: Does .cursor/skills/ exist? Do skills use progressive disclosure (lean SKILL.md, heavy docs in references/)? Would any apply-intelligently rules benefit from skill structure?
Note: Cursor includes a built-in /migrate-to-skills command that can convert apply-intelligently rules and commands to skills.
IMPORTANT: Read each artefact file to verify correct structure. Don't just check existence.
Run scripts/validate-artefacts.sh from the project root for automated validation of skills, rules, and subagent frontmatter.
---
name: skill-name
description: What this skill does and when to use it
---
Optional fields:
disable-model-invocation: true — For user-invoked-only skills (replacement for commands)Common errors:
--- block)name fielddescription field (agent won't discover the skill)| Rule Type | Required Frontmatter |
| ------------ | ---------------------------------------------- |
| Always-apply | alwaysApply: true |
| Glob-scoped | alwaysApply: false + globs: <patterns> |
| Manual-only | No alwaysApply, no globs, no description |
Common errors:
globs: present but emptyalwaysApply: true AND globs (redundant — always-apply ignores globs)Note: alwaysApply: false without globs but with a description is the valid "Apply Intelligently" pattern.
All fields are optional but recommended for discoverability:
---
name: subagent-name # Defaults to filename without extension
description: What this subagent does and when to use it
model: inherit # Options: fast, inherit, or specific model ID
readonly: true # For read-only subagents
is_background: false # Run asynchronously without blocking parent
---
Best practices:
description for automatic delegation (agent reads this to decide when to use the subagent)readonly: true for review/audit subagentsis_background: true for long-running tasks that don't need to blockCommands in .cursor/commands/ still work but skills with disable-model-invocation: true are the newer alternative. Cursor's built-in /migrate-to-skills command can convert them automatically. See references/migration-examples.md for manual migration format.
Check .cursor/agents/ for focused, well-described subagents. The model field is optional (inherit is the default).
High-value patterns: debugger, security auditor, test writer, documentation specialist, code reviewer.
Check .cursor/mcp.json or mcp.json. Only suggest MCP servers for services the project actually uses (verify in package.json, requirements.txt, docker-compose).
Plugins are installed from the Cursor Marketplace and bundle rules, skills, agents, commands, MCP servers, and hooks. Check Cursor Settings > Rules for installed plugins.
For creating plugins: requires .cursor-plugin/plugin.json manifest. See https://cursor.com/docs/plugins/building for format.
Check sandbox.json for network and filesystem access controls.
Apply the Decision Tree (above) to evaluate whether content is correctly placed across AGENTS.md files, rules, and skills.
Reading requirements:
.cursor/rules/SKILL.md and any files in subdirectories (e.g., references/, scripts/)Use subagents to parallelise reading across major directories (e.g., backend/, frontend/, terraform/).
Cross-reference rules against AGENTS.md for duplication:
For each glob-scoped rule, read the AGENTS.md files in the directories covered by its glob pattern. If the rule's constraints are already present in those AGENTS.md files, flag the rule for deletion — the content already lives where it should. Do not mark duplicated rules as "well configured".
Migrate broad rules to AGENTS.md:
Glob-scoped rules with patterns like backend/**/*.py or frontend/**/*.ts,frontend/**/*.tsx are an anti-pattern — they cover essentially all code files in a directory, which is exactly what AGENTS.md is for. These should be migrated:
This matters for multi-agent portability: AGENTS.md is supported by Cursor, Claude Code, OpenCode, Aider, and other AI coding agents. Rules are Cursor-specific. Preferring AGENTS.md ensures the project's conventions work across all tools.
For each section >10 lines, ask:
Flag content that should move:
| Current Location | Content Type | Should Be |
| ----------------- | -------------------------------------------- | ---------------------------------------------------------- |
| Root AGENTS.md | Procedural instructions | Skill |
| Root AGENTS.md | Area-specific conventions | Subdirectory AGENTS.md |
| Always-apply rule | Area-specific content | Subdirectory AGENTS.md |
| Glob-scoped rule | Broad pattern (dir/**/*.py, dir/**/*.ts) | Subdirectory AGENTS.md (delete rule) |
| Glob-scoped rule | Duplicates content in directory's AGENTS.md | Delete rule (content already exists) |
| Rule | Multi-step procedures | Skill |
| Skill | Passive guidance only | Subdirectory AGENTS.md (or rule if precise scoping needed) |
When glob-scoped rules ARE appropriate:
Rules are justified when you need precise file-pattern scoping that AGENTS.md cannot provide, such as:
**/*.test.ts — test file conventions**/*.config.{js,ts} — configuration file patterns**/migrations/*.py — migration-specific rules**/*.stories.tsx — Storybook conventionsIf the glob would match "most files in a directory", use AGENTS.md instead.
See references/audit-process.md for detailed parallel and sequential audit workflows.
Quick summary:
.cursor/ directory contentsPresent findings as a prioritised report:
## Cursor Optimisation Report
### P0 — Critical (high impact, low effort)
[Recommendations that significantly improve indexing, search quality, or context efficiency]
### P1 — Important (high impact, moderate effort)
[Recommendations that improve developer experience or reduce repetitive work]
### P2 — Recommended (moderate impact)
[Recommendations that would improve the setup but are not urgent]
### P3 — Nice to Have (lower impact or beta features)
[Recommendations for newer or experimental features]
### Already Well Configured
[Areas that are already set up correctly — acknowledge good practices]
### Settings to Verify Manually
[UI-only settings the user should check in Cursor Settings]
For each recommendation, include:
See references/migration-examples.md for example recommendations.
Once the prioritised report is complete:
List every actionable recommendation as a numbered summary (one line each, referencing the priority level, e.g. [P0] Exclude backend/vector_db/public_documents/ from indexing)
Ask the user which items they would like implemented:
Which of these would you like me to implement? You can specify by number (e.g. "1, 3, 5"), a priority level (e.g. "all P0 and P1"), or say "all".
Wait for the user's response, then implement only the selected items.
development
# Code Review Instructions ## Introduction You are a senior software engineer. ## Exploring the changes Run `git --no-pager diff origin/main...HEAD` to identify the differences between this branch and the main branch. Perform any other necessary git diffs to explore the changes made in this branch. ## Rules: - You absolutely must not edit any of the code. - Investigate any potential issue you find, to validate whether it actually is an issue. ## Code Review Checklist (internal) Work thro
testing
Iterative planning consensus loop. Orchestrates Planner, Architect, and Critic agents in rounds until the plan is approved or max iterations reached. Use for complex tasks that need a validated plan before implementation.
development
Generate a holistic product vision from Linear tickets. Pulls backlog, to-do, and in-progress tickets and synthesises them into a status-agnostic overview. Use when starting a new feature to understand the bigger picture, onboarding to the project, or when AI needs context on long-term goals. Supports refreshing existing masterplans with latest data.
documentation
Create a comprehensive AI context handoff document for long-running sessions.