mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
add /fact-check command; enable juspay litellm on pureintent
This commit is contained in:
parent
44030e62e3
commit
c13a063d25
3 changed files with 60 additions and 5 deletions
49
AI/commands/fact-check.md
Normal file
49
AI/commands/fact-check.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
description: Fact-check code changes for rigor — catch silent error swallowing, bogus fallbacks, and wishful thinking
|
||||
---
|
||||
|
||||
# Fact-Check Command
|
||||
|
||||
Audit code for **correctness and rigor**. This is not a style review — it's a logic review. Find places where the code lies to itself.
|
||||
|
||||
## 0. Determine Scope
|
||||
|
||||
- Before starting, use the `AskUserQuestion` tool to ask: should this operate on the **whole codebase** or only on **changes in the current branch/PR**?
|
||||
- If scoped to current branch/PR, use `git diff main...HEAD` (or the appropriate base branch) to identify changed files and limit all subsequent steps to those files only.
|
||||
|
||||
## What to flag
|
||||
|
||||
### 1. Silent error swallowing
|
||||
- Bare `try/except: pass`, empty `catch {}`, `|| true` hiding real failures.
|
||||
- Errors caught and logged but not propagated when callers depend on failure signals.
|
||||
- `Result`/`Option`/`Maybe` types silently defaulted without justification.
|
||||
|
||||
### 2. Inaccurate fallbacks
|
||||
- Default values that mask misconfiguration (e.g., falling back to `""` or `null` when the real fix is to fail loud).
|
||||
- "Sensible defaults" that aren't actually sensible for the failure case.
|
||||
- Fallback paths that silently degrade correctness (e.g., returning stale data without indicating staleness).
|
||||
|
||||
### 3. Wishful thinking
|
||||
- Assumptions about input shape/type without validation at system boundaries.
|
||||
- Code that "can't fail" but actually can (network, filesystem, permissions).
|
||||
- Race conditions papered over with comments like "this should be fine".
|
||||
|
||||
### 4. Logic errors
|
||||
- Conditions that are always true/false.
|
||||
- Off-by-one errors, wrong comparison operators.
|
||||
- Variables shadowed or unused in a way that changes behavior.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read the diff.
|
||||
2. For each changed file, read enough surrounding context to understand intent.
|
||||
3. List every finding with file, line, and a one-line explanation of the risk.
|
||||
4. For each finding, propose a concrete fix (code snippet or direction).
|
||||
5. If no issues found, say so — don't invent problems.
|
||||
|
||||
## Principles
|
||||
|
||||
- **Fail loud over fail silent**: Code should scream when something is wrong, not quietly do the wrong thing.
|
||||
- **No wishful thinking**: If it can fail, handle the failure explicitly.
|
||||
- **Fallbacks must be justified**: Every default/fallback needs a reason why that value is correct for the failure case, not just convenient.
|
||||
- **Precision over coverage**: Better to catch 3 real issues than flag 20 maybes.
|
||||
|
|
@ -66,24 +66,29 @@ Take a GitHub issue, prompt, or task description and execute it top-to-bottom: i
|
|||
5. Run `just ci` again.
|
||||
- Repeat until CI passes. Max 5 attempts — if still failing after 5, stop and ask the user.
|
||||
|
||||
### 7. **Elegance Pass**
|
||||
### 7. **Fact-Check**
|
||||
|
||||
- Run `/fact-check` on the current changes.
|
||||
- If it finds real issues (silent error swallowing, bogus fallbacks, wishful thinking), fix them and create a NEW commit.
|
||||
|
||||
### 8. **Elegance Pass**
|
||||
|
||||
- Run the `/elegance` (*NOT* `/simplify`) command targeting the relevant technology, for **3 iterations**.
|
||||
- When `/elegance` asks about scope (via `AskUserQuestion`), answer: **changes in the current branch/PR only**.
|
||||
- After elegance completes, create a NEW commit for the elegance improvements.
|
||||
|
||||
### 8. **Final CI**
|
||||
### 9. **Final CI**
|
||||
|
||||
- Push all elegance changes.
|
||||
- Run `just ci` again.
|
||||
- If it fails, enter the CI fix loop from step 6 again.
|
||||
|
||||
### 9. **Update PR Description**
|
||||
### 10. **Update PR Description**
|
||||
|
||||
- After all changes (elegance, CI fixes), re-check the PR title/body.
|
||||
- If scope changed, update via `gh pr edit` per the `github-pr` skill.
|
||||
|
||||
### 10. **Done**
|
||||
### 11. **Done**
|
||||
|
||||
- Report the PR URL and a brief summary of what was done.
|
||||
|
||||
|
|
@ -93,4 +98,4 @@ Take a GitHub issue, prompt, or task description and execute it top-to-bottom: i
|
|||
- **CI must pass**: Don't move to the next phase until CI is green.
|
||||
- **Simple over clever**: Do the boring obvious thing.
|
||||
- **Autonomous**: Never ask. Pick sensible defaults and keep moving.
|
||||
- **Complete the full workflow**: Implementing code is step 4 of 10. You MUST open a draft PR, run CI, do the elegance pass, and report the PR URL. Stopping after commit = failure.
|
||||
- **Complete the full workflow**: Implementing code is step 4 of 11. You MUST open a draft PR, run CI, do the elegance pass, and report the PR URL. Stopping after commit = failure.
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ in
|
|||
"${homeMod}/cli/ssh-agent-forwarding.nix"
|
||||
"${homeMod}/cli/controlpersist.nix"
|
||||
"${homeMod}/claude-code"
|
||||
"${homeMod}/opencode/juspay.nix"
|
||||
"${homeMod}/work/juspay.nix"
|
||||
"${homeMod}/services/vira.nix"
|
||||
"${homeMod}/services/kolu.nix"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue