Skip to content
Skills Library
Programming · Building & coding

prism-scanner-module

/prism-scanner-module

Creates or extends scanner modules in packages/ng-prism/src/builder/scanner/. Triggers on "add scanner", "new extractor", "extend scanner", "add extraction", "scanner module".

Repository
ng-prism ↗
Licence
MIT
Last repository change
20.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 20.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Creates or extends scanner modules in packages/ng-prism/src/builder/scanner/. Triggers on "add scanner", "new extractor", "extend scanner", "add extraction", "scanner module".

Triggers from the description

add scannernew extractorextend scanneradd extractionscanner module
Original author description

Creates or extends scanner modules in packages/ng-prism/src/builder/scanner/. Triggers on "add scanner", "new extractor", "extend scanner", "add extraction", "scanner module".

How it works

  1. Architecture
  2. Existing Modules
  3. Module Template
  4. Test Template
  5. Key Patterns
  6. Conventions
  7. Checklist
Original SKILL.md headings · 158 lines, 613 words
SKILL.md preview
---
name: prism-scanner-module
description: Creates or extends scanner modules in packages/ng-prism/src/builder/scanner/. Triggers on "add scanner", "new extractor", "extend scanner", "add extraction", "scanner module".
---

# Scanner Module — Development Guide

Add or extend TypeScript Compiler API scanner modules under `packages/ng-prism/src/builder/scanner/`.

## Architecture

The scanner pipeline:

```
entry-point.scanner  →  component.scanner  →  manifest.generator
        ↓                      ↓
  resolves exports      uses input.extractor
  from the entry file   uses ast-utils
  (builder option
   `entryPoint`, e.g.
   public-api.ts)
```

**Orchestrator:** `scanner.ts` connects everything. It exports `createScanner(options: CreateScannerOptions): Scanner` — a factory that returns the scanner, not a bare `scan()` function.

## Existing Modules

| Module                     | Purpose                                                                                                                     |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `ast-utils.ts`             | Static AST evaluation utilities                                                                                             |
| `class-hierarchy.ts`       | Walk a class's `extends` chain so inherited inputs are found (`getClassHierarchy`)                                          |
| `entry-point.scanner.ts`   | Resolve exports from entry point                                                                                            |
| `component.scanner.ts`     | Find @Showcase components, extract config                                                                                   |
| `input.extractor.ts`       | Extract `input()`/`output()`/`model()` metadata (and legacy `@Input()`/`@Output()`)                                         |
| `manifest.generator.ts`    | Generate prism-manifest.ts source code                                                                                      |
| `pseudo-states.ts`         | Read and validate a variant's forced pseudo states (`readPseudoStates`)                                                     |
| `showcase-diagnostics.ts`  | Word the warnings for `@Showcase` values the scan had to drop                                                               |
| `showcase-states.ts`       | Read and validate the component-level `states` list, keeping every slot (`readShowcaseStates`)                              |
| `entry-point-discovery.ts` | Find a library's secondary entry points and its primary entry file (`discoverSecondaryEntryPoints`, `findPrimaryEntryFile`) |
| `scanner.ts`               | Orchestrator — exports `createScanner(options)`, which returns a `Scanner`                                                  |
| `index.ts`                 | Public surface of the scanner (re-exports the functions and their types)                                                    |

## Module Template

```typescript
// packages/ng-prism/src/builder/scanner/my-feature.ts
import ts from 'typescript';

export function myFeature(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker): MyResult[] {
    const results: MyResult[] = [];

    for (const member of classDecl.members) {
        if (!ts.isPropertyDeclaration(member)) continue;
        // ... extraction logic
    }

    return results;
}
```

## Test Template

