mit einem Klick
dot-scout
// Analyse a project to detect which principles apply and create or update .principles files encoding that analysis. Use when the user runs /dot-scout [path] to map principles to a codebase.
// Analyse a project to detect which principles apply and create or update .principles files encoding that analysis. Use when the user runs /dot-scout [path] to map principles to a codebase.
Review a file, directory, or inline code against its activated principles. Supports explicit principle override with --with / @group / on syntax. Use when the user runs /dot-audit [target] to check code or docs against quality principles.
Activate principles before working on a file or task. Supports explicit group and ID overrides. Use when the user runs /dot-prime [target] to load the relevant principles into the active frame before writing or editing.
Build and deploy all sample-bot zip files into the target folder. Use when the user runs /deploy-sample-bots [TARGET_DIR].
| name | dot-scout |
| description | Analyse a project to detect which principles apply and create or update .principles files encoding that analysis. Use when the user runs /dot-scout [path] to map principles to a codebase. |
| argument-hint | [directory-path] |
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash |
| version | 0.12.0 |
| authors | Flemming N. Larsen (https://github.com/flemming-n-larsen) |
| license | MIT |
| generated-by | .principles |
You are analysing a project to determine which principles apply and creating or updating .principles files to encode that. Follow these six phases exactly.
Determine the target directory:
$ARGUMENTS is a directory path: use it as the target.$ARGUMENTS is empty: use the current working directory.$ARGUMENTS is a file path: use its containing directory.Confirm the target exists. If not, report an error and stop.
Walk up from the target to find the git root (directory containing .git/). Record both the target directory and the git root — the hierarchy spans between them.
Check whether .agents/principles-catalog/index.tsv exists at the git root.
If not present, try to auto-vendor it now (before any other phase):
Search for the dot-principles install.sh in these locations (in order):
<git-root>/../dot-principles/install.sh<git-root>/../../dot-principles/dot-principles/install.sh~/Code/dot-principles/dot-principles/install.shfind ~ -maxdepth 5 -name "install.sh" -path "*/dot-principles/*" 2>/dev/null | head -1If found: run <path-to-install.sh> vendor <git-root> and report:
"✓ Catalog vendored to .agents/principles-catalog/ — proceeding."
If not found: report:
"⚠️
.agents/principles-catalog/not found. Group lookups will use the hardcoded catalog below." " To vendor: clone dot-principles and run./install.sh vendor <git-root>" Continue using the hardcoded group list in Phase 3 (custom groups won't be available).
Record whether the catalog is available: catalog-available: true/false
If catalog-available: true, read all .context-scout.md files from the catalog:
.agents/principles-catalog/principles/*/.context-scout.md at the git root.{ namespace → [detection rules] } — these supplement Phase 2.If no .context-scout.md files are found, proceed with built-in detection only.
Analyse the target directory (and subdirectories) to build a profile per directory. For each directory, detect:
| Signal | Language / Framework |
|---|---|
*.java, pom.xml, build.gradle | Java |
*.ts, tsconfig.json | TypeScript |
*.py, pyproject.toml, requirements.txt | Python |
*.go, go.mod | Go |
*.cs, *.csproj, *.sln | C# |
*.rs, Cargo.toml | Rust |
*.rb, Gemfile | Ruby |
*.php, composer.json | PHP |
@SpringBootApplication, spring-boot in build file | Spring Boot |
@Entity, spring-data-jpa dependency | Spring Data JPA |
react, jsx, tsx imports | React |
@NgModule, @Component | Angular |
django in requirements | Django |
fastapi import | FastAPI |
express in package.json | Express |
| Signal | Domain |
|---|---|
payment, billing, invoice, stripe, checkout | Financial |
auth, login, oauth, jwt, session | Authentication |
user, profile, email, address, PII | Personal data |
microservice, service-mesh, saga | Distributed systems |
| Directory / files | Artifact type | Group |
|---|---|---|
docs/, *.md files (README, DESIGN, ADR, CONTRIBUTING) | docs | @docs |
.github/workflows/, Jenkinsfile, *.gitlab-ci.yml, azure-pipelines.yml | pipeline | @pipeline |
*.tf, *.tfvars, Dockerfile, docker-compose.*, Chart.yaml, k8s/, infra/, terraform/ | infra | @infra |
*.proto, *.graphql, openapi.yaml, swagger.yaml, schema.sql | schema | @schema |
.env, application.yaml, appsettings.json, *.properties | config | @config |
After applying the built-in signals above, apply any detection rules loaded in Phase 1.2. For each rule:
For projects with multiple subdirectories, detect profiles per directory:
src/main/ vs src/test/ — different testing principles for test dirssrc/security/, src/auth/ — security-focused principlesfrontend/, ui/, web/ — UI interaction principlesdocs/, doc/ — documentation principles (@docs)infra/, terraform/, k8s/, deploy/ — infrastructure principles (@infra).github/workflows/ — pipeline principles (@pipeline)Record a profile map: { directory → [detected groups] }
Based on the profile map from Phase 2, propose where to place .principles files and what to put in each.
.principles: Activate groups that apply to the whole project.principles: Activate additional groups or exclude principles that don't apply to that subtree.agents/principles-catalog/groups/)Reference these groups by their filename (without .yaml):
Language groups: java, typescript, python, go, csharp, rust
Framework groups: spring-boot, spring-data-jpa, react, angular, django, fastapi
Cross-cutting code groups: microservices, security-focused
Artifact-type groups: docs, infra, config, schema, pipeline
Also list any custom groups found in .agents/principles-catalog/groups/ that aren't listed above. Groups suggested by extension detection rules (Phase 1.2) are included here automatically — their availability depends on what's installed in the catalog.
For each proposed file, show:
[path]/.principles
@group1 ← reason
@group2 ← reason
CODE-OB-SERVICE-LEVEL-OBJECTIVES ← specific principle for this directory
!CODE-TS-TEST-FIRST ← exclusion and why
Ask for confirmation before writing: "I propose creating/updating N .principles files. Proceed? (yes to write, no to review proposals)"
Wait for user confirmation. If the user says no or requests changes, adjust proposals and ask again.
Before writing, check for existing .principles files at the proposed paths.
For each existing file:
!exclusions and comments)Determine final action per file: created | updated | unchanged
Write or update each file as determined in Phase 4.
# Generated by /dot-scout
# Detected: [artifact-type] / [language/framework/domain]
# Last analysed: [date]
@group1
@group2
# Direct includes
CODE-OB-SERVICE-LEVEL-OBJECTIVES
Do not add comments to lines that were already present in an existing file — only add comments to newly added entries.
After writing, output:
.principles analysis complete
Files written:
✓ created /path/to/.principles (@spring-boot, @security-focused)
✓ created /path/to/docs/.principles (@docs)
✓ updated /path/to/src/.principles (added @react)
— unchanged /path/to/infra/.principles (no changes needed)
Active groups resolved:
@spring-boot → @java, CODE-API-STANDARD-HTTP-METHODS, DDD-REPOSITORY, OWASP-03-INJECTION ... (N principles)
@docs → DOC-PURPOSE, DOC-MINIMAL, DOC-AUDIENCE, DOC-ACCURACY, DOC-EXAMPLES, DOC-PROGRESSIVE-DISCLOSURE ... (N principles)
Next steps:
- Run /dot-prime to activate principles before writing
- Run /dot-audit <target> to review against these principles
- Edit .principles files manually to add !exclusions or direct principle IDs
Write the canonical prime source to the vendored catalog. This phase runs unconditionally whenever catalog-available: true; it does not depend on which review tools are installed.
If catalog-available: false, report:
"⚠️ active.md skipped — catalog not available. Run
./install.sh vendor <git-root>and re-run /dot-scout." Skip this phase.
Read .agents/principles-catalog/index.tsv to look up the summary for each active ID (from the .principles hierarchy resolved in Phase 3–5). Format each as - ID: Summary.
Write (overwrite) .agents/principles-catalog/active.md:
<!-- generated by /dot-scout vVERSION — do not edit manually, re-run /dot-scout to refresh -->
# Active Principles
- PRINCIPLE-ID: Summary text here
- PRINCIPLE-ID: Summary text here
Rules:
.principlesScan the git root for signals that indicate which AI coding/review tools are active.
Install config — if .agents/principles-catalog/install.cfg exists, read it first. Each non-comment line is a target ID written by install.sh. The review-relevant targets are:
copilot-review → Copilot Code Review enabledclaude-review → Claude Code Review enabledIf install.cfg contains the target, that review tool is enabled regardless of other signals.
If install.cfg exists but does not contain the target, that review tool is disabled — skip it even if signal files exist.
If install.cfg does not exist, fall back to file-based detection below.
Copilot detection (fallback when no install.cfg) — any match = Copilot active:
.github/copilot-instructions.md exists.github/copilot-setup-steps.yml exists.github/instructions/*.instructions.md file exists (previous /dot-scout run)Claude detection (fallback when no install.cfg) — any match = Claude active:
CLAUDE.md exists at git root.claude/ directory existsREVIEW.md exists at git root (previous /dot-scout run)After detection, present findings and ask:
AI tool detection: Copilot: ✓ / ✗ (signal found) Claude: ✓ / ✗ (signal found)
Generate review instruction files for detected tools? (yes / no / select)
Record: copilot-active: true/false, claude-active: true/false
If catalog-available: false (set in Phase 1), report:
"⚠️ Per-group files skipped — catalog not available. Run
./install.sh vendor <git-root>and re-run /dot-scout." Skip the rest of Phase 7.
Read .agents/principles-catalog/index.tsv. Each line is ID|LAYER|SUMMARY.
From the active principle set (resolved via .principles hierarchy), look up each active ID in the index to get its Layer and Summary.
For each active @group, read .agents/principles-catalog/groups/<name>.yaml and note:
principles: list (filtered to only IDs in the active set, after !exclusions)globs: list. If the group has includes:, recursively union any explicitly declared globs: from included groups (groups with no globs: field contribute nothing — do not default them to **/* here). Only after this union is complete, if the result is still empty, default to ["**/*"].Any active IDs not found in index.tsv: include with summary "—" and log a warning.
Scan for files that contain the marker <!-- generated by /dot-scout:
.github/instructions/:
principles-core.instructions.md and copilot-active is true: keep it (will be overwritten in 7.3)REVIEW.md at git root:
Files without the <!-- generated by /dot-scout marker are user-created — never touch them.
Skip entirely if copilot-active is false.
Create directory .github/instructions/ if it does not exist.
For each active @group:
Build the file content first, then enforce the 4,000 character limit (Copilot Code Review truncates beyond this):
<!-- generated by /dot-scout vVERSION — do not edit manually, re-run /dot-scout to refresh -->
---
applyTo:
- "**/*.java"
---
# Group Name Principles
- PRINCIPLE-ID: Summary text here
- PRINCIPLE-ID: Summary text here
4k char enforcement: After building the content for a group:
.github/instructions/<group>.instructions.md<group>-1.instructions.md, <group>-2.instructions.md, …), each ≤ 4,000 chars. Split at principle-line boundaries (never mid-line). Each split file gets its own complete frontmatter header and <!-- generated by /dot-scout marker.Rules:
.agents/principles-catalog/ or the repo's VERSION fileapplyTo: values come from the group's resolved globs: (union of own + explicitly declared includes' globs; defaults to **/* only if none found)- ID: Summary# Group Name Principles heading uses the group's name: field from the YAML, title-casedCore principles file:
Write principles-core.instructions.md (apply 4k splitting if needed) with applyTo: "**/*" containing:
.agents/principles-catalog/layers/artifact-types.yaml → universal:).agents/principles-catalog/layers/<detected-stack>/layer-1-universal.md).principles files that do not belong to any active @groupSkip entirely if claude-active is false.
Generate a single REVIEW.md at the git root. Budget: ~10,000 characters / ~150 instructions max.
<!-- generated by /dot-scout vVERSION — do not edit manually, re-run /dot-scout to refresh -->
# Code Review Rules
## Critical — Always flag these
- PRINCIPLE-ID: Summary text here
## Important — Flag when violated
- PRINCIPLE-ID: Summary text here
## Style — Flag as nits
- PRINCIPLE-ID: Summary text here
Priority ordering (fill from top; if over budget, truncate from the bottom of Style upward):
After writing, output:
Active principles:
✓ .agents/principles-catalog/active.md (N principles)
AI tool integration:
Copilot detected: ✓ / ✗ (signal)
Claude detected: ✓ / ✗ (signal)
Files written:
✓ .github/instructions/ddd.instructions.md (13 principles, **/*.java, 1877 chars)
✓ .github/instructions/microservices-1.instructions.md (20 principles, **/*.java, 3998 chars)
✓ .github/instructions/microservices-2.instructions.md (16 principles, **/*.java, 3549 chars)
✓ .github/instructions/principles-core.instructions.md (29 principles, **/*, 3200 chars)
✓ REVIEW.md (87 principles, 9.2k chars)
Cleaned:
✗ deleted .github/instructions/old-group.instructions.md (group removed)
Tip: commit .agents/principles-catalog/ so CI and PR bots can use it without local install.
Append scout to .agents/principles-catalog/install.cfg (create the file if it does not exist). Use one target per line; do not add a duplicate if scout is already present.
This marker is kept for compatibility, and /dot-prime and /dot-audit accept both the legacy /scout and current /dot-scout generated files.