<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: stevejvv</title>
    <description>The latest articles on DEV Community by stevejvv (@stevejvv).</description>
    <link>https://dev.to/stevejvv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F152217%2F5f9ed7ff-a514-48c2-93af-8673d396c7cc.jpeg</url>
      <title>DEV Community: stevejvv</title>
      <link>https://dev.to/stevejvv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stevejvv"/>
    <language>en</language>
    <item>
      <title>I built an API that detects chess tactical patterns from FEN and PGN</title>
      <dc:creator>stevejvv</dc:creator>
      <pubDate>Tue, 17 Feb 2026 22:48:09 +0000</pubDate>
      <link>https://dev.to/stevejvv/i-built-an-api-that-detects-chess-tactical-patterns-from-fen-and-pgn-5ef0</link>
      <guid>https://dev.to/stevejvv/i-built-an-api-that-detects-chess-tactical-patterns-from-fen-and-pgn-5ef0</guid>
      <description>&lt;p&gt;I've been working on ChessGrammar, an API that takes a chess &lt;br&gt;
position (FEN) or a full game (PGN) and returns every tactical &lt;br&gt;
pattern it finds.&lt;/p&gt;
&lt;h2&gt;
  
  
  What it detects
&lt;/h2&gt;

&lt;p&gt;10 patterns: fork, pin, skewer, discovered attack, double check, &lt;br&gt;
back rank mate, smothered mate, deflection, interference, &lt;br&gt;
trapped piece.&lt;/p&gt;

&lt;p&gt;For each tactic, it returns the trigger move, target pieces, &lt;br&gt;
material gain, and the forced sequence.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The engine uses a two-phase approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Depth 1&lt;/strong&gt; — fast geometric detection. Scans piece 
relationships to find pattern candidates in ~5ms per position.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Depth 2&lt;/strong&gt; — sequence confirmation. Verifies that the tactic 
works against best defense by computing forcing sequences.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No Stockfish dependency at runtime. The engine runs custom &lt;br&gt;
heuristic algorithms built on top of python-chess.&lt;/p&gt;
&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;There's a playground where you can paste any FEN or PGN &lt;br&gt;
and see the results — no signup, no API key:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://chessgrammar.com/playground" rel="noopener noreferrer"&gt;chessgrammar.com/playground&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;Send this FEN (a knight fork with discovered attack):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API returns two tactics: a fork (knight attacks king &lt;br&gt;
and queen) and a discovered attack on the queen, both &lt;br&gt;
with a +7.0 material gain.&lt;/p&gt;

&lt;h2&gt;
  
  
  API
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://chessgrammar.com/api/v1/extract &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"fen": "6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full docs at &lt;a href="https://chessgrammar.com/docs" rel="noopener noreferrer"&gt;chessgrammar.com/docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;More patterns (hanging piece, overload), forcing tree &lt;br&gt;
confirmation, batch analysis, and a game evaluation &lt;br&gt;
endpoint. Full roadmap in the docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback
&lt;/h2&gt;

&lt;p&gt;If you try the playground and something looks wrong, &lt;br&gt;
there's a bug report button built in. I'd love to hear &lt;br&gt;
what you think — especially if you've worked on chess &lt;br&gt;
analysis tools before.&lt;/p&gt;

</description>
      <category>chess</category>
      <category>python</category>
      <category>api</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
