Prohlížeč zdrojového kódu
CLAUDE.md
# Ruby Portfolio Showcase App
## Tech Stack
- Ruby 3.2.5, Rails 7.2 with Sprockets + Importmaps + Turbo/Hotwire
- MariaDB (mysql2 adapter)
- Rouge (syntax highlighting), Redcarpet (Markdown)
- RSpec + FactoryBot + Capybara for testing
- Pico CSS v2 + SCSS via `dartsass-sprockets` (no Tailwind/Bootstrap)
- Mina for deployment, Puma in production
## Key Commands
Environment is set up to use project specific gemset. `bundle exec` is not needed.
```bash
rails server # Start dev server
rspec # Run all specs
rails db:create # Create databases
rails db:migrate # Run migrations
mina deploy # Deploy to production
mina restart # Restart puma on server
```
## Deployment
Is managed by `mina` with configuration in `config/deploy.rb`.
## Architecture
### Code Examples
File-based (`app/examples/<slug>/`), no DB. Each example has an `example.md` for rich Markdown-driven detail page layout with placeholder tags (`<!-- source -->`, `<!-- scenarios -->`, `<!-- scenario:N -->`). See [docs/specs/examples.md](docs/specs/examples.md), [docs/specs/example-content.md](docs/specs/example-content.md), and [docs/specs/examples-runner.md](docs/specs/examples-runner.md).
### Database
Only for example-specific data (e.g., a "query builder" example might need `products` table with seed data). Migrations/seeds are per-example.
### Source Browser
Whitelisted file tree with syntax highlighting. See [docs/specs/source-browser.md](docs/specs/source-browser.md), [source-browser-claude.md](docs/specs/source-browser-claude.md), [source-browser-md-links.md](docs/specs/source-browser-md-links.md).
## Key Routes
```
GET / → pages#home
GET /examples → examples#index
GET /examples/:slug → examples#show
POST /examples/:slug/run_scenario → examples#run_scenario
GET /source → source#index
GET /source/*path → source#show (format: false, trailing_slash: true)
```
## Styling
Pico CSS v2 + SCSS partials via `dartsass-sprockets`. Dark mode via `data-theme` on `<html>`, toggled by `ThemeController` (Stimulus), persisted in `localStorage`. See [docs/specs/styling.md](docs/specs/styling.md) and [docs/specs/themes.md](docs/specs/themes.md).
**SCSS conventions:**
- Prefer Pico variables over custom ones.
- Scenario form uses bare `<label>` + `<select>` pairs (no `.form-group` wrapper).
## Language
The UI is in Czech. All view text, example metadata (`example.yml`: title, description, scenario names, input labels, tags), and user-facing error messages in services must be in Czech. Code identifiers (entry class/method names, option values used as Ruby kwargs) stay in English.
## Conventions
- Services in `app/services/`
- Examples in `app/examples/<slug>/`
- No Tailwind/Bootstrap — Pico CSS v2 + plain SCSS
- Prefer file-based over DB when possible
- Bundler pinned to 2.6.9
## Specification Workflow
Use the `/spec` slash command to run the spec workflow. Full workflow is defined in `.claude/skills/spec/SKILL.md`. Living spec files in `docs/specs/` describe what features/components are and how they work. Each spec is a permanent reference, not a task log. See [docs/specs/index.md](docs/specs/index.md).
## Claude instructions
- **Always read a relevant spec from `docs/specs/` before exploring source code.** Check `docs/specs/index.md` first.
- Do not deploy or commit code without explicitly being asked to. When asked to deploy, commit and push changes beforehand.
- Keep tests up to date with every code change — update specs before committing.
- Before committing, update CLAUDE.md with new knowledge, strategies and architectural decisions.
- After using assets:precompile to check for errors, remove precompiled assets with assets:clobber to avoid further changes from being hidden in development.