Quality Gate Detection
Dynamically detect project quality gates from package.json scripts and frameworks.
Prerequisites
- Read access to
package.json in the project root
Detection Process
Step 1: Analyze Project Scripts (Hybrid Diagnosis)
Read package.json and inspect the scripts section to identify verification commands.
Priority Heuristics:
- Test: Look for
test, test:unit, test:ci. Preference: npm test or specific script.
- Lint: Look for
lint, lint:fix, eslint. Preference: npm run lint.
- Typecheck: Look for
typecheck, tsc, build. Preference: npm run typecheck or tsc --noEmit.
- Browser/E2E: Look for
test:browser, e2e, cypress, playwright. Preference: npm run test:browser.
Framework Detection:
- Identify test runner:
jest, vitest, mocha, ava.
- Identify linter:
eslint, tslint, biome.
- Identify builder/runtime:
tsc, vite, next, webpack.
Step 2: Formulate Verification Commands
Construct the actual commands to be run by the agent.
- If a script exists (e.g.,
"test": "jest"), use npm run test.
- If no script exists but framework is detected (e.g.,
jest in dependencies), try standard binary npx jest.
- MISSING: If no scripts/frameworks are detected for a category, leave the command empty. Do NOT assume defaults like
npm test exist.
Step 3: Execution (Just-in-Time)
Use the detected commands immediately to verify your work.
- Do not write a
quality-gates.json file.
- Do not ask for permission to run standard checks unless they are destructive.
- Simply execute the commands as part of your verification loop.
Edge Cases
Ambiguous Scripts:
- If multiple scripts match (e.g.,
test and test:all), prefer the one that seems most appropriate for local verification (often test or test:unit).
- When in doubt, note the ambiguity in the "rationale".
Missing Scripts:
- If a category (e.g.,
lint) has no script and no detected config, omit it from the required gates. Report it as "Not Detected".
Validation
- Verify
package.json exists and is valid JSON.
- Ensure derived commands are executable (e.g., don't suggest
npm run lint if lint script is missing).
Reference Documentation
- Config Template: See
tools/config.json for full configuration structure
1---2name: quality-gate-detection3description: Detect and configure quality gate commands for Ralph's autonomous execution. Use when: (1) Analyzing a project to determine available test, lint, and build scripts, (2) Generatiing a task-specific verification checklist based on project reality. This skill enables Ralph to adapt verification to the specific project context.4---5
6# Quality Gate Detection
7
8Dynamically detect project quality gates from `package.json` scripts and frameworks.
9
10## Prerequisites
11
12- Read access to `package.json` in the project root
13
14## Detection Process
15
16### Step 1: Analyze Project Scripts (Hybrid Diagnosis)
17
18Read `package.json` and inspect the `scripts` section to identify verification commands.
19
20**Priority Heuristics:**
211. **Test:** Look for `test`, `test:unit`, `test:ci`. Preference: `npm test` or specific script.
222. **Lint:** Look for `lint`, `lint:fix`, `eslint`. Preference: `npm run lint`.
233. **Typecheck:** Look for `typecheck`, `tsc`, `build`. Preference: `npm run typecheck` or `tsc --noEmit`.
244. **Browser/E2E:** Look for `test:browser`, `e2e`, `cypress`, `playwright`. Preference: `npm run test:browser`.
25
26**Framework Detection:**
27- Identify test runner: `jest`, `vitest`, `mocha`, `ava`.
28- Identify linter: `eslint`, `tslint`, `biome`.
29- Identify builder/runtime: `tsc`, `vite`, `next`, `webpack`.
30
31### Step 2: Formulate Verification Commands
32
33Construct the actual commands to be run by the agent.
34- If a script exists (e.g., `"test": "jest"`), use `npm run test`.
35- If no script exists but framework is detected (e.g., `jest` in dependencies), try standard binary `npx jest`.
36- **MISSING:** If no scripts/frameworks are detected for a category, leave the command empty. Do NOT assume defaults like `npm test` exist.
37
38### Step 3: Execution (Just-in-Time)
39
40Use the detected commands immediately to verify your work.
41- Do **not** write a `quality-gates.json` file.
42- Do **not** ask for permission to run standard checks unless they are destructive.
43- Simply execute the commands as part of your verification loop.
44
45## Edge Cases
46
47**Ambiguous Scripts:**
48- If multiple scripts match (e.g., `test` and `test:all`), prefer the one that seems most appropriate for *local* verification (often `test` or `test:unit`).
49- When in doubt, note the ambiguity in the "rationale".
50
51**Missing Scripts:**
52- If a category (e.g., `lint`) has no script and no detected config, omit it from the *required* gates. Report it as "Not Detected".
53
54## Validation
55
561. Verify `package.json` exists and is valid JSON.
572. Ensure derived commands are executable (e.g., don't suggest `npm run lint` if `lint` script is missing).
58
59## Reference Documentation
60
61- **Config Template**: See `tools/config.json` for full configuration structure