Skip to content

Add automated lexicon style guide checker#101

Merged
aspiers merged 2 commits intodevelopfrom
copilot/check-lexicons-against-guide
Jan 21, 2026
Merged

Add automated lexicon style guide checker#101
aspiers merged 2 commits intodevelopfrom
copilot/check-lexicons-against-guide

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Implements automated validation of lexicon definitions against ATProto style guide rules. Addresses common schema quality issues: missing constraints, incomplete descriptions, inconsistent naming.

Changes

  • scripts/check-lexicon-style.js - Validates 10+ style rules across lexicon files:

    • NSID format and naming conventions
    • Required descriptions (lexicons, definitions, properties)
    • String constraints (maxLength/maxGraphemes)
    • Blob constraints (maxSize, MIME types)
    • DateTime formats and naming
    • StrongRef documentation
    • Property naming (camelCase)
  • LEXICON_STYLE_GUIDE.md - Codifies ATProto best practices for reference

  • Integration - Added npm run check-lexicon-style with JSON and verbose output modes

  • CI Workflow - Added .github/workflows/style.yml that automatically runs the style checker on all pull requests and pushes to main/develop branches

Output Example

$ npm run check-lexicon-style

Checked 15 lexicon files
Found 57 issues in 15 files
  Errors: 42
  Warnings: 10
  Info: 5

❌ lexicons/org/hypercerts/claim/activity.json (8 issues)
  ❌ [string-max-length] String property must have maxLength or maxGraphemes
     Location: defs.main.record.properties.createdAt.maxLength
  ⚠️ [strongref-documentation] StrongRef should document expected lexicon type
     Location: defs.main.record.properties.workScope.description

Three severity levels enable incremental adoption: errors block CI, warnings flag issues for review, info suggests improvements.

Original prompt

This section details on the original issue you should resolve

<issue_title>check lexicons against Lexicon Style Guide using AI</issue_title>
<issue_description>https://atproto.com/guides/lexicon-style-guide</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

⚠️ No Changeset found

Latest commit: a631af7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@s-adamantine
Copy link
Contributor

s-adamantine commented Jan 21, 2026

I reviewed all 17 lexicons against the ATProto Lexicon Style Guide and created a compliance report.

Key Findings:

❌ Critical: badge/response.json uses enum instead of knownValues (violates schema evolution rules)
⚠️ Medium: 12 string fields across multiple files lack maxLength constraints
Minor: Some format/length redundancy in URI fields

Most things are done well - naming conventions, descriptions, strong references, and open unions all follow the guide correctly.

Copilot AI changed the title [WIP] Check lexicons against Lexicon Style Guide using AI Add automated lexicon style guide checker Jan 21, 2026
Copilot AI requested a review from aspiers January 21, 2026 04:05
@aspiers aspiers marked this pull request as ready for review January 21, 2026 08:12
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@aspiers
Copy link
Contributor

aspiers commented Jan 21, 2026

@copilot There shouldn't be a changeset here, but there should be a new style.yml CI workflow

Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot There shouldn't be a changeset here, but there should be a new style.yml CI workflow

Done! Removed the changeset and added .github/workflows/style.yml CI workflow that runs npm run check-lexicon-style on push and pull requests. (09fc4d7)

@aspiers aspiers force-pushed the copilot/check-lexicons-against-guide branch from 09fc4d7 to 983b7f9 Compare January 21, 2026 09:01
@aspiers aspiers force-pushed the copilot/check-lexicons-against-guide branch 3 times, most recently from ccfbacc to fdf0fdf Compare January 21, 2026 09:19
Co-authored-by: aspiers <100738+aspiers@users.noreply.github.com>
@aspiers aspiers force-pushed the copilot/check-lexicons-against-guide branch from fdf0fdf to a631af7 Compare January 21, 2026 09:23
@aspiers aspiers merged commit d3876a1 into develop Jan 21, 2026
4 checks passed
@aspiers aspiers deleted the copilot/check-lexicons-against-guide branch January 21, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check lexicons against Lexicon Style Guide using AI

3 participants