You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polish README and meta: social proof, Opus 4.7, CI, limitations (#2)
* Polish README and meta: social proof, Opus 4.7, CI, limitations
- Rewrite README hero with social proof (Habr top-5/20K reads, dev.to,
Технотекст 8) and post-1M-context narrative
- Add badges: License, Validate CI, Featured on Habr, Featured on dev.to,
Claude Code Opus 4.7
- Add Mermaid diagram of the four-layer defence model
- Inline the CRITICAL RULES block in README (was only in template)
- Add Tech stack & component map table
- Add Configuration notes section explaining permissions.allow vs hooks gate
- Add Limitations & honest disclaimers section (compaction, subagent
isolation, shell portability, slow suites, push-vs-commit gate)
- Add CHANGELOG.md (Keep a Changelog) starting at 0.1.0 → 0.2.0
- Add CONTRIBUTING.md with priority list
- Add .github/workflows/validate.yml: settings.json JSON, agent/rule
frontmatter, CHANGELOG presence, internal-link sanity
- Add docs/RECORDING-DEMO.md with asciinema/agg + OBS/ffmpeg recipes
- Annotate every rule in .claude/rules/{python-backend,frontend}.md with
a one-line "why" rationale
- Author signature: full name + Habr/dev.to profile links
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add Russian README and language switcher
- README.ru.md with full translation of the polished README, badges
with Russian-language Habr label, mirrored sections (Why this exists,
How it works, CRITICAL RULES, Quick Start, component map, Limitations)
- Language switcher line in README.md hero pointing to README.ru.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add bootstrap script for hero GIF recording
- docs/setup-demo-project.sh — creates /tmp/cc-demo with calculator.py,
one passing and one deliberately failing pytest, .claude/ configs
copied in, CLAUDE.md filled, single-commit git log. Ready for
asciinema recording without hand-setup.
- RECORDING-DEMO.md updated to reference the script
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Replace placeholder GIF with hand-rendered hero SVG
- docs/screenshots/hook-blocks-commit.svg — terminal-styled SVG (4.6 KB,
no animation pipeline needed) showing: claude session start,
user-issued git commit, [HOOK] running pytest, FAILED test, red block
panel "Commit blocked: Tests are failing", claude offering to fix.
SVG renders natively in GitHub README — no external recording tool,
no asciinema/agg dependency, no rendering jitter, no GIF size budget.
- README.md / README.ru.md updated to reference the SVG and to point
users at the bootstrap script + RECORDING-DEMO.md if they want a
real terminal recording instead.
The bootstrap-demo + asciinema flow is still available for anyone who
wants a real recording — the SVG is the default so the README looks
finished out of the box.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
> Loaded automatically when Claude opens any frontend source file. Each rule has a "why" so you can override it intentionally.
8
+
7
9
## Components
8
-
- Functional components only (no class components)
9
-
- One component per file
10
-
- Reusable components in `components/` directory
11
-
- Page components in `pages/` or `views/` directory
12
-
- Props interface/type defined at top of file
10
+
- Functional components only (no class components) — *hooks API is the supported path since React 16.8 (2019); class lifecycle methods are not first-class with Suspense / concurrent rendering*
11
+
- One component per file — *grep-by-filename works; circular-import risk drops*
12
+
- Reusable components in `components/`, page components in `pages/` or `views/` — *next.js / nuxt convention; routing tools depend on it*
13
+
- Props interface/type defined at top of file (TS) or `propTypes` defined at bottom (JS) — *contract is visible without scrolling; LSP autocomplete works for consumers*
13
14
14
15
## State Management
15
-
- Local state for component-specific data
16
-
- Global store for shared application state
17
-
- API calls through dedicated service layer (not inside components)
18
-
- Loading and error states for all async operations
16
+
- Local state for component-specific data (`useState`, `useReducer`) — *keep blast radius small; don't pollute global store with form input state*
17
+
- Global store (Zustand / Redux / Pinia) for shared application state only — *anything passed through more than 2 prop layers is a candidate; below that, prop drilling is fine*
18
+
- API calls through a dedicated service layer (`services/` or `api/`), not inside components — *one place to swap fetch for axios, add retries, mock in tests*
19
+
- Loading and error states for all async operations — *the "spinner-then-blank" UX is a regression magnet; always render `if (error) ... if (loading) ... return data`*
- Follow the project's existing convention (CSS modules / Tailwind / styled-components / vanilla-extract) — *do not introduce a second styling system; the bundle size and cognitive cost is real*
23
+
- Responsive design — mobile-first (`min-width` queries, not `max-width`) — *progressive enhancement; default styles work on the smallest target*
24
+
- No inline styles beyond trivial cases (one-off `style={{ width: dynamicPx }}`) — *inline styles bypass the design system, can't be themed, and hurt CSP*
24
25
25
26
## Error Handling
26
-
- Error boundaries for user-facing components
27
-
- User-friendly error messages (no raw error objects)
28
-
- Graceful degradation when API is unavailable
27
+
- Error boundaries for user-facing component trees — *uncaught render errors otherwise unmount the entire React tree (white screen)*
28
+
- User-friendly error messages, no raw `error.toString()` — *expose stack traces only in dev; production users see a sentence and a retry button*
29
+
- Graceful degradation when API is unavailable — *show cached data + "offline" indicator rather than a hard error*
29
30
30
31
## Testing
31
-
- Unit tests for utility functions
32
-
- Component tests for user interactions
33
-
- Mock API responses in tests
34
-
- Test accessibility (semantic HTML, ARIA labels)
32
+
- Unit tests for utility functions (Vitest / Jest) — *fastest feedback loop; pure functions deserve 100% coverage*
33
+
- Component tests for user interactions (Testing Library: `getByRole`, `userEvent.click`) — *test the user contract, not implementation details; avoid `getByTestId` unless nothing semantic exists*
34
+
- Mock API responses in tests (MSW preferred over `jest.mock`) — *MSW intercepts at the network layer, so the same mocks work in Storybook and Playwright*
35
+
- Test accessibility (semantic HTML, ARIA labels, `getByRole` queries) — *if Testing Library can find your button, so can a screen reader*
Copy file name to clipboardExpand all lines: .claude/rules/python-backend.md
+22-20Lines changed: 22 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,30 +4,32 @@ globs: ["**/*.py"]
4
4
5
5
# Python Backend Rules
6
6
7
+
> Loaded automatically when Claude opens any `*.py` file. Each rule has a "why" so you can override it intentionally rather than blindly.
8
+
7
9
## Code Style
8
-
- Type hints on ALL function signatures (parameters and return types)
9
-
- Docstrings on all public functions and classes (Google style)
10
-
- Use `pathlib.Path` instead of `os.path`
11
-
- Prefer f-strings over `.format()` or `%`
12
-
- Use `logging` module, never `print()` for non-debug output
13
-
- Constants in UPPER_SNAKE_CASE at module level
10
+
- Type hints on ALL function signatures (parameters and return types) — *enables `mypy --strict` and IDE autocomplete; required by FastAPI/Pydantic v2 for response_model inference*
11
+
- Docstrings on all public functions and classes (Google style) — *parsed by Sphinx/mkdocstrings; downstream callers see hover hints*
12
+
- Use `pathlib.Path` instead of `os.path` — *cross-platform paths, chainable API, `.exists()`/`.read_text()` without import gymnastics*
13
+
- Prefer f-strings over `.format()` or `%` — *fastest path on CPython 3.12+; lower cognitive load*
14
+
- Use `logging` module, never `print()` for non-debug output — *level filtering, structured handlers, captured by pytest's `caplog` fixture*
15
+
- Constants in UPPER_SNAKE_CASE at module level — *grep-friendly, distinguishable from runtime values*
14
16
15
17
## Error Handling
16
-
- Handle exceptions explicitly — never use bare `except:`
17
-
- Use custom exception classes for domain errors
18
-
- Always log exceptions with traceback: `logger.exception("message")`
19
-
- Return meaningful error messages to API callers
18
+
- Handle exceptions explicitly — never use bare `except:` — *bare except swallows `KeyboardInterrupt` and `SystemExit`, hides real bugs*
19
+
- Use custom exception classes for domain errors — *callers can `except DomainError` without coupling to library-specific exception types*
20
+
- Always log exceptions with traceback: `logger.exception("message")` — *not `logger.error(str(e))` which loses the stack*
21
+
- Return meaningful error messages to API callers — *FastAPI: prefer `HTTPException(status_code, detail)` over generic 500*
20
22
21
23
## Architecture
22
-
- Use Pydantic models for request/response validation
23
-
- Async endpoints where I/O is involved
24
-
- Dependency injection for testability
25
-
- Repository pattern for database access
26
-
- Service layer between routes and repositories
24
+
- Use Pydantic v2 models for request/response validation — *catches malformed input at the boundary; auto-generates OpenAPI*
25
+
- Async endpoints where I/O is involved (`await db.execute(...)`, `await http.get(...)`) — *sync handlers block the event loop and serialise the entire app*
26
+
- Dependency injection (FastAPI `Depends`) for testability — *swap real DB session for in-memory in tests without monkey-patching*
27
+
- Repository pattern for database access — *isolates SQL/ORM details from business logic; one place to add caching*
28
+
- Service layer between routes and repositories — *route handlers stay thin (parse → call service → serialise); business logic is unit-testable without HTTP*
27
29
28
30
## Testing
29
-
- Use pytest with fixtures
30
-
- Mock external services (API calls, database) in unit tests
31
-
- Use factories for test data (not hardcoded dictionaries)
32
-
- Async tests with `pytest-asyncio`
33
-
- Each test function tests ONE thing
31
+
- Use pytest with fixtures (not `unittest.TestCase`) — *first-class parametrize, smaller boilerplate, plugin ecosystem (`pytest-asyncio`, `pytest-mock`, `pytest-cov`)*
32
+
- Mock external services (API calls, database) in unit tests — *unit tests must run in <1 s each; integration tests live in a separate folder*
33
+
- Use factories for test data (`factory_boy`, `polyfactory`), not hardcoded dictionaries — *changes to a model don't break 50 unrelated tests*
34
+
- Async tests with `pytest-asyncio` and `@pytest.mark.asyncio` — *required for `async def` tests; otherwise pytest treats them as coroutines and skips silently*
35
+
- Each test function tests ONE thing — *failure message names exactly what regressed; no shotgun debugging*
-`Tech stack & component map` table mapping each file to a concrete role
12
+
-`Configuration notes` section explaining `permissions.allow` semantics and stack-specific test-command swap-ins
13
+
-`CHANGELOG.md` (this file)
14
+
-`CONTRIBUTING.md` with priority list for community submissions
15
+
-`.github/workflows/validate.yml` — validates `settings.json` is well-formed JSON and every agent file has a YAML frontmatter `name:` field
16
+
- "Featured on Habr / dev.to / Claude Code Opus 4.7" badges
17
+
- Inline `CRITICAL RULES` block in `README.md` so the value proposition is visible without opening the template
18
+
- "Why" rationale comments on rules in `.claude/rules/python-backend.md` and `.claude/rules/frontend.md`
19
+
- Author signature with full name and direct links to Habr / dev.to profiles
20
+
21
+
### Changed
22
+
- README hero rewritten: leads with social proof (Habr top-5, 20K reads, Технотекст 8) and Opus 4.7 / 1M context positioning
23
+
- "The Problem" section replaced with the post-1M-context narrative — regressions are a discipline problem, not a memory problem
24
+
- Project structure tree annotated with concrete responsibilities per file
25
+
-`Recommended stack` table extended with "Why" column
26
+
27
+
### Notes on `settings.json`
28
+
-`Bash(pip install*)` remains in `permissions.allow` for compatibility with the original community template, but is now flagged in README as a candidate for removal in security-sensitive projects
29
+
- The hook's `pytest` command is unchanged; README now documents the npm / cargo / go variants
30
+
31
+
## [0.1.0] — 2026-03-05
32
+
33
+
### Added
34
+
- Initial release accompanying the [Habr article](https://habr.com/ru/articles/1013330/) (top-5 day, 20K reads, Технотекст 8 entry) and the [dev.to article](https://dev.to/creatman/i-stopped-claude-code-from-breaking-my-projects-heres-the-exact-setup-1agi)
Thanks for considering a contribution. This repo is intentionally small — its job is to be a clean, copy-paste starter for Claude Code anti-regression configs. PRs that add real, battle-tested artifacts are very welcome.
4
+
5
+
## Priorities (highest impact first)
6
+
7
+
1.**Sister rules for new languages** — `.claude/rules/go-backend.md`, `rust-backend.md`, `typescript-node.md`, `kotlin.md`, etc. Follow the existing `python-backend.md` shape (frontmatter `globs:` + sections + a one-line "why" per rule).
8
+
2.**Framework-specific subagents** — `django-tester.md`, `nextjs-reviewer.md`, `rails-planner.md`. Constrain `tools:` to the minimum set needed and document the output format.
9
+
3.**Additional `PreToolUse` hooks** — examples that would fit:
0 commit comments