RepoTrust

Leaderboard github.com

Windy3f3f3f3f/claude-code-from-scratch

Build your own Claude Code from scratch. 🔍 Claude Code 开源了 50 万行代码,读不动?用 ~5000 行 TypeScript / Python 从零复现核心架构,11 章分步教程带你理解 coding agent 精髓

  • View repository ↗
  • Python
  • ★ 2,832
  • commit acc4c34f062b
  • scored 2026-11-14
  • scoring prov-4+qual-2+sec-2

AI provenance

0%

possible

Confidence
64%
Coverage
100%

Estimated share of AI-generated code. Explicit attribution is a lower bound.

Code quality

52/100

weak

Confidence
90%
Coverage
100%

Complexity, duplication, lint density, tests, CI, docs and review process.

Security

62/100

weak

Confidence
85%
Coverage
100%

Secrets, static analysis, vulnerable dependencies, CI and supply-chain posture.

Scores

Pillar Score Signal Confidence Coverage
AI provenance (estimated AI-generated share) 0 possible 64% 100%
Code quality 52 weak 90% 100%
Security 62 weak 85% 100%

AI provenance

Weak signals consistent with AI-assisted development.

  • Explicitly attributed share (lower bound): 0.0%

  • Unattributed share in AI-consistent velocity bursts: 46.5%

  • Estimated AI-generated share: 0.0%

  • AI tooling configured in repo: claude-code

  • Stylometry index: 0.88 per 1,000 lines (narrated steps 4, placeholders 0, assistant phrasing 0, emoji 16). Reported as a signal, not scored.

Month Lines added Attributed to AI
2026-03 1,386 0%
2026-04 13,621 0%
2026-05 32 0%
2026-07 7,916 0%
2026-10 145 0%

Evidence

  • .claude/agents/reviewer.md (claude-code configuration) (.claude/agen)
  • .claude/rules/chinese-greeting.md (claude-code configuration) (.claude/rule)
  • .claude/skills/commit/SKILL.md (claude-code configuration) (.claude/skil)
  • .claude/skills/greet/SKILL.md (claude-code configuration) (.claude/skil)
  • CLAUDE.md (claude-code configuration) (CLAUDE.md)
  • 5,220 lines of first-party code in ~4.2h (1,244 lines/hour, 2 commit session) (a485299eb5c8)
  • 3,363 lines of first-party code in ~4.0h (841 lines/hour, 1 commit session) (a51d90943014)
  • 2,167 lines of first-party code in ~4.0h (542 lines/hour, 1 commit session) (3abb94529476)
  • step-by-step narration comment: // Step 1: Deny rules always win — even bypassPermissions (--yolo) is (src/tools.ts)
  • step-by-step narration comment: // Step 2: Plan mode's read-only contract beats allow rules and bypass: (src/tools.ts)
  • step-by-step narration comment: // Step 3: Mode-specific logic (src/tools.ts)
  • step-by-step narration comment: // Step 3: Built-in dangerous pattern checks (src/tools.ts)

AI provenance describes how code was produced; it is not a quality judgment. Unless attribution is explicit, these are signals consistent with AI generation, not proof. Squash/rebase workflows, imported code, and rewritten history reduce accuracy.

Code quality

Code quality is weak: test-to-source ratio 0.14, no CI test run detected; 25% of function code in complex or long functions; 5% duplicated lines. Weakest area: type safety.

Area Score
Complexity (lizard) 47
Duplication 76
Code smells (Opengrep) 67
Tests and CI 31
Documentation 65
Type safety 30
Process (Scorecard review/maintenance) n/a
  • Functions: 749; mean complexity 4.2, 90th percentile 10; 30 complex and 6 long functions
  • Duplicated lines: 4.7% of 10,522 compared
  • Tests: 1,970 test lines for 13,707 source lines (ratio 0.14); CI test commands: none detected; 9% of recent source commits also change tests
  • Docs missing or thin: contributing, changelog

Most complex functions:

Security

Security posture is weak: 9 known vulnerabilities in 3 dependencies; 11 high-severity SAST findings. Weakest area: posture.

Area Score
Secrets (gitleaks, tree + history) 97
Static analysis (Opengrep) 32
Vulnerable dependencies (OSV) 79
CI workflows (zizmor) n/a
Posture (policy, updates, signing, lockfiles) 0
OpenSSF Scorecard n/a
  • Known vulnerabilities: 9 in 3 packages (critical 0, high 5, medium 4, low 0)

  • Posture checks passed: lockfiles; missing: security policy, dependency updates, signed commits

Top findings

