enterprise-discover
Skill1 starsChanged 8 months agoMITView on GitHub
Deep codebase learning agent. Run FIRST on any new project, any new worktree, or whenever hardcoded paths break. Produces stack-profile.json, stack-traps.json, and stack-best-practices.json that all enterprise-* skills consume. Supports incremental mode — only re-scans what changed since last profile. Without this, the pipeline guesses — and guesses wrong.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- anotherben/claude-harnesstheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- anotherben/claude-harness★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- enterprise-brainstormSkill
- enterprise-buildSkill
- enterprise-compoundSkill
- enterprise-contractSkill
- enterprise-debugSkill
- enterprise-forgeSkill
- enterprise-harnessSkill
- enterprise-planSkill
- enterprise-reviewSkill
- enterpriseSkill
- enterprise-verifySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 14 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Always: when switching to a new codebase or monorepo package
- Distinctive: line 18
Always: when a downstream skill fails due to wrong paths, wrong test commands, or wrong conventions
- Very specific: line 20
Incremental: when profile exists but profiled_commit != HEAD — only re-run affected phases
- Very specific: line 26
All files written to .claude/enterprise-state/:
- Very specific: line 43
Read profiled_commit from the JSON
- Distinctive: line 45
If no changes: SKIP — announce "Profile is current" and exit
- Very specific: line 52
Update profiled_commit and profiled_at
- Distinctive: line 63
Check for stack indicator files at project root and one level down:
- Distinctive: line 82
Import style (CommonJS require, ES modules import, path aliases)
- Distinctive: line 94
Check CLAUDE.md/AGENTS.md for branch rules
- Distinctive: line 105
Check route registration for auth middleware application pattern
- Distinctive: line 106
Check for public-before-auth route ordering
- Distinctive: line 121
Read migration files to catalog all tables and column types
- Distinctive: line 123
Check for timestamp columns using TIMESTAMP instead of TIMESTAMPTZ
- Distinctive: line 124
Check for naming inconsistencies across tables
- Distinctive: line 137
Verify test command actually works (dry run)
- Distinctive: line 143
Search for current best practices for the detected stack:
- Very specific: line 170
If test command fails: flag as "test_command_verified": false in profile
- Distinctive: line 252
Every enterprise skill must read the profile at start:
≈ “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.
Files
Enterprise Discover — Deep Stack Learning Agent
You are profiling a codebase you have never seen before. Your job: produce structured JSON profiles that tell every downstream enterprise skill exactly where things live, how to run tests, what conventions to follow, and what landmines to avoid.
This skill exists because hardcoded paths kill portability. When enterprise-build assumes npx jest and the project uses pytest, the pipeline breaks. Discovery eliminates these assumptions.
WHEN TO TRIGGER
- Always: as Stage 0 of
/enterpriseon any project without existing profile JSONs - Always: when switching to a new codebase or monorepo package
- Always: when a downstream skill fails due to wrong paths, wrong test commands, or wrong conventions
- On demand:
/enterprise-discoverstandalone - Incremental: when profile exists but
profiled_commit != HEAD— only re-run affected phases
OUTPUT FILES
All files written to .claude/enterprise-state/:
| File | Purpose |
stack-profile.json | Structure, commands, conventions — the primary config |
stack-traps.json | Type/schema/convention traps that will break code |
stack-best-practices.json | Framework-specific guidance from web research |
project-profile.md | Human-readable summary (generated FROM stack-profile.json) |
Schema reference: references/stack-profile-schema.md
INCREMENTAL MODE
When .claude/enterprise-state/stack-profile.json exists:
- Read
profiled_commitfrom the JSON - Compare:
git diff --stat <profiled_commit>...HEAD - If no changes: SKIP — announce "Profile is current" and exit
- Classify what changed:
- New dependencies (package.json, Gemfile, etc.) → re-run Phase 1 + Phase 2-G
- New migrations or schema changes → re-run Phase 2-E, 2-F
- New source files only → re-run Phase 2-D (auth patterns check)
- Config file changes → re-run Phase 1
- Merge updates into existing JSON — preserve manually-added traps in
stack-traps.json - Update
profiled_commitandprofiled_at
PIPELINE: 5 PHASES
Phase 1: SCAN (3 parallel agents)
Launch three agents simultaneously:
Agent A — Stack Detection:
- Check for stack indicator files at project root and one level down:
package.json→ Node.js (checkdependenciesfor framework: express, fastify, koa, next, nest)Gemfile→ Ruby (check for rails, sinatra)requirements.txt/pyproject.toml/setup.py→ Python (check for django, flask, fastapi)go.mod→ GoCargo.toml→ Rustpom.xml/build.gradle→ Java/Kotlincomposer.json→ PHP (check for laravel, symfony)mix.exs→ Elixir*.csproj/*.sln→ C#/.NET
- Detect monorepo tool:
turbo.json,nx.json,lerna.json,pnpm-workspace.yaml,workspacesin package.json - Detect package manager from lockfiles:
package-lock.json(npm),yarn.lock(yarn),pnpm-lock.yaml(pnpm),bun.lockb(bun) - Record:
stack.*,workspace_packages[]
Agent B — Directory Mapping + Conventions:
- Map directory structure:
lson root, each workspace package - Identify source dirs, test dirs, migration dirs, config files, entry points
- Sample 5+ source files from main source directory:
- Naming convention (camelCase, snake_case, PascalCase)
- Import style (CommonJS require, ES modules import, path aliases)
- Error handling pattern (custom classes, try/catch, Result types)
- Logger (console, winston, pino, structlog, slog)
- Service pattern (class-based, function exports, modules)
- Scan 5 largest source files for de facto size limits
- Catalog config files: linting, TypeScript, testing, CI/CD, env, editor, project instructions
- Record:
structure.*,conventions.*
Agent C — Git Analysis:
git remote -v→ remote type (github, gitlab, bitbucket)git branch -a→ all branches, detect default and protectedgit log --oneline -10→ recent commit style (conventional, free-form, ticket-prefixed)- Check CLAUDE.md/AGENTS.md for branch rules
- Record:
git.*
Phase 2: DEEP ANALYZE (4 parallel agents, needs Phase 1 results)
Agent D — Auth Pattern Detection:
# Search for auth patterns across the codebase
grep -rn "middleware.*auth\|authenticate\|requireAuth\|@login_required\|permission_classes\|before_action.*authenticate\|Authorization.*header" $SOURCE_DIR --include="*.$EXT" -l- Identify middleware name, file path, user object, user fields
- Check route registration for auth middleware application pattern
- Check for public-before-auth route ordering
- Record:
auth.*,routes.*
Agent E — Multi-Tenancy Detection:
# Search for tenant isolation patterns
grep -rn "tenant_id\|organization_id\|org_id\|account_id\|workspace_id\|team_id" $SOURCE_DIR --include="*.$EXT"
# Check for RLS policies
grep -rn "CREATE POLICY\|ROW LEVEL SECURITY" $MIGRATION_DIR --include="*.sql"- Identify tenant field name, enforcement mechanism
- Find exceptions (tables without tenant scoping)
- Record:
multi_tenancy.*
Agent F — Type/Schema Trap Detection:
- Read migration files to catalog all tables and column types
- Cross-reference foreign keys: check type consistency (UUID vs integer, text vs varchar)
- Check for timestamp columns using TIMESTAMP instead of TIMESTAMPTZ
- Check for naming inconsistencies across tables
- Record:
stack-traps.jsonentries
Agent G — Test Infrastructure Verification:
# Verify test framework is installed and configured
$TEST_FRAMEWORK --version
# Check test config files exist
ls jest.config* vitest.config* pytest.ini .rspec 2>/dev/null
# Run a quick test to confirm the command works
$TEST_CMD --listTests 2>/dev/null | head -5- Detect test framework, config, naming patterns
- Verify test command actually works (dry run)
- Detect coverage configuration
- Record:
commands.test_*,structure.test_dirs.*
Phase 3: RESEARCH (web search, needs Phase 1 results)
Search for current best practices for the detected stack:
Search: "[framework] [version] best practices [current year]"
Search: "[test framework] configuration patterns [current year]"
Search: "[database] migration best practices"
Search: "[framework] security checklist"Synthesize findings into stack-best-practices.json with:
- Category (testing, security, database, error_handling, performance, deployment)
- Practice description
- Rationale
- Source
Skip if: web search is unavailable or rate-limited. The pipeline works without best practices.
Phase 4: SYNTHESIZE
- Merge all agent results into
stack-profile.json - Generate
stack-traps.jsonfrom Phase 2-F findings - Generate
stack-best-practices.jsonfrom Phase 3 findings - Validate: run the test command once to confirm it works
If test command fails: flag as# Validation: does the test command actually run? $TEST_CMD 2>&1 | tail -5"test_command_verified": falsein profile - Generate
project-profile.mdfromstack-profile.json(human-readable)
Phase 5: PRESENT
- Print summary — stack, key commands, notable conventions, trap count
- Flag unknowns — any section that could not be determined. Do not guess.
- Flag conflicts — if discovered conventions conflict with CLAUDE.md instructions, flag both. CLAUDE.md wins.
- Save to memory — if a memory backend is available, save profile summary
- Hand off — if invoked as Stage 0 of
/enterprise, proceed to TRIAGE. If standalone, stop.
PROJECT PROFILE TEMPLATE (generated from JSON)
# Project Profile
<!-- Generated by /enterprise-discover from stack-profile.json -->
<!-- profiled_commit: [GIT_SHA] -->
<!-- profiled_at: [ISO_DATE] -->
## Stack
- **Language**: [stack.language]
- **Framework**: [stack.framework] [stack.framework_version]
- **Runtime**: [stack.runtime] [stack.runtime_version]
- **Package manager**: [stack.package_manager]
- **Monorepo**: [stack.monorepo_tool or "no"]
## Structure
- **Backend source**: [structure.source_dirs.backend]
- **Frontend source**: [structure.source_dirs.frontend or "none"]
- **Test dirs**: [structure.test_dirs.*]
- **Migration dir**: [structure.migration_dir]
## Commands
- **Test (all)**: `[commands.test_all]`
- **Test (single)**: `[commands.test_single]`
- **Build**: `[commands.build_frontend or "none"]`
- **Lint**: `[commands.lint or "none"]`
## Auth
- **Middleware**: `[auth.middleware_name]` at `[auth.middleware_path]`
- **User object**: `[auth.user_object]`
- **Pattern**: [auth.pattern]
## Multi-Tenancy
- **Enabled**: [multi_tenancy.enabled]
- **Field**: `[multi_tenancy.field]`
- **Enforcement**: [multi_tenancy.enforcement]
- **Exceptions**: [multi_tenancy.exceptions]
## Database
- **Type**: [database.type]
- **ORM**: [database.orm]
- **Migrations**: [database.migration_system]
## Conventions
- **File naming**: [conventions.file_naming]
- **Import style**: [conventions.import_style]
- **File extensions**: [conventions.file_extensions]
- **File size limits**: soft [conventions.file_size_soft_limit], hard [conventions.file_size_hard_limit]
## Git
- **Default branch**: [git.default_branch]
- **Protected**: [git.protected_branches]
- **Commit style**: [git.commit_style]
## Traps (from stack-traps.json)
[List each trap with severity and description]
## Workspace Packages (monorepo only)
| Package | Path | Purpose |
|---------|------|---------|
[workspace_packages entries]USAGE BY DOWNSTREAM SKILLS
Stack Resolution Preamble (copy into each skill)
Every enterprise skill must read the profile at start:
## STACK RESOLUTION
Read `.claude/enterprise-state/stack-profile.json` at skill start.
Extract variables:
$TEST_CMD = commands.test_all
$TEST_SINGLE = commands.test_single
$SOURCE_DIR = structure.source_dirs.backend
$FRONTEND_DIR = structure.source_dirs.frontend
$BUILD_CMD = commands.build_frontend
$TEST_FRAMEWORK = commands.test_framework
$AUTH_MIDDLEWARE = auth.middleware_name
$TENANT_FIELD = multi_tenancy.field
$TENANT_ENABLED = multi_tenancy.enabled
$FILE_EXTENSIONS = conventions.file_extensions
$BRANCH_MAIN = git.default_branch
If no profile exists: BLOCKED — run /enterprise-discover first.Conditional Blocks
# Only if multi-tenancy is enabled
if $TENANT_ENABLED:
verify every INSERT includes $TENANT_FIELD
verify every SELECT scopes by $TENANT_FIELD
# Only if auth middleware exists
if $AUTH_MIDDLEWARE != "":
verify protected routes use $AUTH_MIDDLEWARE
# Only if frontend exists
if $FRONTEND_DIR != "":
run $BUILD_CMD to verify buildDoes 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
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.

