From claude-cortex
Scaffolds a PROJECT_GUIDELINES.md file for a codebase by auto-detecting project conventions and interviewing the user. Use this skill when the user wants to set up coding standards, initialize project guidelines, create a style guide, establish code conventions, or says things like "set up guidelines", "init standards", "create a style guide", or "what conventions should we follow". Also use when a project has no PROJECT_GUIDELINES.md and the user asks for a code review.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-cortex:guidelines-initThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a `PROJECT_GUIDELINES.md` file that becomes the single source of truth
Generate a PROJECT_GUIDELINES.md file that becomes the single source of truth
for project conventions. This file is later consumed by /guidelines-review.
$ARGUMENTS determines the mode:
| Argument | Mode |
|---|---|
| (empty) | Simple — flat list of rules, minimal interview |
--simple | Simple — same as empty |
--full | Full — categorized guidelines with severity tags, comprehensive interview |
--upgrade | Upgrade — converts an existing simple-mode file to full mode |
Before generating PROJECT_GUIDELINES.md, check for an existing .context/CONVENTIONS.md (also check the project root if not found in .context/).
Code quality rules include: naming conventions, file organization / directory structure rules, error handling patterns, testing conventions (naming, coverage targets — not the framework or run command), git conventions (commit format, branch naming), import ordering rules (not the tool that enforces them).
If any of these are found:
Extract and migrate those rules into the PROJECT_GUIDELINES.md generation process:
After generating PROJECT_GUIDELINES.md, update CONVENTIONS.md:
## Project Guidelines Reference section exists and points to PROJECT_GUIDELINES.mdNo migration needed. After generating PROJECT_GUIDELINES.md, add the ## Project Guidelines Reference section to CONVENTIONS.md if it is missing.
No migration needed. Mention to the user that /context-init can create CONVENTIONS.md for tooling and environment setup, and it will automatically reference the generated guidelines file.
Default when no flag is provided. Optimized for getting rules on paper fast.
Identify the project's tech stack and shape. This is for context only — not an exhaustive convention analysis.
package.json, go.mod, Cargo.toml, or pyproject.toml (whichever exists)
to identify the primary language and framework.Glob("src/*/") or Glob("*/") to understand directory structure.Glob("packages/*/package.json"), Glob("apps/*/"),
lerna.json, pnpm-workspace.yaml, turbo.json..context/CONVENTIONS.md to detect existing code quality rules to migrate (see CONVENTIONS.md Integration above).Do NOT run the full signal file table or pattern detection. Keep this under 30 seconds.
Present a 2-3 sentence summary of what you detected:
"This looks like a TypeScript/React project using Jest for testing, organized by feature under
src/features/."
Then ask a single open-ended question:
"What rules matter to you? List whatever comes to mind — coding conventions, architectural boundaries, things that annoy you in code review. I'll turn them into a guidelines file."
Accept the user's response as-is. Do NOT:
If the user's list is very short (< 3 rules), it's fine to ask: "Anything else, or is that the full list?" — but only once.
Write PROJECT_GUIDELINES.md with this format:
# Project Guidelines
<!-- mode: simple -->
<!-- Generated by guidelines-init | Last updated: YYYY-MM-DD -->
## Overview
[One paragraph: project description and tech stack]
## Rules
- [Rule 1 — clean up the user's wording to be actionable, but preserve their intent]
- [Rule 2]
- [Rule 3]
- ...
Rules for the generated file:
<!-- mode: simple --> marker on the line after the heading. This tells
/guidelines-review which mode to use.## Rules heading as a flat bullet list..context/CONVENTIONS.md exists, end the Overview paragraph with: "Tooling and
environment setup (formatter, linter, test runner, build commands) are documented in
.context/CONVENTIONS.md."After writing, if a CONVENTIONS.md migration was performed (see CONVENTIONS.md Integration above), update .context/CONVENTIONS.md now — remove the migrated sections and ensure the ## Project Guidelines Reference section is present.
Tell the user the file is ready and offer: "Want to add, remove, or reword anything?" — but skip the summary table. The file is short enough to read.
Recommend committing PROJECT_GUIDELINES.md (and the updated CONVENTIONS.md if modified) to the repo.
Used when --full is provided. Comprehensive auto-detection, structured interview,
categorized output with severity tags.
Scan the project to infer as much as possible before asking the user anything. Read files, don't just check existence.
Signal files to scan:
| Signal file | What to infer |
|---|---|
package.json | Language (TS/JS), framework, test runner, linter, formatter |
tsconfig.json / jsconfig.json | Strict mode, module system, path aliases |
.eslintrc* / eslint.config.* | Lint rules already codified |
.prettierrc* | Formatting conventions |
pyproject.toml / setup.cfg / requirements.txt | Python tooling, linter config |
ruff.toml / .flake8 | Python linting conventions |
go.mod | Go module conventions, Go version |
Cargo.toml | Rust edition, features, dependencies |
Dockerfile / docker-compose.yml | Containerization conventions |
.github/workflows/*.yml | CI/CD patterns, checks, test commands |
.editorconfig | Indentation, line endings, charset |
CLAUDE.md / .github/copilot-instructions.md | Prior AI-assistant conventions |
.context/CONVENTIONS.md | Existing naming, error handling, testing, git conventions to migrate |
.gitignore | What the project considers generated/private |
Pattern detection (use Glob and Grep, not shell commands):
Glob("**/*.test.*") and Glob("**/*.spec.*") to detect test file namingGlob("**/*_test.go") or Glob("**/test_*.py") for language-specific test patternsGrep on a sample of source files (first 10 found) to detect:
Glob("*/") and Glob("src/*/") to detect directory structure organizationGlob("packages/*/package.json"), Glob("apps/*/"),
presence of lerna.json, pnpm-workspace.yaml, or turbo.jsonPresent auto-detected findings as a summary, then ask targeted questions to fill gaps. Organize questions by category. Skip categories already fully answered by auto-detection.
If code quality rules were found in .context/CONVENTIONS.md, pre-populate the interview with those rules. Present them as "detected from your existing CONVENTIONS.md" and ask if the user wants to keep, modify, or discard each before proceeding.
Ask these in order:
Don't ask about categories that clearly don't apply (e.g., skip "bundle size" for a CLI tool, skip "N+1 queries" for a project without a database).
If references/guideline-categories.md is available in the plugin directory, read
the sections relevant to the detected tech stack for example rules to reference during
generation. Do not copy examples verbatim — adapt them to the project's own code.
Create PROJECT_GUIDELINES.md in the repo root.
Critical: every section or subsection must have a severity comment on the line
immediately after the heading. Format: <!-- severity: error|warning|info -->
Default severity mapping:
| Category | Default Severity |
|---|---|
| Security | error |
| Error Handling | error |
| Architecture | error |
| Code Style | warning |
| Testing | warning |
| Git Workflow | warning |
| Documentation | warning |
| Performance | info |
Template:
# Project Guidelines
<!-- mode: full -->
<!-- Generated by guidelines-init | Last updated: YYYY-MM-DD -->
## Overview
<!-- One paragraph describing the project and its primary tech stack -->
## Code Style
### Naming
<!-- severity: warning -->
- ...
### Formatting
<!-- severity: warning -->
- ...
### Imports
<!-- severity: warning -->
- ...
## Architecture
### Directory Structure
<!-- severity: error -->
- ...
### Module Boundaries
<!-- severity: error -->
- ...
## Error Handling
<!-- severity: error -->
- ...
## Testing
### Requirements
<!-- severity: warning -->
- ...
### Conventions
<!-- severity: warning -->
- ...
## Git Workflow
<!-- severity: warning -->
- ...
## Documentation
<!-- severity: warning -->
- ...
## Security
<!-- severity: error -->
- ...
## Performance
<!-- severity: info -->
- ...
Formatting rules for the generated file:
<!-- severity: ... --> comment is the contract that /guidelines-review depends
on. It must appear on the line directly after the section heading, before any content.use descriptive names like fetchUserById, not getData..context/CONVENTIONS.md exists, end the Overview paragraph with: "Tooling and
environment setup (formatter, linter, test runner, build commands) are documented in
.context/CONVENTIONS.md."Show the user a summary table:
| Category | Rules | Severity |
|----------------|-------|----------|
| Code Style | 8 | warning |
| Architecture | 4 | error |
| Error Handling | 3 | error |
| Testing | 5 | warning |
| ... | ... | ... |
Ask if they want to:
Once confirmed, if a CONVENTIONS.md migration was performed (see CONVENTIONS.md Integration above), update .context/CONVENTIONS.md now — remove the migrated sections and ensure the ## Project Guidelines Reference section is present.
Recommend committing PROJECT_GUIDELINES.md (and the updated CONVENTIONS.md if modified) to the repo.
Used when --upgrade is provided. Converts a simple-mode file to full mode.
PROJECT_GUIDELINES.md exists. If not, tell the user to run
/guidelines-init first and stop.<!-- mode: simple -->. If the file is already full mode, tell the user
it's already in full mode and stop."Here's how I'd categorize your existing rules:
- 'Don't add code to handler.ts' → Architecture > Module Boundaries
- 'Everything needs test cases' → Testing > Requirements Agree with this mapping, or want to move anything?"
<!-- mode: full --> marker.
Incorporate the existing simple rules into the appropriate category sections.Monorepo: If you detect a monorepo (multiple package.json files, packages/
or apps/ directory, or lerna.json / pnpm-workspace.yaml / turbo.json), ask
whether guidelines should be global or per-package. In both modes, generate a
root-level file. In simple mode, keep it as a flat list. In full mode, note where
per-package overrides would go.
CONVENTIONS.md with only tooling content: If .context/CONVENTIONS.md exists but
contains only tooling and environment information (no naming, error handling, testing
conventions, git workflow, or architecture rules), skip migration. Just add the
## Project Guidelines Reference section if missing.
CONVENTIONS.md at project root instead of .context/: If CONVENTIONS.md is found
at the project root rather than .context/, treat it the same way — scan for code
quality rules, migrate them, and update the file.
Existing guidelines with mode mismatch:
--simple when a full-mode file exists: warn the user that
replacing it will lose severity tags and category structure. Suggest using the
existing full-mode file or running /guidelines-review against it instead.--full when a simple-mode file exists: suggest --upgrade instead
of replacing, since upgrade preserves existing rules.Existing guidelines, same mode: Ask whether to update (merge new detections) or replace entirely. Default to merging.
Empty project: In simple mode, generate a starter with 3-5 universal rules
marked as <!-- TODO: add your project-specific rules -->. In full mode, generate
a starter template with sensible defaults and <!-- TODO: customize --> markers.
<!-- severity: error -->,
<!-- severity: warning -->, or <!-- severity: info -->.<!-- mode: simple --> or <!-- mode: full -->) must always be
present in generated files.npx claudepluginhub xanderscannell/claude-cortex --plugin claude-cortexProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.