@valentia-ai-skills/framework 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,4 +102,4 @@ After setup, a `.ai-skills.json` config file tracks your preferences. The genera
102
102
 
103
103
  ## Contributing
104
104
 
105
- To add or modify skills, edit the SKILL.md files in the `skills/` directory and publish a new package version.
105
+ To add or modify skills, edit the SKILL.md files in the `skills/` directory and publish a new package version.
package/bin/cli.js CHANGED
@@ -156,6 +156,15 @@ function installSkillsForTool(toolKey, skills) {
156
156
  const dest = path.join(skillsDir, skill.name);
157
157
  mkdirp(dest);
158
158
  fs.writeFileSync(path.join(dest, "SKILL.md"), skill.content);
159
+
160
+ // Write reference files if the skill has any
161
+ if (skill.references && typeof skill.references === "object") {
162
+ for (const [filePath, fileContent] of Object.entries(skill.references)) {
163
+ const refDest = path.join(dest, filePath);
164
+ mkdirp(path.dirname(refDest));
165
+ fs.writeFileSync(refDest, fileContent);
166
+ }
167
+ }
159
168
  }
160
169
  return skills.length;
161
170
  }
@@ -176,6 +185,14 @@ function installSkillsForTool(toolKey, skills) {
176
185
  content += `# SKILL: ${skill.name} (${skill.scope})\n`;
177
186
  content += `${"=".repeat(60)}\n\n`;
178
187
  content += body + "\n";
188
+
189
+ // Inline reference files for rules-file format
190
+ if (skill.references && typeof skill.references === "object") {
191
+ for (const [refPath, refContent] of Object.entries(skill.references)) {
192
+ content += `\n--- Reference: ${refPath} ---\n`;
193
+ content += refContent + "\n";
194
+ }
195
+ }
179
196
  }
180
197
 
181
198
  fs.writeFileSync(rulesPath, content);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@valentia-ai-skills/framework",
