-
Notifications
You must be signed in to change notification settings - Fork 13
feat(prompts): add extract, score, and validate-claims pack #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amirbahador-hub
wants to merge
10
commits into
main
Choose a base branch
from
feature/prompts-pack
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f16790b
feat(schemas): add Zod contract package
eee572d
feat(intelligence): add rubric v1, archetypes, and validators
7b09845
feat(prompts): add extract, score, and validate-claims pack
6748d7e
refactor(schemas): drop maxScore, rubric scale is fixed 0-5
8344a68
Merge remote-tracking branch 'origin/main' into feature/schemas-zod-c…
ab36770
chore(schemas): apply biome formatting
5418e2a
Merge remote-tracking branch 'origin/feature/schemas-zod-contract' in…
d438cc7
fix(intelligence): match keywords on word boundaries, drop unused zod…
bcfeff8
Merge remote-tracking branch 'origin/feature/intelligence-rubric-arch…
f7201ca
docs(prompts): consistent optional notation in extract prompt, runnab…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # @cv-builder/intelligence | ||
|
|
||
| The scoring brain the prompts and skill reference: the fixed rubric, the role | ||
| archetypes, and the validator specs. | ||
|
|
||
| - **Rubric v1** — six dimensions (Shipped Evidence, Quantified Impact, Tech/Tool | ||
| Visibility, ATS Compatibility, Keyword Match, Public Proof) with 0–5 anchors, | ||
| tagged `RUBRIC_VERSION`. | ||
| - **Archetypes** — role config (keywords, dimension weights, action verbs, | ||
| anti-patterns). Ships Software Engineer, Product Manager, Data & ML Engineer. | ||
| Add one by dropping a file in `src/archetypes/` and registering it. | ||
| - **Validators** — `checkAtsCompatibility()` plus the ATS and claim rule sets | ||
| the prompts encode. | ||
|
|
||
| `detectArchetype(resumeText)` picks the best-matching archetype, falling back to | ||
| Software Engineer when there's no signal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "@cv-builder/intelligence", | ||
| "version": "0.1.0", | ||
| "description": "Scoring rubric, role archetypes, and validators for CV evaluation", | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "dev": "tsc --watch", | ||
| "lint": "tsc --noEmit", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@cv-builder/schemas": "workspace:*" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^25.6.2", | ||
| "typescript": "^5.7.0", | ||
| "vitest": "^3.0.0" | ||
| }, | ||
| "keywords": [ | ||
| "cv", | ||
| "resume", | ||
| "rubric", | ||
| "archetypes", | ||
| "ats" | ||
| ], | ||
| "license": "MIT" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { ArchetypeSchema } from "@cv-builder/schemas"; | ||
| import { describe, expect, it } from "vitest"; | ||
| import { ARCHETYPES, checkAtsCompatibility, detectArchetype, RUBRIC } from "../index.js"; | ||
|
|
||
| describe("archetypes", () => { | ||
| it("ships at least 3, each valid against the schema", () => { | ||
| expect(ARCHETYPES.length).toBeGreaterThanOrEqual(3); | ||
| for (const archetype of ARCHETYPES) { | ||
| expect(ArchetypeSchema.safeParse(archetype).success, archetype.id).toBe(true); | ||
| } | ||
| }); | ||
|
|
||
| it("has weights summing to 1.0", () => { | ||
| for (const { id, evaluationWeights } of ARCHETYPES) { | ||
| const sum = Object.values(evaluationWeights).reduce((a, b) => a + b, 0); | ||
| expect(sum, id).toBeCloseTo(1, 5); | ||
| } | ||
| }); | ||
|
|
||
| it("covers every rubric dimension with a weight", () => { | ||
| const keys = RUBRIC.dimensions.map((d) => d.key).sort(); | ||
| for (const { id, evaluationWeights } of ARCHETYPES) { | ||
| expect(Object.keys(evaluationWeights).sort(), id).toEqual(keys); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe("detectArchetype", () => { | ||
| it("detects a software engineer resume", () => { | ||
| const text = | ||
| "Built React and Node services, scaled Postgres, deployed on Kubernetes."; | ||
| expect(detectArchetype(text).id).toBe("software-engineer"); | ||
| }); | ||
|
|
||
| it("detects a product manager resume", () => { | ||
| const text = "Owned the roadmap, ran A/B testing and user research, grew retention."; | ||
| expect(detectArchetype(text).id).toBe("product-manager"); | ||
| }); | ||
|
|
||
| it("falls back to the default on no signal", () => { | ||
| expect(detectArchetype("hello world").id).toBe("software-engineer"); | ||
| }); | ||
|
|
||
| it("matches whole words only, not substrings", () => { | ||
| const text = | ||
| "Drove go-to-market with MongoDB-backed analytics, owned the roadmap and funnel."; | ||
| expect(detectArchetype(text).id).toBe("product-manager"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("checkAtsCompatibility", () => { | ||
| it("flags a table layout", () => { | ||
| expect(checkAtsCompatibility("| Skills | Years |\n| React | 5 |").compatible).toBe( | ||
| false | ||
| ); | ||
| }); | ||
|
|
||
| it("passes clean single-column text", () => { | ||
| const text = "Experience\nBuilt things at Acme.\nContact: jane@example.com"; | ||
| expect(checkAtsCompatibility(text).compatible).toBe(true); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import type { Archetype } from "@cv-builder/schemas"; | ||
|
|
||
| export const dataMlEngineer: Archetype = { | ||
| id: "data-ml-engineer", | ||
| name: "Data & ML Engineer", | ||
| description: "Engineers building data pipelines and machine learning systems", | ||
| keywords: [ | ||
| "python", | ||
| "sql", | ||
| "spark", | ||
| "airflow", | ||
| "dbt", | ||
| "pandas", | ||
| "pytorch", | ||
| "tensorflow", | ||
| "scikit-learn", | ||
| "feature engineering", | ||
| "etl", | ||
| "data pipeline", | ||
| "warehouse", | ||
| "snowflake", | ||
| "bigquery", | ||
| "mlops", | ||
| "model serving", | ||
| "experiment tracking", | ||
| ], | ||
| evaluationWeights: { | ||
| shippedEvidence: 0.25, | ||
| quantifiedImpact: 0.2, | ||
| toolingVisibility: 0.25, | ||
| atsCompatibility: 0.1, | ||
| keywordMatch: 0.1, | ||
| publicProof: 0.1, | ||
| }, | ||
| actionVerbs: [ | ||
| "Built", | ||
| "Trained", | ||
| "Deployed", | ||
| "Productionized", | ||
| "Optimized", | ||
| "Automated", | ||
| "Modeled", | ||
| "Scaled", | ||
| ], | ||
| antiPatterns: [ | ||
| "familiar with machine learning", | ||
| "exposure to data science", | ||
| "worked with big data", | ||
| "passionate about AI", | ||
| ], | ||
| version: "1.0.0", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import type { Archetype } from "@cv-builder/schemas"; | ||
| import { dataMlEngineer } from "./data-ml-engineer.js"; | ||
| import { productManager } from "./product-manager.js"; | ||
| import { softwareEngineer } from "./software-engineer.js"; | ||
|
|
||
| // Register new archetypes here. Software Engineer is the fallback when nothing | ||
| // else clearly matches. | ||
| export const ARCHETYPES: Archetype[] = [softwareEngineer, productManager, dataMlEngineer]; | ||
|
|
||
| export const DEFAULT_ARCHETYPE = softwareEngineer; | ||
|
|
||
| export function getArchetype(id: string): Archetype | undefined { | ||
| return ARCHETYPES.find((a) => a.id === id); | ||
| } | ||
|
|
||
| export function listArchetypes(): Archetype[] { | ||
| return ARCHETYPES; | ||
| } | ||
|
|
||
| export { dataMlEngineer, productManager, softwareEngineer }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import type { Archetype } from "@cv-builder/schemas"; | ||
|
|
||
| export const productManager: Archetype = { | ||
| id: "product-manager", | ||
| name: "Product Manager", | ||
| description: "Product managers owning discovery, roadmap, and delivery", | ||
| keywords: [ | ||
| "roadmap", | ||
| "discovery", | ||
| "user research", | ||
| "a/b testing", | ||
| "experiment", | ||
| "okrs", | ||
| "kpis", | ||
| "retention", | ||
| "activation", | ||
| "funnel", | ||
| "churn", | ||
| "stakeholder", | ||
| "prioritization", | ||
| "agile", | ||
| "amplitude", | ||
| "mixpanel", | ||
| "go-to-market", | ||
| "pricing", | ||
| ], | ||
| evaluationWeights: { | ||
| shippedEvidence: 0.25, | ||
| quantifiedImpact: 0.25, | ||
| toolingVisibility: 0.1, | ||
| atsCompatibility: 0.15, | ||
| keywordMatch: 0.15, | ||
| publicProof: 0.1, | ||
| }, | ||
| actionVerbs: [ | ||
| "Launched", | ||
| "Owned", | ||
| "Drove", | ||
| "Grew", | ||
| "Defined", | ||
| "Prioritized", | ||
| "Increased", | ||
| "Reduced", | ||
| ], | ||
| antiPatterns: [ | ||
| "passionate about products", | ||
| "leveraged synergies", | ||
| "aligned stakeholders", | ||
| "wore many hats", | ||
| "helped with", | ||
| ], | ||
| version: "1.0.0", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import type { Archetype } from "@cv-builder/schemas"; | ||
|
|
||
| export const softwareEngineer: Archetype = { | ||
| id: "software-engineer", | ||
| name: "Software Engineer", | ||
| description: "Frontend, backend, and full-stack engineers building software", | ||
| keywords: [ | ||
| "typescript", | ||
| "javascript", | ||
| "python", | ||
| "go", | ||
| "java", | ||
| "react", | ||
| "node", | ||
| "postgres", | ||
| "redis", | ||
| "kafka", | ||
| "docker", | ||
| "kubernetes", | ||
| "aws", | ||
| "ci/cd", | ||
| "microservices", | ||
| "rest", | ||
| "graphql", | ||
| "testing", | ||
| "system design", | ||
| ], | ||
| evaluationWeights: { | ||
| shippedEvidence: 0.3, | ||
| quantifiedImpact: 0.2, | ||
| toolingVisibility: 0.2, | ||
| atsCompatibility: 0.1, | ||
| keywordMatch: 0.1, | ||
| publicProof: 0.1, | ||
| }, | ||
| actionVerbs: [ | ||
| "Built", | ||
| "Shipped", | ||
| "Designed", | ||
| "Scaled", | ||
| "Optimized", | ||
| "Migrated", | ||
| "Automated", | ||
| "Refactored", | ||
| ], | ||
| antiPatterns: [ | ||
| "familiar with", | ||
| "exposure to", | ||
| "team player", | ||
| "fast learner", | ||
| "responsible for various tasks", | ||
| ], | ||
| version: "1.0.0", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import type { Archetype } from "@cv-builder/schemas"; | ||
| import { ARCHETYPES, DEFAULT_ARCHETYPE } from "./archetypes/index.js"; | ||
|
|
||
| function hasKeyword(text: string, keyword: string): boolean { | ||
| const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| // hyphen counts as a word char so "go" doesn't match "go-to-market" | ||
| return new RegExp(`(?<![\\w-])${escaped}(?![\\w-])`).test(text); | ||
| } | ||
|
|
||
| function countMatches(text: string, keywords: string[]): number { | ||
| return keywords.reduce((n, kw) => (hasKeyword(text, kw.toLowerCase()) ? n + 1 : n), 0); | ||
| } | ||
|
|
||
| // Picks the archetype whose keywords appear most in the resume. Falls back to | ||
| // the default when there's no signal, so detection never returns nothing. | ||
| export function detectArchetype( | ||
| resumeText: string, | ||
| archetypes: Archetype[] = ARCHETYPES | ||
| ): Archetype { | ||
| const text = resumeText.toLowerCase(); | ||
| let best = DEFAULT_ARCHETYPE; | ||
| let bestScore = 0; | ||
|
|
||
| for (const archetype of archetypes) { | ||
| const score = countMatches(text, archetype.keywords); | ||
| if (score > bestScore) { | ||
| best = archetype; | ||
| bestScore = score; | ||
| } | ||
| } | ||
|
|
||
| return best; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Rubric v1, role archetypes, and the validator specs the prompts encode. | ||
|
|
||
| export { | ||
| ARCHETYPES, | ||
| DEFAULT_ARCHETYPE, | ||
| dataMlEngineer, | ||
| getArchetype, | ||
| listArchetypes, | ||
| productManager, | ||
| softwareEngineer, | ||
| } from "./archetypes/index.js"; | ||
| export { detectArchetype } from "./detect.js"; | ||
| export { | ||
| RUBRIC, | ||
| RUBRIC_DIMENSIONS, | ||
| RUBRIC_VERSION, | ||
| type RubricDimension, | ||
| } from "./rubric.js"; | ||
|
|
||
| export { ATS_RULES, type AtsCheck, checkAtsCompatibility } from "./validators/ats.js"; | ||
| export { CLAIM_RULES } from "./validators/claims.js"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.