This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the freee Accessibility Guidelines repository - a comprehensive documentation project for web and mobile accessibility guidelines. The project generates multi-language (Japanese/English) HTML documentation using Sphinx, with content sourced from YAML files and converted to reStructuredText.
Main branch: develop
Published documentation: https://a11y-guidelines.freee.co.jp/
The project uses a two-stage build process:
-
YAML → RST conversion (
yaml2rsttool)- Converts YAML guideline/check/FAQ data to reStructuredText
- Generates category pages, reference tables, and cross-references
- Runs before Sphinx build
-
RST → HTML generation (Sphinx)
- Builds Japanese docs in
ja/directory - Builds English docs in
en/directory - Supports both multi-page HTML and single-page HTML output
- Builds Japanese docs in
data/
├── json/
│ ├── guideline-categories.json # Category definitions
│ ├── wcag-sc.json # WCAG success criteria mapping
│ ├── faq-tags.json # FAQ tag definitions
│ ├── info.json # Reference link definitions
│ └── schemas/ # JSON schemas for validation
│ ├── guideline.json
│ ├── check.json
│ └── faq.json
└── yaml/
├── gl/ # Guidelines by category
├── checks/ # Accessibility checks
└── faq/ # FAQ articles
tools/lib/freee_a11y_gl - Core library for accessibility guideline management
- Models: Category, Guideline, Check, FAQ, WCAG mappings
- YAML processing and validation
- Relationship management between entities
- Multi-language support
tools/scripts/yaml2rst - RST content generator
- Template-based content generation using Jinja2
- Converts YAML data to Sphinx-compatible RST files
- Generates category pages, indexes, and cross-references
# Build both Japanese and English HTML
make html
# Build specific language
cd ja && make html
cd en && make html
# Build single-page HTML (singlehtml)
make singlehtml
# Clean build artifacts
make clean
# Check that all include files are referenced
make check-includes# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
npm install
# Run Python tests (yaml2rst)
cd tools/scripts/yaml2rst
python run_tests.py
python run_tests.py --coverage
# Run Python tests (freee_a11y_gl)
cd tools/lib/freee_a11y_gl
python -m pytest tests/
# Validate YAML against JSON schemas
ajv validate --spec=draft2020 -s data/json/schemas/guideline.json -r data/json/schemas/common.json -d data/yaml/gl/form/label.yaml
# Lint reStructuredText files
sphinx-lint --enable all --disable line-too-long ja/**/*.rst
# Lint Japanese text (textlint)
npx textlint ja/source/**/*.rst
# Code quality (Python)
black tools/
isort tools/
flake8 tools/
mypy tools/The build process for each language (ja/en) follows:
yaml2rstgenerates RST files from YAML data intosource/inc/andsource/faq/incfiles.mktracks dependencies- Sphinx builds HTML from RST sources in
source/directory - Output goes to
build/html/(orbuild/singlehtml/)
Each guideline YAML file structure:
id: gl-category-name # Unique ID with gl- prefix
sortKey: 1901 # Integer 1001-2199 for ordering
category: form # Category identifier
title:
ja: "日本語タイトル"
en: "English Title"
platform:
- web # web and/or mobile
- mobile
guideline:
ja: "ガイドライン本文"
en: "Guideline text"
sc: # WCAG success criteria
- 1.1.1
- 1.3.1
intent:
ja: "意図の説明"
en: "Intent explanation"
checks: # Related check IDs
- '0931'
info: # Related info links
- exp-form-labelingThe repository uses Husky + lint-staged for pre-commit validation:
- JSON schema validation for YAML files
- Sphinx linting for RST files
- Runs automatically on
git commit
Configuration in .lintstagedrc.mjs
Version information is stored in version.py:
guidelines_version- Main version (e.g., 'Ver. 202508.0')checksheet_version- Checksheet versionpublishedDate- Publication date
This file is imported by Sphinx configuration to set document version.
The project supports Japanese (ja) and English (en):
- Both languages share the same data structure
- YAML files contain i18n strings with
ja:anden:keys - Template directory symlink:
en/source/_templates → ja/source/_templates - Each language has its own Sphinx
conf.pywith locale settings
- Locale required:
ja_JP.UTF-8must be installed for Japanese date formatting - Python version: 3.9+ (see requirements)
- Sphinx: ~7.0 (specified in requirements.txt)
- Theme: sphinx_rtd_theme ~3.0
The repository uses reusable workflows for building:
.github/workflows/reusable-build-doc.yml- Main build workflow- Builds for specific tags/versions with configurable Python/Sphinx/theme versions
- Supports artifact reuse to avoid rebuilding unchanged content
- Environment variables:
BASE_URL,GTM_ID, build flags
Adding a new guideline:
- Create YAML file in appropriate
data/yaml/gl/{category}/directory - Follow the guideline schema (see
data/json/schemas/guideline.json) - Run
make cleanandmake htmlto rebuild - Validate with
ajv validatecommand
Modifying templates:
- Templates are in
yaml2rstpackage (Jinja2 format) - Export with:
yaml2rst --export-templates - Customize in
~/.config/freee_a11y_gl/templates/ - Template resolution: custom → user → built-in
Testing a single component:
# Test yaml2rst
cd tools/scripts/yaml2rst
pytest tests/unit/test_specific.py -v
# Test freee_a11y_gl
cd tools/lib/freee_a11y_gl
pytest tests/ -k "test_name"