3
- "version": "1.0.9",
4
- "description": "AI development skills framework — centralized coding standards, security patterns, and SOPs for AI-assisted development. Works with Claude Code, Cursor, Copilot, Windsurf, and any AI coding tool.",
3
+ "version": "1.0.10",
4
+ "description": "AI development skills framework — centralized coding standards, security patterns, and SOPs for AI-assisted development. Works with Claude Code, Cursor, Copilot, Windsurf, and any AI coding tool.",
5
5
  "keywords": [
6
6
  "ai-skills",
7
7
  "claude-code",
@@ -0,0 +1,348 @@
1
+ ---
2
+ name: project-scanner
3
+ description: Reverse-engineer any codebase into AI-ready skill files. Use this skill when
4
+ a developer invokes /project-scanner, or asks to "scan this project", "learn
5
+ this codebase", "understand this repo", "generate skills for this project",
6
+ "create project context", "what are the conventions in this project", or
7
+ "onboard me to this codebase". Works with ANY programming language, framework,
8
+ or project size. Generates project-specific SKILL.md files in the gen/ folder
9
+ that teach AI agents the exact conventions, patterns, and architecture of the
10
+ scanned codebase. Must be invoked explicitly via /project-scanner — do not
11
+ auto-trigger.
12
+ version: 1.0.0
13
+ scope: global
14
+ last_reviewed: 2026-03-19
15
+ ---
16
+
17
+ # Project Scanner
18
+
19
+ Explore a codebase systematically and generate project-specific skill files
20
+ that capture its conventions, architecture, and workflows. The output goes
21
+ into a `gen/` folder so generated skills are clearly separated from
22
+ hand-written ones.
23
+
24
+ ## When to use
25
+
26
+ A developer invokes this skill explicitly when:
27
+ - They join a new project and want AI agents to understand it
28
+ - A legacy codebase needs to be made AI-ready
29
+ - The project has evolved and existing generated skills are outdated
30
+ - A client hands over a codebase and the team needs to ramp up fast
31
+
32
+ ## Output location
33
+
34
+ All generated files go into the `gen/` folder at the project root:
35
+
36
+ ```
37
+ gen/
38
+ project-conventions/SKILL.md ← naming, structure, imports, patterns
39
+ project-architecture/SKILL.md ← layers, data flow, key abstractions
40
+ project-workflows/SKILL.md ← how to run, test, deploy, add features
41
+ CLAUDE.md ← project context file for Claude Code
42
+ ```
43
+
44
+ If a `gen/` folder already exists, this is a RE-SCAN. Read the existing
45
+ generated skills first, then update them with any new patterns found.
46
+ Preserve content that is still accurate. Note changed sections clearly.
47
+
48
+ ---
49
+
50
+ ## Step 1: Detect the stack
51
+
52
+ Read these files to identify the technology stack. Check them in this order
53
+ and stop reading a category once identified:
54
+
55
+ **Package manager / language:**
56
+ | File | Stack |
57
+ |------|-------|
58
+ | `package.json` | JavaScript / TypeScript (check for `"type": "module"`) |
59
+ | `requirements.txt` or `pyproject.toml` or `Pipfile` | Python |
60
+ | `go.mod` | Go |
61
+ | `Cargo.toml` | Rust |
62
+ | `pom.xml` or `build.gradle` | Java / Kotlin |
63
+ | `Gemfile` | Ruby |
64
+ | `composer.json` | PHP |
65
+ | `*.csproj` or `*.sln` | C# / .NET |
66
+ | `pubspec.yaml` | Dart / Flutter |
67
+ | `Package.swift` | Swift |
68
+
69
+ **Framework** (read the dependency list from the package file):
70
+ - JavaScript: Express, Fastify, NestJS, Next.js, Remix, Nuxt, React, Vue, Angular, Svelte
71
+ - Python: FastAPI, Django, Flask, Starlette
72
+ - Go: Gin, Echo, Fiber, Chi, net/http
73
+ - Rust: Actix, Axum, Rocket
74
+ - Ruby: Rails, Sinatra
75
+ - PHP: Laravel, Symfony
76
+ - Java: Spring Boot, Quarkus, Micronaut
77
+
78
+ **Database** (look for ORM/driver dependencies):
79
+ - Prisma, TypeORM, Drizzle, Sequelize, Knex, Mongoose (JS)
80
+ - SQLAlchemy, Django ORM, Tortoise, Peewee (Python)
81
+ - GORM (Go), Diesel (Rust), ActiveRecord (Ruby)
82
+ - Check for: postgres, mysql, mongodb, redis, sqlite references
83
+
84
+ **Testing** (look for test framework dependencies):
85
+ - Jest, Vitest, Mocha, Cypress, Playwright, Testing Library (JS)
86
+ - pytest, unittest, nose (Python)
87
+ - go test (Go), cargo test (Rust)
88
+
89
+ Record all findings. You will reference them in the generated skills.
90
+
91
+ ## Step 2: Map the folder structure
92
+
93
+ Read the root directory listing, then drill into the main source directory
94
+ (usually `src/`, `app/`, `lib/`, `server/`, `pkg/`, or the root for simpler projects).
95
+
96
+ Go 3 levels deep maximum. Record the purpose of each top-level directory.
97
+
98
+ Look for these organizational patterns:
99
+ - **Layered**: `controllers/`, `services/`, `repositories/`, `models/`
100
+ - **Feature-based**: `users/`, `orders/`, `payments/` (each with its own controller/service/model)
101
+ - **MVC**: `models/`, `views/`, `controllers/`
102
+ - **Domain-driven**: `domain/`, `infrastructure/`, `application/`, `interfaces/`
103
+ - **Monorepo**: `packages/` or `apps/` with multiple sub-projects
104
+
105
+ Note any non-standard directories and their apparent purpose.
106
+
107
+ ## Step 3: Sample key files
108
+
109
+ Read files strategically. You do NOT need to read the entire codebase.
110
+ Sample 15-25 files following this priority:
111
+
112
+ **Always read (if they exist):**
113
+ 1. Entry point (`main.ts`, `index.ts`, `app.ts`, `main.py`, `main.go`, etc.)
114
+ 2. `README.md`
115
+ 3. Configuration loader (often `config.ts`, `settings.py`, `.env.example`)
116
+ 4. One route/controller file (pick the most complex one, not the simplest)
117
+ 5. One service/business logic file that the controller calls
118
+ 6. One data access file (repository, model, schema)
119
+
120
+ **Read 2-3 of each (pick the most representative, not the shortest):**
121
+ 7. Additional controller/route files
122
+ 8. Additional service files
123
+ 9. Test files (unit and integration if both exist)
124
+ 10. Middleware or shared utilities
125
+
126
+ **Read if present:**
127
+ 11. Database migration files (1-2 recent ones)
128
+ 12. Auth/authentication module
129
+ 13. Error handling (custom error classes, error middleware)
130
+ 14. CI/CD config (`.github/workflows/`, `Dockerfile`, `docker-compose.yml`)
131
+ 15. Frontend component files (if applicable, pick 2-3 with different complexity)
132
+
133
+ **What to look for in each file:**
134
+ - Naming patterns (how are variables, functions, classes, files named?)
135
+ - Import style (relative vs absolute, order, grouping)
136
+ - Export style (default vs named, barrel files)
137
+ - Error handling approach (try/catch, Result types, error middleware)
138
+ - How dependencies are obtained (constructor injection, imports, global)
139
+ - Comment style and JSDoc/docstring patterns
140
+ - Type usage (strict TypeScript, Python type hints, Go interfaces)
141
+
142
+ ## Step 4: Identify conventions
143
+
144
+ From the sampled files, extract concrete conventions. Be SPECIFIC — every
145
+ convention must include a real file path as a reference.
146
+
147
+ **Naming conventions:**
148
+ - Variable/function style: camelCase, snake_case, PascalCase?
149
+ - File naming: kebab-case, camelCase, PascalCase, snake_case?
150
+ - Class/type naming: what pattern?
151
+ - Database column naming: snake_case, camelCase?
152
+ - API route naming: plural/singular, kebab-case?
153
+ - Test file naming: `.test.ts`, `.spec.ts`, `_test.go`, `test_*.py`?
154
+
155
+ **Code patterns:**
156
+ - How is a typical request handled? Trace one request from route to response.
157
+ - How are errors created and propagated?
158
+ - How is data validated (Zod, Joi, Pydantic, custom)?
159
+ - How are database queries structured?
160
+ - How is authentication checked?
161
+ - How are responses formatted (envelope pattern, raw, DTO)?
162
+
163
+ **Project-specific idioms:**
164
+ - Any custom base classes or utilities that everything extends/uses?
165
+ - Shared types or interfaces that define the project vocabulary?
166
+ - Configuration patterns (env vars, config objects, feature flags)?
167
+ - Logging approach (structured, console, custom logger)?
168
+
169
+ ## Step 5: Generate the skill files
170
+
171
+ Create the `gen/` directory if it doesn't exist. Generate the following files.
172
+
173
+ ### IMPORTANT RULES FOR GENERATED SKILLS:
174
+
175
+ 1. **Use real code from the project as examples.** Copy actual snippets from
176
+ files you read. Include the file path: "See `src/services/user-service.ts`"
177
+
178
+ 2. **Be specific to THIS project.** Do NOT write generic advice like
179
+ "use descriptive names." Instead write: "Functions use camelCase
180
+ (`getUserById`, `createOrder`). Database columns use snake_case
181
+ (`created_at`, `user_id`). See `src/models/user.ts` for reference."
182
+
183
+ 3. **Reference files, not abstract rules.** Every pattern should point to
184
+ a concrete file: "For the standard service pattern, see
185
+ `src/services/order-service.ts` — all new services should follow
186
+ this structure."
187
+
188
+ 4. **Keep each file under 300 lines.** If a skill is too long, move
189
+ detailed content into a separate reference file in `gen/references/`.
190
+
191
+ 5. **Use standard SKILL.md format** with YAML frontmatter.
192
+
193
+ 6. **Focus on what's UNIQUE.** Global skills already cover generic best
194
+ practices. Generated skills should capture what's specific to this project.
195
+
196
+ ---
197
+
198
+ ### File 1: gen/project-conventions/SKILL.md
199
+
200
+ Use this template as a starting structure. Fill in every section with
201
+ findings from your exploration. Delete sections that don't apply.
202
+ Add sections for patterns unique to this project.
203
+
204
+ Read the template at `references/conventions-template.md` for the full
205
+ structure. Key sections:
206
+
207
+ - Project overview (1-2 sentences: what it does, who uses it)
208
+ - Tech stack (exact versions from package file)
209
+ - Naming conventions (variables, files, folders, DB, routes — with examples)
210
+ - File structure rules (where new files go, max file size observed)
211
+ - Import/export patterns (with real examples)
212
+ - Error handling pattern (with a real code snippet)
213
+ - Coding patterns checklist
214
+
215
+ ### File 2: gen/project-architecture/SKILL.md
216
+
217
+ Read the template at `references/architecture-template.md`. Key sections:
218
+
219
+ - Architecture pattern name and description
220
+ - Layer diagram (described in text: request → controller → service → repo → DB)
221
+ - Key abstractions (base classes, shared interfaces, utility modules)
222
+ - Data flow for a typical request (trace through actual files)
223
+ - Database access patterns (with real query examples)
224
+ - Authentication/authorization flow
225
+ - External service integrations
226
+ - Reference implementations (point to the best example of each pattern)
227
+
228
+ ### File 3: gen/project-workflows/SKILL.md
229
+
230
+ Read the template at `references/workflows-template.md`. Key sections:
231
+
232
+ - How to run the project locally (exact commands)
233
+ - How to run tests (unit, integration, e2e — exact commands)
234
+ - How to add a new feature (step-by-step: where to create files, what to update)
235
+ - How to add a new API endpoint (step-by-step specific to this project)
236
+ - Database migration process
237
+ - Deployment process (if CI/CD config was found)
238
+ - Environment variables (list all from .env.example with descriptions)
239
+
240
+ ### File 4: gen/CLAUDE.md
241
+
242
+ A concise context file for Claude Code. Not a skill — a project brief.
243
+ Should be under 100 lines. Contains:
244
+
245
+ - One-paragraph project description
246
+ - Tech stack summary
247
+ - Key directories and their purpose
248
+ - Commands (dev, test, build, deploy)
249
+ - Architecture in 3-4 sentences
250
+ - "When working on this project, also read the skills in gen/ for detailed conventions"
251
+
252
+ ---
253
+
254
+ ## Step 6: Push to Supabase (if configured)
255
+
256
+ After generating all files, check if `.ai-skills.json` exists in the
257
+ project root and contains `email` and an API URL.
258
+
259
+ If yes, make a POST request to report the scan:
260
+
261
+ ```
262
+ POST {API_URL}/scan-results
263
+
264
+ Body:
265
+ {
266
+ "email": "<from .ai-skills.json>",
267
+ "project_name": "<from package.json name or folder name>",
268
+ "detected_stack": "<language + framework + database>",
269
+ "skills": [
270
+ {
271
+ "name": "project-conventions",
272
+ "content": "<full SKILL.md content>"
273
+ },
274
+ {
275
+ "name": "project-architecture",
276
+ "content": "<full SKILL.md content>"
277
+ },
278
+ {
279
+ "name": "project-workflows",
280
+ "content": "<full SKILL.md content>"
281
+ }
282
+ ]
283
+ }
284
+ ```
285
+
286
+ If `.ai-skills.json` doesn't exist or the POST fails, skip silently.
287
+ The local files are the priority — Supabase sync is a bonus.
288
+
289
+ ## Step 7: Summary
290
+
291
+ After generating all files, present a brief summary:
292
+
293
+ ```
294
+ Project scanned: {project name}
295
+ Stack: {language} + {framework} + {database}
296
+ Architecture: {pattern name}
297
+
298
+ Generated skills:
299
+ ✓ gen/project-conventions/SKILL.md ({line count} lines)
300
+ ✓ gen/project-architecture/SKILL.md ({line count} lines)
301
+ ✓ gen/project-workflows/SKILL.md ({line count} lines)
302
+ ✓ gen/CLAUDE.md ({line count} lines)
303
+
304
+ Key conventions found:
305
+ - {top 3-5 most important conventions}
306
+
307
+ These skills are ready to use. Any AI agent working in this project
308
+ will now follow these conventions automatically.
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Re-scanning
314
+
315
+ If `gen/` already exists with previous scan results:
316
+
317
+ 1. Read all existing generated skills first
318
+ 2. Explore the codebase for changes (new files, new patterns)
319
+ 3. Update existing skills with new information
320
+ 4. Preserve content that is still accurate
321
+ 5. Add `# Updated: {date}` comments next to changed sections
322
+ 6. Note what changed in the summary output
323
+
324
+ ---
325
+
326
+ ## Edge cases
327
+
328
+ - **Monorepo**: If `packages/` or `apps/` with multiple sub-projects is detected,
329
+ ask the developer which sub-project to scan, or scan the root-level shared
330
+ conventions and note the monorepo structure.
331
+
332
+ - **Very small project** (< 10 files): Generate only `project-conventions/SKILL.md`
333
+ and `gen/CLAUDE.md`. Skip architecture and workflows if there isn't enough
334
+ to say.
335
+
336
+ - **Very large project** (> 500 files): Focus on the main source directory.
337
+ Don't try to read everything. Sample strategically and note areas you
338
+ didn't explore: "The `legacy/` directory was not analyzed."
339
+
340
+ - **No clear conventions** (inconsistent codebase): Note the inconsistencies
341
+ in the generated skills. Recommend which pattern to standardize on based
342
+ on what appears most frequently. Example: "File naming is inconsistent —
343
+ 60% use kebab-case, 40% use camelCase. Recommend standardizing on kebab-case
344
+ to match the majority."
345
+
346
+ - **Frontend + Backend in same repo**: Generate separate sections in the
347
+ conventions skill for frontend and backend patterns. Make clear which
348
+ rules apply where.