Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

create-evlog-map-rule

БесплатноБез исполняемых скриптовНе проверен

Add a new rule or a new framework adapter to `evlog map` in @evlog/cli. Use when adding a coverage check (requirement or opportunity) that scores entry…

evloghqот evloghq★ 1 955 звёзд на GitHub

Об этом скилле

Create an evlog map Rule (or Framework Adapter)

Extend the coverage scanner in @evlog/cli. Two kinds of extension:

  • A rule: a new question asked of every entry point (packages/cli/src/lib/map/rules/). This is the common case.
  • A framework adapter: teach evlog map to find entry points in a new framework (packages/cli/src/lib/map/adapters/). Rarer and heavier; see the last section.

PR Title

feat(cli): add the {id} map rule

The cli scope already exists, so no scope registration is needed.

Requirement or opportunity? Decide first

This is the design decision everything else follows from (see apps/docs/content/3.cli/3.rules.md for the published contract):

Requirement Opportunity
Effect on the score Costs weight points when it fails None, ever. The type forbids a weight
When it appears Whenever it applies Only when the project already uses the feature (appliesTo.when gated on project.features / project.pairable)
In the report FIX FIRST / THEN GOING FURTHER
Can fail a CI gate (--min-score, --baseline) Yes No

Guiding principle (from error-catalog.ts): a rule that fires on perfectly good code is policing, not helping. Opportunities must be gated on a signal that makes the case on its own (duplication, an installed package used without its evlog integration), never on "you could adopt a feature you don't use".

Current requirements: wide-event (40), audit (25), structured-errors (20), page-error-handling (20), context (15), error-handling (15). Current opportunities: error-catalog, audit-coverage, ai-logging, auth-identity.

Touchpoints Checklist (rule)

# File Action
1 packages/cli/src/lib/map/rules/{id}.ts Create the rule (one exported const)
2 packages/cli/src/lib/map/rules/index.ts Import + one line in REGISTRY
3 packages/cli/src/lib/map/types.ts + packages/evlog/src/shared/define.ts Add the id to the CheckId union and to EvlogMapRuleId, which types map.rules in evlog.config.ts (type asserts in index.ts fail the build if the registry and either union drift)
4 packages/cli/test/map/rules.test.ts Add cases (the file has an ESLint-RuleTester-style Case harness (runRuleSet exercises one rule in isolation))
5 apps/docs/content/3.cli/3.rules.md Add a row to the Requirements or Opportunities table + a ### {title} section
6 apps/docs/content/3.cli/4.scoring.md Requirements only: reflect the new weight in the scoring explanation
7 skills/review-logging-patterns/references/code-review.md Add a row to the matching rules table
8 .changeset/{id}-map-rule.md Changeset for "@evlog/cli": minor and "evlog": minor (map.rules accepts the new id)

Important: Do NOT consider the task complete until all applicable touchpoints have been addressed.

Step 1: Rule Source

One file, one exported const satisfying MapRule (from rules/types.ts; requirements and opportunities are its two variants):

export const {camelId}Rule = {
  id: '{id}',                    // kebab-case, matches CheckId
  category: 'requirement',       // or 'opportunity'
  title: '{col}',                // column header in --all, ~8 chars max
  expects: '{concrete thing}',   // e.g. 'log.audit()'
  question: 'Does this entry point …?',  // one sentence, shown by --inspect
  weight: 15,                    // requirements only — opportunities cannot have one
  docs: '/learn/…',              // docs path, no domain
  fixSlot: 'body',               // where suggest() lands: 'setup' | 'body' | … (default 'body')
  appliesTo: {
    kinds: HANDLER_KINDS,        // or a subset: 'api' | 'server-action' | 'middleware' | 'cron' | 'page'
    // frameworks: ['next'],     // optional framework gate
    when: ({ project, facts }) => /* opportunity gate — cheap, declarative */,
  },
  suggest({ project, target }) {
    // Code suggestion for `evlog map <file>`, aware of what the project already
    // has (project.catalogs, project.features…). Return lines of code.
    return ['const log = useLogger(event)']
  },
  create(context) {
    return {
      // Prefer onEnd + FileFacts — the shared AST pass already answers most
      // questions. Node-type listeners are the escape hatch.
      onEnd() {
        if (/* gap found */) context.report({ message: '…', line, snippet: true })
      },
    }
  },
} satisfies MapRule

Key rules:

  • Reporting nothing means the rule passed. context.report() only for gaps.
  • Read FileFacts first (../facts.ts). If the answer isn't there, consider extending the facts rather than writing AST listeners; facts are computed once per entry point for all rules, from the code that entry point runs: its handler and the same-file declarations it names (../reach.ts). In a file with several routes, a rule never sees another route's calls, an
Полный SKILL.md на GitHub

Установить create-evlog-map-rule в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл create-evlog-map-rule?

Add a new rule or a new framework adapter to `evlog map` in @evlog/cli. Use when adding a coverage check (requirement or opportunity) that scores entry points, or when extending the map scanner to a new framework. Covers rule source, registry, types, tests, docs, and the published skill.

Как установить скилл create-evlog-map-rule?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл create-evlog-map-rule запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить create-evlog-map-rule с