```typescript
// packages/ng-prism/src/builder/scanner/my-feature.spec.ts
import path from 'node:path';
import ts from 'typescript';
import { resolveEntryPointExports } from './entry-point.scanner.js';
import { myFeature } from './my-feature.js';

const FIXTURES_DIR = path.join(__dirname, '__fixtures__');

const compilerOptions: ts.CompilerOptions = {
    target: ts.ScriptTarget.ES2022,
    module: ts.ModuleKind.ES2022,
    moduleResolution: ts.ModuleResolutionKind.Node10,
    experimentalDecorators: true,
    strict: true,
    skipLibCheck: true
};

describe('myFeature', () => {
    let checker: ts.TypeChecker;
    let exports: ts.Symbol[];

    beforeAll(() => {
        const entryFile = path.join(FIXTURES_DIR, 'public-api.ts');
        const result = resolveEntryPointExports([{ entryFile, importPath: 'fixture' }], compilerOptions);
        checker = result.program.getTypeChecker();
        exports = result.entries[0].exports;
    });

    it('should ...', () => {
        // resolve alias → get class declaration → call myFeature
    });
});
```

## Key Patterns

### Resolve alias symbols

```typescript
let sym = exports.find((s) => s.name === className)!;
if (sym.flags & ts.SymbolFlags.Alias) {
    sym = checker.getAliasedSymbol(sym);
}
const classDecl = sym.declarations!.find(ts.isClassDeclaration)!;
```

### Use ast-utils

```typescript
import { findDecorator, getDecoratorArgument, evaluateExpression, getJsDocComment } from './ast-utils.js';

const decorator = findDecorator(classDecl, 'Input');
const arg = getDecoratorArgument(decorator);
const value = evaluateExpression(arg);
const doc = getJsDocComment(member, checker);
```

### Type mapping

```typescript
const tsType = checker.getTypeAtLocation(member);

if (tsType.flags & ts.TypeFlags.StringLike) {
    /* string */
}
if (tsType.flags & ts.TypeFlags.NumberLike) {
    /* number */
}
if (tsType.flags & ts.TypeFlags.BooleanLike) {
    /* boolean */
}
if (tsType.isUnion()) {
    /* union — check for string literals */
}
if (checker.isArrayType(tsType)) {
    /* array */
}
```

## Conventions

- Use `.js` extensions in imports
- Test fixtures in `__fixtures__/`
- Export new modules from `index.ts`
- Add types to `plugin.types.ts` if they're part of the public API
- Tests use shared compiler options and shared fixture files
- Run tests: `npx nx test ng-prism -- --testPathPatterns=<module>`

## Checklist

- [ ] Module file created with clear, single-purpose function
- [ ] Spec file with comprehensive tests
- [ ] Fixtures added/updated if needed
- [ ] Exported from `index.ts`
- [ ] Types added to `plugin.types.ts` if public
- [ ] Tests pass: `npx nx test ng-prism`
- [ ] Build passes: `npx nx build ng-prism`
- [ ] Lint passes: `npx nx run-many -t lint` (runs with `--max-warnings 0`, so a warning fails it)

Versions

The database has no other skills named prism-scanner-module.

Database snapshot: 13.11.2026 · package version 1673bd7cdb8e (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100prism-plugin
    Creates ng-prism plugins following the NgPrismPlugin interface. Triggers on "create plugin", "new plugin", "add plugin", "plugin for".
  • 100prism-angular-component
    Creates Angular standalone components for the ng-prism library or test fixtures. Triggers on "create component", "add component", "new component". Follows ng-prism conventions with @Showcase decorator support.
  • 95prism
    Use when the user wants to solve or evolve the Prism GPU model-placement benchmark.
  • 84prism-advise
    Get CLAUDE.md recommendations from PRISM. Use when asked to audit, fix, improve, or check what is wrong with a CLAUDE.md file.
  • 84prism-analyze
    Analyze Claude Code session health using PRISM. Use when asked to check token usage, audit CLAUDE.md, understand why sessions are failing, or list projects.
  • 85prism
    Frontend engineer — UI components, dashboards, design system implementation, and frontend audits. Use when asked to "build this UI component", "audit the frontend", "implement the design system", or "build a dashboard".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.