Skip to content
lint-monorepo logo

Lint Monorepo Skill

lint-monorepo

Unified linting and auto-fix for Python (Ruff) and TypeScript (ESLint) in monorepo. Use when fixing lint errors, running pre-commit checks, or diagnosing persistent code quality issues. Orchestrates auto-fix first, then root-cause analysis.

SKILL.md

Full skill instructions

Lint Monorepo Skill

Holistic linting skill for the Residency Scheduler monorepo. Orchestrates Python (Ruff) and TypeScript (ESLint) linting with intelligent auto-fix and root-cause analysis for persistent issues.

When This Skill Activates

  • Lint errors reported in CI/​CD
  • Pre-commit quality checks
  • Code review identifies style issues
  • ruff check or npm run lint fails
  • Persistent lint errors after auto-fix attempts
  • New code needs formatting before commit

Monorepo Structure

/​home/​user/​Autonomous-Assignment-Program-Manager/
├── backend/          # Python 3.11+ (Ruff)
│   ├── app/
│   └── tests/
└── frontend/         # TypeScript/​Next.js (ESLint)
    ├── src/
    └── __tests__/

Quick Commands

Full Monorepo Lint (Check Only)

# Run both in parallel
cd /​home/​user/​Autonomous-Assignment-Program-Manager

# Backend
cd backend && ruff check app/ tests/ && cd ..

# Frontend
cd frontend && npm run lint && npm run type-check && cd ..

Full Monorepo Auto-Fix

cd /​home/​user/​Autonomous-Assignment-Program-Manager

# Backend - format first, then fix
cd backend && ruff format app/ tests/ && ruff check app/ tests/ --fix && cd ..

# Frontend
cd frontend && npm run lint:fix && cd ..

Unified Linting Workflow

Phase 1: Auto-Fix First

Always attempt auto-fix before manual intervention:

# Step 1: Python formatting (non-destructive)
cd /​home/​user/​Autonomous-Assignment-Program-Manager/​backend
ruff format app/ tests/

# Step 2: Python lint auto-fix
ruff check app/ tests/ --fix

# Step 3: TypeScript lint auto-fix
cd /​home/​user/​Autonomous-Assignment-Program-Manager/​frontend
npm run lint:fix

# Step 4: Verify what remains
cd /​home/​user/​Autonomous-Assignment-Program-Manager/​backend && ruff check app/ tests/
cd /​home/​user/​Autonomous-Assignment-Program-Manager/​frontend && npm run lint

Phase 2: Triage Remaining Errors

If errors persist after auto-fix, categorize them:

CategoryPython (Ruff)TypeScript (ESLint)Action
Unsafe fixes--unsafe-fixes needed--fix didn't applyReview manually first
Logic errorsF-codes (F401, F841)no-unused-varsRequires code change
Type errorsNot ruff (use mypy)@typescript-eslintFix types, not lint
Style conflictsFormatter vs linterPrettier vs ESLintCheck config alignment

Phase 3: Root-Cause Analysis

For persistent errors, investigate the root cause:

# Python: Show full context
ruff check app/​path/​to/​file.py --show-source --show-fixes

# Python: Explain the rule
ruff rule <ERROR_CODE>  # e.g., ruff rule F401

# TypeScript: Show rule docs
npx eslint --print-config src/​path/​to/​file.tsx | grep -A5 "rule-name"

Phase 4: Targeted Fix

Apply fixes based on root cause:

# Example: F401 - Unused import
# Root cause: Import was used but function was deleted

# BAD - Just remove import (might break something)
# from utils import helper  # Removed

# GOOD - Check if import is re-exported or used elsewhere
grep -r "from.*import.*helper" app/
grep -r "helper" app/

Decision Tree

┌─────────────────────────────────────────────────────────────┐
│                    LINT ERROR DETECTED                       │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  Step 1: Run auto-fix                                        │
│     ruff check --fix (Python)                                │
│     npm run lint:fix (TypeScript)                            │
│           │                                                  │
│           ▼                                                  │
│  Step 2: Error resolved?                                     │
│     YES → Done, commit changes                               │
│     NO  → Continue                                           │
│           │                                                  │
│           ▼                                                  │
│  Step 3: Is it an unsafe fix?                                │
│     YES → Review the change, then --unsafe-fixes             │
│     NO  → Continue                                           │
│           │                                                  │
│           ▼                                                  │
│  Step 4: Is it a type error (not lint)?                      │
│     YES → Use react-typescript or mypy, not this skill       │
│     NO  → Continue                                           │
│           │                                                  │
│           ▼                                                  │
│  Step 5: Root-cause analysis                                 │
│     - Read the file context                                  │
│     - Check if symbol is used elsewhere                      │
│     - Check if it's a re-export                              │
│     - Apply targeted fix                                     │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Pre-Commit Checklist

