Skip to content

Commit 6b1243a

Browse files
CreatmanCEOclaude
andauthored
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>
1 parent 0b60a22 commit 6b1243a

10 files changed

Lines changed: 833 additions & 109 deletions

File tree

.claude/rules/frontend.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,32 @@ globs: ["**/*.{js,jsx,ts,tsx,vue,svelte}"]
44

55
# Frontend Rules
66

7+
> Loaded automatically when Claude opens any frontend source file. Each rule has a "why" so you can override it intentionally.
8+
79
## 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*
1314

1415
## 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`*
1920

2021
## Styling
21-
- Follow existing project conventions (CSS modules / Tailwind / styled-components)
22-
- Responsive design — mobile-first approach
23-
- No inline styles beyond trivial cases
22+
- 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*
2425

2526
## 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*
2930

3031
## 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*

.claude/rules/python-backend.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,32 @@ globs: ["**/*.py"]
44

55
# Python Backend Rules
66

7+
> Loaded automatically when Claude opens any `*.py` file. Each rule has a "why" so you can override it intentionally rather than blindly.
8+
79
## 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*
1416

1517
## 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*
2022

2123
## 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*
2729

2830
## 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*

.github/workflows/validate.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Validate
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Validate settings.json is well-formed JSON
16+
run: |
17+
python -c "import json,sys; json.load(open('.claude/settings.json'))"
18+
echo "settings.json: OK"
19+
20+
- name: Validate every agent has a YAML frontmatter name field
21+
run: |
22+
set -e
23+
fail=0
24+
for f in .claude/agents/*.md; do
25+
if ! awk '/^---$/{f++; next} f==1' "$f" | grep -qE '^name:[[:space:]]*[A-Za-z0-9_-]+'; then
26+
echo "::error file=$f::missing or invalid 'name:' field in YAML frontmatter"
27+
fail=1
28+
fi
29+
if ! awk '/^---$/{f++; next} f==1' "$f" | grep -qE '^description:'; then
30+
echo "::error file=$f::missing 'description:' field in YAML frontmatter"
31+
fail=1
32+
fi
33+
if ! awk '/^---$/{f++; next} f==1' "$f" | grep -qE '^tools:'; then
34+
echo "::error file=$f::missing 'tools:' field in YAML frontmatter"
35+
fail=1
36+
fi
37+
done
38+
exit $fail
39+
40+
- name: Validate every rule has a globs frontmatter
41+
run: |
42+
set -e
43+
fail=0
44+
for f in .claude/rules/*.md; do
45+
if ! awk '/^---$/{f++; next} f==1' "$f" | grep -qE '^globs:'; then
46+
echo "::error file=$f::missing 'globs:' field in YAML frontmatter"
47+
fail=1
48+
fi
49+
done
50+
exit $fail
51+
52+
- name: CHANGELOG.md exists and is non-empty
53+
run: |
54+
test -s CHANGELOG.md || (echo "CHANGELOG.md missing or empty" && exit 1)
55+
56+
- name: All Markdown internal links resolve
57+
run: |
58+
set -e
59+
fail=0
60+
while IFS= read -r line; do
61+
file="${line%%:*}"
62+
rest="${line#*:}"
63+
target=$(echo "$rest" | grep -oE '\]\([^)#]+' | sed 's/](//' | head -1)
64+
[ -z "$target" ] && continue
65+
case "$target" in
66+
http*|mailto:*|\#*) continue ;;
67+
esac
68+
base="$(dirname "$file")"
69+
resolved="$base/$target"
70+
if [ ! -e "$resolved" ] && [ ! -e "$target" ]; then
71+
echo "::warning file=$file::broken internal link → $target"
72+
fi
73+
done < <(grep -rEn '\]\([^)]+\)' README.md CHANGELOG.md CONTRIBUTING.md docs/*.md 2>/dev/null || true)

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) · [SemVer](https://semver.org/spec/v2.0.0.html).
5+
6+
## [0.2.0] — 2026-04-30
7+
8+
### Added
9+
- Mermaid diagram of the four-layer defence model in `README.md`
10+
- `Limitations & honest disclaimers` section covering compaction, subagent isolation, shell portability, slow suites, push-vs-commit gate, `/clear` behaviour, advisory nature of rules
11+
- `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)
35+
- `CLAUDE.md.template` with `CRITICAL RULES`, `Working Style`, `Agents`, `Known Patterns`, `Gotchas` sections
36+
- `.claude/settings.json` with `PreToolUse` commit-blocking `pytest` hook and `PostToolUse` edit reminder
37+
- Three subagents: `planner` (research-only, no `Write` tool), `tester` (full-suite runner with regression check), `code-reviewer` (severity-tagged review)
38+
- Two glob-scoped rules: `python-backend.md` (`**/*.py`), `frontend.md` (`**/*.{js,jsx,ts,tsx,vue,svelte}`)
39+
- `docs/WORKFLOW.md` daily playbook with emergency recovery and cheat sheet
40+
- `docs/MCP-SETUP.md` for Playwright, GitHub, Postgres, Context7
41+
- `LICENSE` (MIT)

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Contributing
2+
3+
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:
10+
- **Lint gate** on `git commit*` (`ruff check` / `eslint` / `golangci-lint`)
11+
- **Secret-scanning gate** on `git commit*` (`gitleaks detect --staged`)
12+
- **Migration-safety gate** on writes to `migrations/` directory
13+
4. **Stack-specific test-command swap-ins** for the README's `Configuration notes` section (Maven, Gradle, sbt, mix, etc.).
14+
5. **Recording assets** — better demo GIF / asciinema cast than the placeholder.
15+
16+
## What we will not merge
17+
18+
- "Best practices" essays without code artifacts.
19+
- Vendor-specific rules that lock the user into a single editor or shell beyond what the existing setup already does.
20+
- Hooks that silently weaken the commit gate (e.g. `pytest --pass-with-no-tests` without a clear opt-in note).
21+
- Generic linter configs that already have canonical homes elsewhere (just link to them in `docs/MCP-SETUP.md` style).
22+
23+
## Pull request checklist
24+
25+
- [ ] New rule file has frontmatter `globs:` and at least one "why" rationale per bullet
26+
- [ ] New subagent has `name:`, `description:`, `tools:` frontmatter and an explicit output format
27+
- [ ] New hook has a stated **timeout**, a stated **shell** (bash / pwsh / cross-platform), and a tested failure path
28+
- [ ] `README.md` and `CHANGELOG.md` updated when surface area changes
29+
- [ ] `validate.yml` workflow still passes (it checks `settings.json` is valid JSON and every `.claude/agents/*.md` has a `name:` frontmatter field)
30+
31+
## Style
32+
33+
- Prefer concrete commands and version numbers over abstract advice.
34+
- One sentence per rule. If you need a paragraph, you are explaining the wrong thing.
35+
- Cite the source of any "best practice" you import (Anthropic docs, SFEIR Institute, real incident).
36+
37+
## Author / maintainer
38+
39+
[@CreatmanCEO](https://github.com/CreatmanCEO) — Nick Podolyak. Open an issue first for anything larger than a single rule or subagent.

0 commit comments

Comments
 (0)