skills/repo-scan/SKILL.md
# Repo Scan — Brownfield Initialization ## When this skill activates During `/setup` when the repository contains existing source code (brownfield project). The goal is to deeply review the existing codebase and produce pre-populated drafts of all memory bank files, so initialization reflects reality rather than starting from blank templates. --- ## Protocol Execute every step below in order. Do not skip any step. Collect all findings before writing any memory files. --- ### Step 1 — Map
npx skillsauth add pdlc-os/pdlc skills/repo-scanInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
During /setup when the repository contains existing source code (brownfield project). The goal is to deeply review the existing codebase and produce pre-populated drafts of all memory bank files, so initialization reflects reality rather than starting from blank templates.
Execute every step below in order. Do not skip any step. Collect all findings before writing any memory files.
Run the following to understand the top-level layout:
git ls-files | head -200
Also run:
find . -maxdepth 3 \
-not -path './.git/*' \
-not -path './node_modules/*' \
-not -path './.beads/*' \
-not -path './docs/pdlc/*' \
-not -name '.DS_Store' \
| sort
From this output, identify:
package.json, Gemfile, pyproject.toml, go.mod, Cargo.toml, pom.xml, etc.)main.*, index.*, app.*, server.*, cmd/)__tests__/, spec/, test/, tests/, *.test.*, *.spec.*).env.example, docker-compose.yml, Dockerfile, CI/CD configs)README*, CLAUDE.md, docs/ excluding docs/pdlc/)Read every file from this list that exists:
package.json / package-lock.json — for Node.js projectsGemfile — for Ruby projectspyproject.toml / requirements.txt / setup.py — for Python projectsgo.mod — for Go projectsCargo.toml — for Rust projectspom.xml / build.gradle — for Java/Kotlin projectsdocker-compose.yml / Dockerfile — for containerised stacks.github/workflows/*.yml — for CI/CD pipelinesREADME.md / README.rst / README.txt — for existing documentation.env.example — for environment variable hintsARCHITECTURE.md, CONTRIBUTING.md, DECISIONS.md, or ADR/ directoryCLAUDE.md — if present, this is the richest single source of project context (tech stack, architecture, conventions, key files, dev commands)Extract from these files:
test, build, start, deploy commands existIf CLAUDE.md exists, treat it as a high-confidence source. Its contents were likely curated by a developer and should be preferred over inferences when they conflict. Extract:
Identify and read (or skim) up to 10 of the most important source files. Priority order:
index.js, main.py, app.rb, main.go, src/main.*, etc.)routes/, router.*, urls.py, routes.rb)models/, schema.*, prisma/schema.prisma, db/schema.rb)controllers/, handlers/, views/, resolvers/)auth.*, middleware/auth.*, lib/auth/)openapi.yaml, swagger.json, graphql/schema.graphql)From these files, identify:
Find and skim up to 10 test files across different test types:
git ls-files | grep -E '\.(test|spec)\.' | head -20
git ls-files | grep -E '^(test|tests|spec|__tests__)/' | head -20
From test files, identify:
Run the following to understand the project's timeline:
git log --oneline --no-merges -50
Also run:
git log --format="%ai %s" --no-merges -20
From the git log, identify:
Before writing any file, compose a structured internal summary with these sections. You will use this summary to write all memory files:
REPO SCAN SUMMARY
=================
PROJECT
Name: [inferred from package.json/README/directory name]
Description: [1–2 sentence description of what it does]
Started: [date of first commit]
Primary language: [language]
Tech stack: [framework + DB + infra]
EXISTING FEATURES (list each concrete feature the app currently has)
1. [Feature name] — [1-sentence description]
2. ...
DATA MODEL (main entities)
- [Entity]: [fields / relationships in plain English]
- ...
API SURFACE (if applicable)
- [METHOD /path] — [what it does]
- ...
ARCHITECTURAL PATTERNS
- [Pattern observed, e.g. "MVC via Rails conventions", "Service objects for business logic"]
TEST COVERAGE
- Frameworks: [list]
- Covered: [features with tests]
- Gaps: [features with little or no test coverage]
CI/CD
- [What pipeline stages exist, what triggers them]
KEY DECISIONS (inferred from code and git history)
1. [Decision inferred, e.g. "Chose PostgreSQL over MongoDB — evidenced by ActiveRecord schemas"]
2. ...
TECH DEBT SIGNALS (code patterns suggesting debt)
- [e.g. "TODO/FIXME comments found in N files", "No tests for auth module", "Deprecated dep X"]
RECENT ACTIVITY (last 10 commits summary)
- [Area of focus, date range]
Print this summary to the user before proceeding, and ask: "Does this look accurate? Any corrections before I generate the memory files?" Wait for the user's response. Incorporate any corrections.
Use the verified summary to write pre-populated versions of all memory files. Do not use blank template stubs — fill in real content wherever the scan produced findings.
CONSTITUTION.mdINTENT.mdOVERVIEW.mdThis is the most important file to populate thoroughly:
DECISIONS.md## ADR-001 — [Decision title] *(pre-PDLC, inferred)*
**Date:** [inferred from git log or "unknown"]
**Status:** Accepted
**Decision:** [What was decided]
**Context:** [Why this decision makes sense given the codebase]
**Inferred from:** [git log / package.json / schema file / etc.]
---
Mark all pre-PDLC entries as *(pre-PDLC, inferred)* so the team knows these were reverse-engineered.
CHANGELOG.md## Pre-PDLC baseline — [first commit date] to [today]
### Existing functionality
[List the features from the scan as bullet points under "Added"]
*Note: This entry documents the state of the repository before PDLC was introduced.
Future entries will be generated by Jarvis during each Ship sub-phase.*
ROADMAP.md and STATE.mdInitialization Complete — Ready for /brainstormCLAUDE.md (project root)Generate a project-level CLAUDE.md at the repository root. This file gives Claude persistent context about the project across all sessions — not just PDLC sessions. It should be concise, factual, and derived entirely from scan findings.
Structure:
# [Project Name]
[1–2 sentence description of what the project does, from README or inferred from features]
## Tech Stack
- **Language:** [primary language(s)]
- **Framework:** [framework(s)]
- **Database:** [if detected]
- **Infrastructure:** [Docker, cloud provider, etc. if detected]
- **Key libraries:** [top 5–8 significant dependencies]
## Project Structure
[Brief description of directory layout — which directories contain what. Focus on the top 2 levels. Use a compact list, not a tree diagram.]
## Development
- **Install:** `[install command from package.json/Gemfile/etc.]`
- **Dev server:** `[start command]`
- **Build:** `[build command]`
- **Test:** `[test command(s)]`
- **Deploy:** `[deploy command, or "Not configured" if none found]`
## Architecture
[2–4 sentences describing the architectural style, key layers, and data flow. Reference specific directories where each layer lives.]
## Coding Conventions
[List 3–6 conventions observed in the codebase — naming patterns, file organization, import style, error handling approach, etc. Only include conventions that are clearly consistent across the codebase.]
## Key Files
[List 5–10 of the most important files for understanding the project — entry points, route definitions, schema files, config files. Use format: `path/to/file` — one-line description.]
Rules for CLAUDE.md generation:
Overflow protocol — splitting into sub-files:
If CLAUDE.md exceeds 180 lines after generation (or after any update), split the overflowing sections into sub-files under .claude/docs/:
Identify the largest sections (Architecture, Coding Conventions, and Key Files are the most likely to overflow). Move each overflowing section's detailed content into its own sub-file:
.claude/docs/architecture.md — full architecture description.claude/docs/coding-conventions.md — detailed conventions and patterns.claude/docs/key-files.md — comprehensive file reference.claude/docs/development.md — extended dev setup, environment config, troubleshootingReplace the moved section in CLAUDE.md with a brief summary (2–3 lines) and a reference:
## Architecture
[2–3 sentence summary of architectural style and key layers.]
See [.claude/docs/architecture.md](.claude/docs/architecture.md) for full architecture details.
Each sub-file must end with a return directive:
---
**This is a sub-file of the project root `CLAUDE.md`.** After reading this file, return to `CLAUDE.md` and continue with the next section. Do not stop or wait for input here.
Create .claude/docs/ directory if it doesn't exist:
mkdir -p .claude/docs
Keep CLAUDE.md as the single entry point. It must always contain the full section headings with summaries — sub-files provide depth, not replacement. A reader of CLAUDE.md alone should get a complete (if abbreviated) picture of the project.
Seven fully populated memory files under docs/pdlc/memory/ plus a project-root CLAUDE.md, all derived from real codebase analysis rather than blank templates.
data-ai
Run a feature autonomously from approved-PRD to shipped, evaluated by a per-turn Sentinel hook. Requires bypass-permissions mode and Agent Teams mode.
development
# Variant Convergence **Topic slug:** `variant-convergence` **Triggers:** - **Inception path — Brainstorm Design Step 10.7:** after Step 10.6 (Design-Laws Audit) completes, before Step 11 (PRD design-doc link updates) and the Step 12 design approval gate. Variants are HTML mockups Muse generates. - **Construction path — Build Review Step 12.5:** after Party Review (Step 12) writes its review file and Muse appends the *As-Built Audit* section to `ux-review.md`, before the Step 13 Review approval
data-ai
Force-release a stuck roadmap-level feature claim (admin command)
devops
Bypass the deploy-before-Operation guardrails block with a single confirmation