Run before every commit:

cd /​home/​user/​Autonomous-Assignment-Program-Manager

# Backend
cd backend
ruff format app/ tests/
ruff check app/ tests/ --fix
ruff check app/ tests/  # Verify clean

# Frontend
cd ../​frontend
npm run lint:fix
npm run lint          # Verify clean
npm run type-check    # Types are separate from lint

# Return to root
cd ..

Common Patterns

Pattern 1: Unused Import After Refactoring

# Symptom: F401 after deleting code that used the import

# Step 1: Check if import is re-exported
grep -l "from.*module import symbol" app/​__init__.py app/​*/​__init__.py

# Step 2: If re-exported, keep it with noqa
from module import symbol  # noqa: F401 (re-exported)

# Step 3: If not re-exported, safe to remove

Pattern 2: Unused Variable in Loop

# Symptom: B007 - Loop variable not used

# BAD
for item in items:
    do_something_else()

# GOOD - Use underscore
for _ in items:
    do_something_else()

# ALSO GOOD - If you need the index
for i, _ in enumerate(items):
    do_something_with_index(i)

Pattern 3: TypeScript Implicit Any

// Symptom: Parameter 'e' implicitly has 'any' type

// BAD
const handleClick = (e) => { ... }

// GOOD
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => { ... }

// For events, common types:
// - React.ChangeEvent<HTMLInputElement>
// - React.FormEvent<HTMLFormElement>
// - React.KeyboardEvent<HTMLInputElement>

Pattern 4: SQLAlchemy Boolean Comparison

# Symptom: E712 comparison to True should be 'if cond is True:' or 'if cond:'

# This is a FALSE POSITIVE for SQLAlchemy
# SQLAlchemy requires == True for query building

# Solution: Add noqa comment
query = select(User).where(User.is_active == True)  # noqa: E712

Unsafe Fixes

Some fixes require --unsafe-fixes because they might change behavior:

# List what unsafe fixes would do (dry run)
ruff check app/ --unsafe-fixes --diff

# Apply if you've reviewed
ruff check app/ --unsafe-fixes --fix

Common unsafe fixes:

  • Removing unused imports that might be re-exported
  • Removing unused variables that might be used via locals()
  • Changing mutable default arguments

CI/​CD Integration

GitHub Actions Check

# In .github/​workflows/​ci.yml
- name: Lint Backend
  run: |
    cd backend
    ruff format --check app/ tests/
    ruff check app/ tests/

- name: Lint Frontend
  run: |
    cd frontend
    npm run lint
    npm run type-check

Pre-Push Hook

#!/​bin/​bash
# .git/​hooks/​pre-push

cd backend && ruff check app/ tests/ || exit 1
cd ../​frontend && npm run lint || exit 1

Integration with Other Skills

With code-quality-monitor

This skill is invoked by code-quality-monitor for lint gate checks:

code-quality-monitor detects lint needed
    → invokes lint-monorepo
    → lint-monorepo runs auto-fix
    → returns pass/​fail status

With automated-code-fixer

For complex fixes beyond auto-fix:

  1. lint-monorepo identifies the error
  2. automated-code-fixer applies the fix
  3. lint-monorepo verifies the fix worked

With react-typescript

For TypeScript type errors (not ESLint):

  • ESLint errors → lint-monorepo
  • Type errors (TS2xxx) → react-typescript

With python-testing-patterns

After fixing lint errors, run tests:

cd backend && pytest -x  # Stop on first failure

Escalation Rules

Escalate to human when:

  1. Auto-fix creates breaking changes
  2. Lint rule conflicts with project requirements
  3. Need to add project-wide noqa or disable rule
  4. CI fails but local passes (environment difference)
  5. Unsafe fixes affect public API

Can fix automatically:

  1. Import sorting (I001)
  2. Trailing whitespace
  3. Missing newlines
  4. Quote style
  5. Unused imports (after verifying not re-exported)
  6. Line length (via formatting)

Configuration Files

ToolConfig Location
Ruffbackend/​pyproject.toml or backend/​ruff.toml
ESLintfrontend/​.eslintrc.js or frontend/​eslint.config.js
Prettierfrontend/​.prettierrc
TypeScriptfrontend/​tsconfig.json

References

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View