Skip to content

Add CLAUDE.md and generate-openapi-from-pr Claude skill#395

Merged
VedranZoricic merged 6 commits intointercom:mainfrom
VedranZoricic:vedran/add-claude-skill
Mar 10, 2026
Merged

Add CLAUDE.md and generate-openapi-from-pr Claude skill#395
VedranZoricic merged 6 commits intointercom:mainfrom
VedranZoricic:vedran/add-claude-skill

Conversation

@VedranZoricic
Copy link
Contributor

Why?

Engineers making API changes in the intercom monolith have to manually translate their Ruby code into OpenAPI YAML spec updates in this repo. Adding Claude configuration files makes it easier for people to create doc changes using Claude Code.

How?

Add a CLAUDE.md describing the repo structure and conventions, plus a Claude skill that takes an intercom monolith PR as input, analyzes the diff (controllers, presenters, version changes, routes), and generates the corresponding OpenAPI YAML updates.

Implementation Plan

Plan: Create "Generate OpenAPI from PR" Claude Skill

Context

Engineers making API changes in the intercom monolith must manually translate their Ruby code (controllers, presenters, version changes) into OpenAPI YAML spec updates in this repo (Intercom-OpenAPI). This is the most tedious part of the "Ship to Public API" workflow documented in the Engineering Wiki.

This skill automates that translation: given an intercom monolith PR, it analyzes the diff, identifies API changes, and generates the corresponding OpenAPI spec updates in descriptions/0/api.intercom.io.yaml (Unstable).

Scope: This repo only (Intercom-OpenAPI). Developer-docs PR remains a separate step.


Files to Create

1. .claude/skills/generate-openapi-from-pr/SKILL.md

Main skill entry point. Contains:

  • Frontmatter: name, description, allowed-tools (Task, Read, Glob, Grep, Write, Edit, Bash, AskUserQuestion)
  • Trigger conditions: When user provides an intercom monolith PR URL/number
  • Step-by-step workflow:
    1. Parse the PR URL/number from user input
    2. Fetch PR details: gh pr view <number> --repo intercom/intercom
    3. Fetch PR diff: gh pr diff <number> --repo intercom/intercom
    4. Identify API changes in the diff (see analysis rules below)
    5. Ask user which versions to target (default: Unstable only)
    6. Read the target spec file(s)
    7. Generate and apply OpenAPI YAML changes
    8. Run fern check to validate
    9. Summarize what was added/changed

2. .claude/skills/generate-openapi-from-pr/ruby-to-openapi-mapping.md

Reference guide mapping Ruby patterns to OpenAPI YAML with concrete before/after YAML examples.

3. .claude/skills/generate-openapi-from-pr/openapi-patterns.md

Concrete YAML templates for all common endpoint and schema patterns, extracted from real examples in the current spec.

4. .claude/skills/generate-openapi-from-pr/version-propagation.md

Guide for when/how to propagate changes across API versions.

5. CLAUDE.md

Repo-level configuration documenting structure, CI/CD, editing conventions, and SDK generation safety rules.

Generated with Claude Code

Add repo-level CLAUDE.md documenting the OpenAPI spec structure, CI/CD
workflows, editing conventions, and SDK generation safety rules.

Add a Claude skill that automates generating OpenAPI spec changes from
intercom monolith PRs. The skill analyzes PR diffs (controllers,
presenters, version changes, routes) and produces the corresponding
YAML updates. Includes reference guides for Ruby-to-OpenAPI mapping,
YAML patterns, and version propagation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@VedranZoricic VedranZoricic requested a review from a team March 9, 2026 13:50
VedranZoricic and others added 5 commits March 9, 2026 14:00
Add a UserPromptSubmit hook that detects intercom PR URLs and injects
context telling Claude to use the generate-openapi-from-pr skill.
Add user-invocable metadata and argument-hint to SKILL.md frontmatter.
Update CLAUDE.md to explicitly direct Claude to use the skill.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Make description pushier for better trigger accuracy (catches PR URLs,
  "update the spec", "document API change", etc.)
- Remove redundant "When to Activate" section (triggering is from description)
- Slim SKILL.md from 313 to 205 lines by moving inline YAML templates to
  reference files and using conditional pointers instead
- Add clear "read X when doing Y" guidance for reference files
- Condense endpoint/schema checklists into scannable summaries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tested against intercom/intercom#474982 (field addition) and #477688
(new endpoint). Both produced correct output matching human-written PRs.

Improvements based on test observations:
- Add fern check fallback (python YAML validation) for environments
  without fern installed
- Add guidance to extract descriptions from version change define_description
- Add guidance to match example verbosity level of sibling endpoints
- Add guidance to reuse existing example value styles (IDs, workspace IDs)
- Note common YAML validation pitfalls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace <uuid> placeholder with actual UUID format in error template
  to prevent literal output
- Make version-propagation note future-proof by removing hardcoded v2.15
  reference and adding "check the actual file" guidance
- Consolidate CLAUDE.md skill directive into single paragraph

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the intercom_version default column that mixed two different
patterns without explanation, making v2.15 look like an anomaly.
Instead, point readers to check the actual file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@VedranZoricic VedranZoricic merged commit 777e9ad into intercom:main Mar 10, 2026
3 checks passed
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.

2 participants