agentleFS
YehudaFrankelYehudaFrankel/clankbrain/.claude/skills/scan-codebase/SKILL.md

scan-codebase

Skill16 starsChanged 7 months agoMITView on GitHub

Scans the current project and generates project-specific rules by reading actual code patterns, file structure, and conventions. Run automatically on first Start Session if no code-map exists. Triggers on /scan-codebase or \"scan the codebase\" or \"analyze the project\" or \"generate rules from code\".

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Allowed Tools: Read, Glob, Grep, Write, Bash

    line 12
  2. Very specific:

    Read package/build config (pom.xml, package.json, go.mod, requirements.txt, etc.) for dependencies

    line 20
  3. Distinctive:

    Document the data flow (request path from entry to database)

    line 41
  4. Distinctive:

    Document ONLY patterns observed in the actual code -- do not invent conventions

    line 44
  5. Distinctive:

    If a pattern appears in 3+ files, it is a convention

    line 47
  6. Distinctive:

    If two conflicting patterns exist, note both and ask which to standardize on

    line 48
  7. Distinctive:

    Document URL-to-file mapping if applicable (routes, pages)

    line 53
  8. Distinctive:

    Never invent conventions -- only document what the code actually does

    line 82
  9. Distinctive:

    If the project is too small (< 5 source files), say so and skip convention extraction

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: scan-codebase

Trigger: /scan-codebase or "scan the codebase" or "analyze the project" or "generate rules from code"

Description: Scans the current project and generates project-specific rules by reading actual code patterns, file structure, and conventions. Run automatically on first Start Session if no code-map exists.

Allowed Tools: Read, Glob, Grep, Write, Bash


Steps

1. Discover Project Structure

  • Glob for all source files: **/*.java, **/*.js, **/*.ts, **/*.py, **/*.go, **/*.html, **/*.css, **/*.sql, config files
  • Read package/build config (pom.xml, package.json, go.mod, requirements.txt, etc.) for dependencies
  • Identify entry points, main directories, test directories
  • Count files per directory to understand project shape

2. Sample Code Patterns (read 5-10 representative files)

  • Pick the largest files (likely core logic)
  • Pick files from different directories (coverage)
  • For each file, extract:
    • Naming conventions (variables, functions, classes, files)
    • Import/require patterns
    • Error handling patterns
    • Comment style and density
    • Indentation (tabs vs spaces, width)
    • String quote style (single vs double)
    • Function length patterns
    • Any project-specific patterns that repeat across files

3. Generate .claude/rules/code-map.md

  • List all major directories with purpose
  • List key files with one-line descriptions
  • Map entry points (API routes, main functions, page components)
  • Document the data flow (request path from entry to database)

4. Generate .claude/rules/coding-conventions.md

  • Document ONLY patterns observed in the actual code -- do not invent conventions
  • Include copy-paste examples from real files (with file path references)
  • Organize by category: naming, structure, error handling, imports, etc.
  • If a pattern appears in 3+ files, it is a convention
  • If two conflicting patterns exist, note both and ask which to standardize on

5. Generate .claude/rules/file-paths.md

  • Map canonical locations for each file type
  • Note any files that live in unexpected places
  • Document URL-to-file mapping if applicable (routes, pages)

6. Update .claude/rules/protected-files.md

  • Replace generic entries with actual protected files found:
    • Config files (env, build config, CI)
    • Migration/SQL files
    • Lock files
    • Generated/minified files
    • Files over 1000 lines (likely core, fragile)
    • Vendor/library directories

7. Update .claude/memory/decisions.md (or tasks/decisions.md if it exists)

  • Replace generic template decisions with actual architectural decisions visible in the code:
    • Framework and runtime (from actual imports, not guessing)
    • Database (from connection strings, ORM usage)
    • Auth pattern (from middleware, session handling)
    • API style (from route definitions)

8. Report

  • Output: "Scan complete. Generated:
    • .claude/rules/code-map.md ([N] directories, [N] key files)
    • .claude/rules/coding-conventions.md ([N] conventions observed)
    • .claude/rules/file-paths.md ([N] paths mapped)
    • .claude/rules/protected-files.md ([N] files protected)
    • decisions updated ([N] decisions seeded)"

Notes

  • This skill is READ-HEAVY -- it reads many files but only writes rule files
  • Never invent conventions -- only document what the code actually does
  • If the project is too small (< 5 source files), say so and skip convention extraction
  • Re-run anytime with /scan-codebase to refresh after major refactors

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.