Skip to main content

stack2rules

Generate a stack-specific CLAUDE.md by running one command in a project root. No prompts, accounts, API calls, telemetry, or runtime dependencies.

Release status: source published on GitHub; the first tagged release and PyPI publication are pending. This is an independent community tool, not an Anthropic product. See the validation record for checks actually run.

Start with the examples, contribution guide or release instructions.

Requires Python 3.11+. Parsing uses standard-library json, re and tomllib. Setuptools is a build-time dependency only, as required by the setuptools.build_meta packaging backend.

Install and run

From this tool's source directory, preferably inside a virtual environment:

python -m venv .venv
# Activate: source .venv/bin/activate (macOS/Linux)
# Or: .venv\Scripts\Activate.ps1 (Windows PowerShell)
python -m pip install -e .
cd /path/to/your/project
stack2rules

This creates CLAUDE.md in the current directory. Nothing is executed from the scanned project. The tool never asks questions.

stack2rules --dir /path/to/project
stack2rules --dir /path/to/project --output CLAUDE.generated.md
python -m stack2rules.cli --help

Relative output paths resolve against --dir, not the invoking directory. Absolute output paths are accepted inside the project. The parent must already exist, the extension must be .md, and .. components are rejected. Existing files and symlinks are never overwritten, even on repeat runs. Generate a new filename to review changes or move the previous file before regeneration.

See the result

For the mixed-stack PowerShell test (13 technology sections plus overwrite protection), run & .\scripts\test-demo.ps1 -KeepProject from your source checkout after installing stack2rules. It prints the temporary output path for inspection. Omit -KeepProject to clean up its temporary files afterward.

The Next.js example includes dedicated Next.js, React, Tailwind CSS and TypeScript guidance. For example:

## Next.js

- Inspect the installed Next.js version and router before editing: preserve App Router or Pages Router conventions.
- For App Router, keep components on the server by default and use 'use client' only at interactive boundaries; never expose server secrets to clients.

There are also complete Django and React + FastAPI examples. These use synthetic manifests; no example dependencies need to be installed.

stack2rules --dir examples/nextjs --output CLAUDE.preview.md
python scripts/check_examples.py

Detection

Root file Fields inspected for dependencies
package.json dependencies, devDependencies, peerDependencies, optionalDependencies
requirements.txt Named requirements, extras, version constraints and named direct references
pyproject.toml PEP 621 dependencies/extras, dependency-groups, Poetry dependencies and groups

Supported rules: Python, Node.js, FastAPI, Django, Pandas, React, Next.js, Tailwind CSS, TypeScript, Vue, Express, Vitest, Flask, SQLAlchemy, pytest, Pydantic and NumPy. Python dependency names are normalized case-insensitively, with dots, underscores and hyphens treated equivalently.

Detection reports declared packages, including optional and development groups; environment markers are not evaluated. Framework versions are not inferred. Rules explicitly direct assistants to inspect installed versions before using version-specific APIs. Unknown packages and sensitive metadata are ignored. An empty project still receives general engineering and privacy guidance.

Safety and limitations

  • Reads only the three exact filenames above in the chosen root; never walks directories, .git, node_modules, virtual environments or monorepo children. Run separately in each workspace/package to detect its stack.
  • Explicitly excludes .git and .env* path components. Manifest symlinks, devices, directories and files over 1 MiB are skipped.
  • Does not inspect .env, lockfiles, scripts, credentials or private-key files. JSON/TOML manifests are parsed in memory, but only allowlisted dependency names are used. Secret keys/values, URLs and arbitrary text are never rendered or echoed in parser diagnostics.
  • Malformed JSON/TOML, invalid UTF-8, unavailable files and excessive nesting are skipped with sanitized warnings; missing manifests are normal.
  • Never follows requirements -r/-c includes, editable paths or bare URLs, evaluates dynamic Python metadata, or fetches remote dependencies.
  • Writes to a temporary file, flushes it, then atomically publishes using a no-clobber hard link. Existing destinations are preserved. Local filesystems supporting hard links are required; there is no unsafe overwrite fallback. Temporary files are removed after success or handled errors.
  • Assumes the project directory is not concurrently modified by an adversarial process. This is a local developer utility, not a filesystem security sandbox.

Exit codes: 0 generated; 1 unsafe/unavailable path, existing output or write failure; 2 invalid command-line arguments. Skipped manifests alone do not fail generation. Output is deterministic, UTF-8 Markdown without timestamps or paths.

Architecture and testing

  • cli.py: arguments, output validation and safe publication.
  • parsers.py: bounded reads and dependency-name detection.
  • templates.py: curated rules and deterministic Markdown compilation.
  • tests/test_stack2rules.py: standard-library regression tests.

After installation:

python -m unittest discover -s tests -v
python scripts/check_examples.py

To add a framework, register its exact package name in the appropriate parser mapping, add the corresponding RULES entry, and cover detection in tests.

Offline installation is possible when a compatible setuptools is already available in the active environment:

python -m pip install --no-index --no-build-isolation --no-deps -e .

The included GitHub Actions workflow is configured for Python 3.11–3.14 on Linux, macOS and Windows. It runs tests with and without site packages, checks examples, builds a wheel and tests an isolated install. See the Actions page for the current results. Actions are pinned to commit SHAs, use a read-only token and do not publish packages.

Contributing and license

See CONTRIBUTING.md for setup, testing and framework additions. Distributed under the MIT license. See CHANGELOG.md for release notes and RELEASE.md for the first-publication steps.

Metadata

Release files for stack2rules 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stack2rules 1.0.0
File Size Uploaded Provenance Actions
stack2rules-1.0.0.tar.gz 27.9 kB With provenance Details for stack2rules-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stack2rules 1.0.0
File Interpreter ABI Platform Actions
stack2rules-1.0.0-py3-none-any.whl Python 3 none any Details for stack2rules-1.0.0-py3-none-any.whl

Total release size: 40.0 kB

Release files / stack2rules-1.0.0.tar.gz

Download URL stack2rules-1.0.0.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5c89ff5febd33a3ce8ce2b4ae6045e8b09a739fe11f9beef8dec430c35e09b34
BLAKE2b-256 checksum
How to use checksums
35953049d103a168490b3115de7240989283add3f212b150a5b677297e924ca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / stack2rules-1.0.0-py3-none-any.whl

Download URL stack2rules-1.0.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c8bc4f82927eb2501ae156653b414b2200ff15ae0a53f97f036c3308e98b84a
BLAKE2b-256 checksum
How to use checksums
0b63f5a79b4f580c2bab67e5cea36a7539801dd6705d4b886d27343b0077e4f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for stack2rules 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stack2rules-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page