Rivet Scan - Codebase Auto-Discovery

VerifiedSafe

Analyzes codebase structure and initializes .rivet/systems.yaml by automatically identifying the project's architectural systems.

Sby Skills Guide Bot
DevelopmentIntermediate
3/8/2026
Claude Code
#codebase-analysis#architecture#project-setup#yaml-config#discovery

Recommended for

Automated summary

Scans a repository's structure (package manifests, directories, entry points, imports) to propose "systems" and generate the .rivet/systems.yaml file that gives the Rivet plugin its architecture map.

Strengths

  • Follows an explicit scan sequence: manifests, directory layout, entry points, then optional import relationships
  • States clear criteria for what counts as a real system versus a single file or utility helper
  • Handles a pre-existing systems.yaml by offering update, start-fresh, or skip
  • Writes a ready-to-use YAML with project name, descriptions, and per-system paths

Limitations

  • Example commands rely on fd and grep patterns tuned for TypeScript/Python; Java, Go, and Rust projects are only partially covered
  • Proposed systems depend heavily on the project's folder conventions and still need human review
  • It boots from a SessionStart hook and uses AskUserQuestion, tying it to Claude Code
When to use it

Use it when installing Rivet into a codebase, or to regenerate system definitions after a major restructuring of the code.

When not to use it

Avoid it for tiny single-file projects, or when .rivet/systems.yaml is already hand-curated and should be left untouched.

Security analysis

Safe
Quality score78/100

The skill is a read-oriented codebase discovery routine: ls, fd/grep for manifests, directory listings, and a single Write to a project-local .rivet/systems.yaml. There is no network egress, no secret/token handling, no curl|sh, no rm -rf, no obfuscated payloads, and no disabling of safety controls. Bash usage is limited to benign inspection commands, and destructive/overwrite risk on the one written file is mitigated by the explicit user prompt in Step 5. Overall risk from listing is minimal.

Findings
  • •Write scope includes creating/overwriting .rivet/systems.yaml; Step 5 addresses the existing-file case with an AskUserQuestion prompt, but an atomic/skip-on-error safeguard for a partially written config is not described.
  • •Bash commands depend on `fd`, which may be absent on many systems; not a security issue but relevant to execution behavior (falls back to shell errors).
How this analysis is made

Examples

First-time setup
Install rivet and scan my codebase to set up the systems.
No systems file yet
No .rivet/systems.yaml was found — run the rivet scan and propose the systems for this repo.
Refresh after refactor
We moved src/services into src/domains, refresh the rivet system definitions to match the new structure.

name: rivet-scan description: Initialize Rivet by scanning codebase structure. Use when SessionStart hook reports no .rivet/systems.yaml, when user says "install rivet" or "set up rivet", or to refresh system definitions after major codebase changes. user-invocable: true allowed-tools: Bash, Read, Glob, Grep, Write, AskUserQuestion

Rivet Scan - Codebase Auto-Discovery

Analyze the codebase structure and propose systems for .rivet/systems.yaml.

Purpose

This skill runs during plugin installation to bootstrap .rivet/systems.yaml. It gathers structural data from the codebase and uses that to propose systems that form the project's architecture.

What Makes a Good System

A system is a cohesive bundle of code that forms a single mental model:

  • Has clear boundaries (you can point to where it starts and ends)
  • Forms a coherent abstraction (the pieces "fit together" conceptually)
  • Substantial size (~5% of codebase, or significant enough to cause confusion)
  • Has a name worth tracking (you'd mention it when explaining architecture)

A system is something you'd draw as a box in an architecture diagram. NOT individual functions, utility helpers, or single implementation files.

Scan Process

Step 1: Gather Package Boundaries

Look for package manifest files that indicate module boundaries:

# Find all package manifests
fd -t f -e json -e toml -e mod -e yaml '(package|Cargo|go|pyproject|pom)' .

Check for:

  • package.json (Node.js)
  • Cargo.toml (Rust)
  • go.mod (Go)
  • pyproject.toml / setup.py (Python)
  • pom.xml / build.gradle (Java)

Step 2: Analyze Directory Structure

# Get top-level directories with clear purpose
ls -la
# Look for common patterns: src/, lib/, pkg/, cmd/, internal/, etc.

Identify directories that represent distinct systems:

  • src/commands/ - Command implementations
  • src/services/ - Service layer
  • src/api/ - API endpoints
  • lib/ - Shared libraries
  • pkg/ - Public packages

Step 3: Find Major Entry Points

# Find main entry points
fd -t f '(main|index|app|server)\.(ts|js|py|go|rs)$'

# Find exports/public interfaces
grep -r "export" --include="*.ts" --include="*.js" | head -50

Step 4: Map Import Relationships (Optional)

For dependency hints between systems:

# TypeScript/JavaScript imports
grep -rh "^import.*from" --include="*.ts" --include="*.js" | sort | uniq -c | sort -rn

# Python imports
grep -rh "^from.*import\|^import" --include="*.py" | sort | uniq -c | sort -rn

Step 5: Check for Existing .rivet/systems.yaml

ls .rivet/systems.yaml 2>/dev/null

If .rivet/systems.yaml exists, prompt the user:

  • "We detected these systems in your codebase: [list]. Your .rivet/systems.yaml has: [list]. What would you like to do?"
  • Options: Update existing / Start fresh / Skip scan

Step 6: Propose Systems

Based on gathered data, create .rivet/systems.yaml with:

project:
  name: <from package.json or directory name>
  purpose: <inferred or left blank>

systems:
  <SystemName>:
    description: <what this system does>
    paths:
      - <directory paths>

Output Format

Create the .rivet/ folder and write systems.yaml with proposed systems. Each system should have:

  • A clear, concise name (PascalCase)
  • A one-line description of what it does
  • Associated paths in the codebase
  • Optional: depends_on hints from import analysis

Example Output

project:
  name: my-app
  purpose: ""

systems:
  API:
    description: HTTP endpoints and request handlers
    paths:
      - src/api/
      - src/routes/

  Database:
    description: Data persistence and query layer
    paths:
      - src/db/
      - src/models/

  CLI:
    description: Command-line interface and argument parsing
    paths:
      - bin/
      - src/commands/

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rivet-scan-codebase-auto-discovery-mmh8qqy0/download' --output '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md.part' && mv '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md.part' '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read, Glob, Grep, Write, AskUserQuestion

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md' && test -s '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rivet-scan' && cp -R '.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0' '.claude/skills/rivet-scan'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0'

openskills read 'rivet-scan-codebase-auto-discovery-mmh8qqy0'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/rivet-scan-codebase-auto-discovery-mmh8qqy0/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills