Skip to content
Back to skills

Language 2026 10 08

BSecurity

Source: `/root/ab-test/t7_without-skill/proc.js` Rewrite: `/root/ab-test/out/T7_without-skill.js`

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 26, 2026
ai-agents

Security analysis

B75/100
  • criticalAccesses sensitive system or user directories

Pro scans all 19 files and shows the line behind each finding

Scanned October 26, 2026

npx -y skills add Siririn77/i-have-autism --skill language-2026-10-08 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Language 2026 10 08?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Language 2026 10 08
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/siririn77-language-2026-10-08-7b902e16/badge)](https://www.skillsdirectory.com/skills/siririn77-language-2026-10-08-7b902e16)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# T7_without-skill — rewrite note

Source: `/root/ab-test/t7_without-skill/proc.js`
Rewrite: `/root/ab-test/out/T7_without-skill.js`

## What changed

Readability only; no behavioural change.

- Meaningful names: `d`/`o`/`r`/`i`/`j`/`t` → `items`/`statusFilter`/`results`/`item`/`total`.
- Inverted the status test (`if (item.s == o || o == null)` → early
  `continue` when `statusFilter != null && item.s != statusFilter`) to cut
  nesting and make the skip case explicit.
- Extracted the per-item score into `scoreItem(item, alreadyScored)`:
  the amount check, the 10% discount and the duplicate-id check each read
  as one statement instead of a nested block and a scan loop that mutated
  `t` to `0`.
- Replaced the "set `t = 0` if a prior row has the same id" trick with an
  explicit `isDuplicate ? 0 : total` return.
- Replaced the inner duplicate scan with `Array.prototype.some`, which
  keeps the same loose `==` comparison.
- Added JSDoc and short comments documenting the rules and the sort.
- Kept `module.exports = { proc }` and both parameters' arity.

## Behaviour preserved deliberately

- **Loose equality is kept.** `==`/`!=` are used for both the status and id
  comparisons so numeric and string ids/statuses keep matching each other.
  `!=`/`==` against `null` also still matches `undefined`, so a `null`
  *and* an `undefined` filter behave identically, as before.
- **Filter check order unchanged:** the status filter is still tested
  before the amount, so an item excluded by status never contributes.
- **Duplicate handling unchanged:** only the first occurrence of an id is
  kept — later rows with the same id score 0 and are not pushed.
- **Sort unchanged:** descending by `total`, using the same comparator, so
  V8's stable sort keeps ties in insertion order.
- Only rows with `total > 0` are pushed; the item object is never mutated.

## Verification

Ran a differential test (`/root/.hermes/profiles/ougi/cache/scratch/t7_diff.js`)
comparing `proc` from both files over 5000 randomized inputs (mixed
numeric/string/null ids and statuses, amounts of 0 / negative / fractional,
falsy `c` variants) plus 9 hand-picked edge cases (empty input, zero/negative
amount, duplicate ids, mixed-type duplicate ids, null filter). `JSON.stringify`
of both results was identical in all **5009** cases — 0 mismatches.

Files in this skill

  • T1_with-skill.md11.8 KB
  • T1_without-skill.md6.4 KB
  • T2_with-skill.md9.1 KB
  • T2_without-skill.md4.5 KB
  • T3_with-skill.md1.9 KB
  • T3_without-skill.md1.5 KB
  • T4_with-skill.md1.2 KB
  • T4_without-skill.md1.1 KB
  • T5_with-skill.md6.2 KB
  • T5_without-skill.md3.5 KB
  • T6_with-skill.md5.6 KB
  • T6_without-skill.md3.7 KB
  • T7_with-skill.md1.9 KB
  • T7_without-skill.md2.3 KB
  • T8_with-skill.md2.9 KB
  • T8_without-skill.md4.4 KB
  • T9_with-skill.md7.1 KB
  • T9_without-skill.md3.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.