Severity Finding Location
high opengrep/python.lang.security.audit.dangerous-asyncio-create-exec-audit: Detected 'create_subprocess_exec' function without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. [confidence low] python/mini_claude/mcp_client.py:41
high opengrep/python.lang.security.audit.dangerous-asyncio-create-exec-tainted-env-args: Detected 'create_subprocess_exec' function with user controlled data. You may consider using 'shlex.escape()'. [confidence low] python/mini_claude/mcp_client.py:41
high opengrep/python.lang.security.audit.dangerous-subprocess-use-audit: Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. [confidence low] python/mini_claude/tools.py:356
high opengrep/python.lang.security.audit.dangerous-subprocess-use-audit: Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. [confidence low] python/mini_claude/tools.py:428
high opengrep/python.lang.security.audit.subprocess-shell-true: Found 'subprocess' function 'run' with 'shell=True'. This is dangerous because this call will spawn the command using a shell process. Doing so propagates current shell settings and variables, which makes it much easier for a malicious actor to execute commands. Use 'shell=False' instead. [confidence medium] python/mini_claude/tools.py:430
high opengrep/javascript.lang.security.detect-child-process: Detected calls to child_process from a function argument input. This could lead to a command injection if the input is user controllable. Try to avoid calls to child_process, and if it is needed ensure user input is correctly sanitized or sandboxed. [confidence low] src/tools.ts:500
high opengrep/python.lang.security.audit.dangerous-subprocess-use-audit: Detected subprocess function 'Popen' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. [confidence low] steps/canonical/py/mcp_client.py:15
high opengrep/python.lang.security.audit.dangerous-subprocess-use-audit: Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. [confidence low] steps/canonical/py/tools.py:209
high opengrep/python.lang.security.audit.subprocess-shell-true: Found 'subprocess' function 'run' with 'shell=True'. This is dangerous because this call will spawn the command using a shell process. Doing so propagates current shell settings and variables, which makes it much easier for a malicious actor to execute commands. Use 'shell=False' instead. [confidence medium] steps/canonical/py/tools.py:209
high opengrep/javascript.lang.security.detect-child-process: Detected calls to child_process from a function argument command. This could lead to a command injection if the input is user controllable. Try to avoid calls to child_process, and if it is needed ensure user input is correctly sanitized or sandboxed. [confidence low] steps/canonical/ts/mcp.ts:14
high opengrep/javascript.lang.security.detect-child-process: Detected calls to child_process from a function argument input. This could lead to a command injection if the input is user controllable. Try to avoid calls to child_process, and if it is needed ensure user input is correctly sanitized or sandboxed. [confidence low] steps/canonical/ts/tools.ts:209
high osv/GHSA-3jxr-9vmj-r5cp: brace-expansion@5.0.5 (npm) is affected by GHSA-3jxr-9vmj-r5cp package-lock.json
high osv/GHSA-6j4f-fj2g-mc7p: brace-expansion@5.0.5 (npm) is affected by GHSA-6j4f-fj2g-mc7p package-lock.json
high osv/GHSA-mh99-v99m-4gvg: brace-expansion@5.0.5 (npm) is affected by GHSA-mh99-v99m-4gvg package-lock.json
high osv/GHSA-qhr7-859c-m2p7: brace-expansion@5.0.5 (npm) is affected by GHSA-qhr7-859c-m2p7 package-lock.json
high osv/GHSA-rgw5-rvv9-x895: brace-expansion@5.0.5 (npm) is affected by GHSA-rgw5-rvv9-x895 package-lock.json
medium opengrep/python.lang.security.audit.dynamic-urllib-use-detected: Detected a dynamic value being used with urllib. urllib supports 'file://' schemes, so a dynamic value controlled by a malicious actor may allow them to read arbitrary files. Audit uses of urllib calls to ensure user data cannot control the URLs, or consider using the 'requests' library instead. [confidence low] python/mini_claude/tools.py:460
medium opengrep/javascript.lang.security.audit.path-traversal.path-join-resolve-traversal: Detected possible user input going into a path.join or path.resolve function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first. [confidence low] src/agent.ts:1324
medium opengrep/javascript.lang.security.audit.detect-non-literal-fs-filename: Detected that function argument toolName has entered the fs module. An attacker could potentially control the location of this file, to include going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are validated. [confidence low] src/agent.ts:1325
medium opengrep/javascript.lang.security.html-in-template-string: This template literal looks like HTML and has interpolated variables. These variables are not HTML-encoded by default. If the variables contain HTML tags, these may be interpreted by the browser, resulting in cross-site scripting (XSS). [confidence low] src/autonomy.ts:461
medium opengrep/javascript.lang.security.audit.detect-non-literal-fs-filename: Detected that function argument filePath has entered the fs module. An attacker could potentially control the location of this file, to include going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are validated. [confidence low] src/mcp.ts:260
medium opengrep/javascript.lang.security.audit.detect-non-literal-fs-filename: Detected that function argument filePath has entered the fs module. An attacker could potentially control the location of this file, to include going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are validated. [confidence low] src/mcp.ts:262
medium opengrep/javascript.lang.security.audit.detect-non-literal-fs-filename: Detected that function argument a has entered the fs module. An attacker could potentially control the location of this file, to include going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are validated. [confidence low] src/memory.ts:83
medium opengrep/javascript.lang.security.audit.path-traversal.path-join-resolve-traversal: Detected possible user input going into a path.join or path.resolve function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first. [confidence low] src/memory.ts:83
medium opengrep/javascript.lang.security.audit.detect-non-literal-fs-filename: Detected that function argument b has entered the fs module. An attacker could potentially control the location of this file, to include going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are validated. [confidence low] src/memory.ts:84

Static signals only: the scorer never runs the project's code. Secret findings are pattern matches that were not verified, and secret values are never stored.

Repository profile

  • Source lines: 13,707; test lines: 1,970
Language Lines
Python 6,649
TypeScript 6,498
JavaScript 2,421
Shell 109

Embed a badge

Maintainers can show these in a README. Badges update when the repository is re-scored.

[![RepoTrust ai](https://repotrust.synapticcyber.com/badge/github.com/Windy3f3f3f3f/claude-code-from-scratch/ai.svg)](https://repotrust.synapticcyber.com/r/github.com/Windy3f3f3f3f/claude-code-from-scratch/)
[![RepoTrust quality](https://repotrust.synapticcyber.com/badge/github.com/Windy3f3f3f3f/claude-code-from-scratch/quality.svg)](https://repotrust.synapticcyber.com/r/github.com/Windy3f3f3f3f/claude-code-from-scratch/)
[![RepoTrust security](https://repotrust.synapticcyber.com/badge/github.com/Windy3f3f3f3f/claude-code-from-scratch/security.svg)](https://repotrust.synapticcyber.com/r/github.com/Windy3f3f3f3f/claude-code-from-scratch/)